MySQLSyntaxErrorException:用户已经有超过'max_user_connections'的活动连接

时间:2022-06-01 19:47:51

I get this error when accessing directly from a servlet

直接从servlet访问时出现此错误

public class UpdateFloorEventServlet extends HttpServlet {  

@Override
@Transactional(readOnly=true)
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(getServletContext());

    try {

    FloorDAO floorDAO = (FloorDAO)context.getBean("floorDAO");

...

I guess I should increase the connections in the datasource defined but i don't know how

我想我应该增加定义的数据源中的连接,但我不知道如何

<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"
             p:dataSource-ref="dataSource"  
             p:packagesToScan="com.confloorapp.domain"
             />

<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" 
destroy-method="close" 
p:driverClass="${jdbc.driverClassName}" 
p:jdbcUrl="${jdbc.url}"
p:user="${jdbc.username}"
p:password="${jdbc.password}"
p:acquireIncrement="5"
            p:idleConnectionTestPeriod="60"
            p:maxPoolSize="100"
            p:maxStatements="50"
            p:minPoolSize="10" 
/>

1 个解决方案

#1


0  

getting the service insted of the DOA solved the problem: FloorService floorService = (FloorService)context.getBean("floorService");

获取DOA的服务解决了问题:FloorService floorService =(FloorService)context.getBean(“floorService”);

#1


0  

getting the service insted of the DOA solved the problem: FloorService floorService = (FloorService)context.getBean("floorService");

获取DOA的服务解决了问题:FloorService floorService =(FloorService)context.getBean(“floorService”);