Hi

I suspect that the connection is idle and the object becomes invalid
in the pool.

Maybe you can try to add testWhileIdle to true in the DBCP configuration.

Regards
JB

On Wed, Dec 11, 2024 at 7:19 AM Zhu <busi...@126.com> wrote:
>
> Hello team,
>    There was a mistake with the previous 
> email(https://lists.apache.org/thread/6to6lt69vxvp3sbslr8xob24p61bb6ow ), 
> please refer to this one.
>    My activeMQ cluster running on master-slave mode.Two nodes try aquiring 
> mysql lock to become master.I upgrade the MySQL from 5.7 to 8.0,and noticed 
> that it will crash every 4-5 days.It will goes well shortly after I restart 
> the service and crash in 4-5 days again .
> The error log is like:
>
> INFO   | jvm 1    | 2024/12/11 08:26:42 | ERROR: 
> org.springframework.beans.factory.BeanCreationException: Error creating bean 
> with name 'org.apache.activemq.xbean.XBeanBrokerService#0' defined in class 
> path resource [activemq.xml]: Invocation of init method failed; nested 
> exception is java.lang.IllegalStateException: Object has already been 
> returned to this pool or is invalid
>
>
> INFO   | jvm 1    | 2024/12/11 08:26:42 | 
> org.springframework.beans.factory.BeanCreationException: Error creating bean 
> with name 'org.apache.activemq.xbean.XBeanBrokerService#0' defined in class 
> path resource [activemq.xml]: Invocation of init method failed; nested 
> exception is java.lang.IllegalStateException: Object has already been 
> returned to this pool or is invalid
>
>
> INFO   | jvm 1    | 2024/12/11 08:26:42 | at 
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1572)
>
>
> INFO   | jvm 1    | 2024/12/11 08:26:42 | at 
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
>
>
> INFO   | jvm 1    | 2024/12/11 08:26:42 | at 
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
>
>
> INFO   | jvm 1    | 2024/12/11 08:26:42 | at 
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
>
>
>
>
> It seems that the problem lies in the database link.Mysql config in 
> activemq.xml is below:
>
>        <persistenceAdapter>
>
>
>           <!-- <kahaDB 
> directory="${activemq.base}/data/kahadb"/>useDatabaseLock="true" 
> createTablesOnStartup="false"   -->
>
>
>                <jdbcPersistenceAdapter dataDirectory="${activemq.base}/data" 
> dataSource="#mysql-ds" useDatabaseLock="true" createTablesOnStartup="false"/>
>
>
>        </persistenceAdapter>
>
>
>
>
>         <bean id="mysql-ds" class="org.apache.commons.dbcp2.BasicDataSource" 
> destroy-method="close">
>
>                <property name="driverClassName" 
> value="com.mysql.cj.jdbc.Driver"/>
>
>
>                <property name="url" 
> value="jdbc:mysql://MYIP:3306/plat_activemq?relaxAutoCommit=true&amp;useSSL=false&amp;serverTimezone=GMT%2B8"/>
>
>
>                <property name="username" value="MYUSER"/>
>
>
>                <property name="password" value="MYPWD"/>
>
>
>                <property name="poolPreparedStatements" value="true"/>
>
>
>        </bean>
>
>
>
>
> I have upgrade jars in ${activemq_home}/lib:
>
> 1、commons-dbcp2-2.0.jar
>
> 2、commons-pool2-2.9.0.jar
>
> 3、mysql-connector-java-8.0.27.jar
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@activemq.apache.org
For additional commands, e-mail: users-h...@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact


Reply via email to