Look http://commons.apache.org/proper/commons-dbcp/configuration.html (the block with validationQuery parameter). Just configure your tomee datasource used by the broker with it.
Maybe AMQ guys would have more inputs if it doesn't help. *Romain Manni-Bucau* *Twitter: @rmannibucau <https://twitter.com/rmannibucau>* *Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/> *LinkedIn: **http://fr.linkedin.com/in/rmannibucau* *Github: https://github.com/rmannibucau* 2013/9/12 tschuler <[email protected]> > Hi Romain! > > As the database runs on the same computer I don't think it's a network > issue. > But anyhow, can you give me an example how to use a pool for activemq > database connections in TomEE? > > Best regards, > Thomas > > > Von: Romain Manni-Bucau [via OpenEJB] [mailto: > [email protected]] > Gesendet: Donnerstag, 12. September 2013 09:33 > An: Thomas Schuler > Betreff: Re: ActiveMQ broker stops > > Hi > > isn't it simply cause you have a network issue between your tomee and the > database? > > this would mean you need to configure the pool to avoid this kind of issue > (using connection eviction config - see validationquery etc...) > > *Romain Manni-Bucau* > *Twitter: @rmannibucau <https://twitter.com/rmannibucau>* > *Blog: **http://rmannibucau.wordpress.com/*< > http://rmannibucau.wordpress.com/> > *LinkedIn: **http://fr.linkedin.com/in/rmannibucau* > *Github: https://github.com/rmannibucau* > > > > 2013/9/12 tschuler <[hidden > email]</user/SendEmail.jtp?type=node&node=4665061&i=0>> > > > Hi! > > > > From time to time (TomEE may run several days without any problems) the > > activeMQ broker stops - following log messages can be found in > > catalina.log: > > > > Sep 9, 2013 1:38:55 PM > org.apache.activemq.store.jdbc.DefaultDatabaseLocker > > keepAlive > > SEVERE: Failed to update database lock: > > com.microsoft.sqlserver.jdbc.SQLServerException: The query has timed out. > > com.microsoft.sqlserver.jdbc.SQLServerException: The query has timed out. > > at > > > > > com.microsoft.sqlserver.jdbc.TDSCommand.checkForInterrupt(IOBuffer.java:5918) > > at > com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:70) > > at > > > > > com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1510) > > at > > > > > com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:404) > > at > > > > > com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:350) > > at > > com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5696) > > at > > > > > com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1715) > > at > > > > > com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:180) > > at > > > > > com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:155) > > at > > > > > com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(SQLServerPreparedStatement.java:314) > > at > > > > > org.apache.activemq.store.jdbc.DefaultDatabaseLocker.keepAlive(DefaultDatabaseLocker.java:184) > > at > > > > > org.apache.activemq.broker.LockableServiceSupport.keepLockAlive(LockableServiceSupport.java:115) > > at > > > > > org.apache.activemq.broker.LockableServiceSupport$1.run(LockableServiceSupport.java:88) > > at > > java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) > > at > > > java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317) > > at > java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150) > > at > > > > > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98) > > at > > > > > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180) > > at > > > > > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204) > > at > > > > > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) > > at > > > > > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) > > at java.lang.Thread.run(Thread.java:662) > > Sep 9, 2013 1:38:55 PM org.apache.activemq.broker.LockableServiceSupport > > stopBroker > > INFO: localhost, no longer able to keep the exclusive lock so giving up > > being a master > > > > > > Is there a TomEE configuration parameter that enforces TomEE to restart a > > stopped activeMq broker? > > Can we somehow avoid the stopping of the broker as the database was > > available all the time? > > > > > > We are using TomEE 1.6.0 webprofile snapshot (from a few days ago) and > add > > activeMQ jars to lib directory on our own. > > > > The tomee.xml looks like this: > > > > > > <Resource id="JmsDS" type="DataSource"> > > JdbcDriver com.microsoft.sqlserver.jdbc.SQLServerDriver > > JdbcUrl > > > > > jdbc:sqlserver://localhost:1433;DatabaseName=TOMEE_TEST;responseBuffering=adaptive > > UserName tomee > > Password tomee > > JtaManaged true > > </Resource> > > <Resource id="JmsResourceAdapter" type="ActiveMQResourceAdapter"> > > BrokerXmlConfig > > broker:(tcp://localhost:61616)?persistent=true&useJmx=false > > ServerUrl = failover:(tcp://localhost:61616) > > DataSource JmsDS > > </Resource> > > <Resource id="JmsConnectionFactory" > > type="javax.jms.ConnectionFactory"> > > ResourceAdapter = JmsResourceAdapter > > </Resource> > > <Container id="JmsMdbContainer" ctype="MESSAGE"> > > ResourceAdapter = JmsResourceAdapter > > </Container> > > > > Best regards, > > Thomas > > > > > > > > -- > > View this message in context: > > http://openejb.979440.n4.nabble.com/ActiveMQ-broker-stops-tp4665060.html > > Sent from the OpenEJB User mailing list archive at Nabble.com. > > > > ________________________________ > If you reply to this email, your message will be added to the discussion > below: > > http://openejb.979440.n4.nabble.com/ActiveMQ-broker-stops-tp4665060p4665061.html > To unsubscribe from ActiveMQ broker stops, click here< > http://openejb.979440.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4665060&code=dGhvbWFzLnNjaHVsZXJAb3BlbnRleHQuY29tfDQ2NjUwNjB8LTE4NTIyNTQ0OTI= > >. > NAML< > http://openejb.979440.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml > > > > > > > -- > View this message in context: > http://openejb.979440.n4.nabble.com/ActiveMQ-broker-stops-tp4665060p4665062.html > Sent from the OpenEJB User mailing list archive at Nabble.com. >
