journaledJDBC not creating ACTIVEMQ_MSGS with MS SQL 2008
---------------------------------------------------------
Key: AMQ-2496
URL: https://issues.apache.org/activemq/browse/AMQ-2496
Project: ActiveMQ
Issue Type: Bug
Components: Broker
Affects Versions: 5.3.0
Environment: MS SQL 2008
Reporter: HiSkill
Priority: Blocker
Env:
- ActiveMQ 5.3.0
- deployed as RAR on JBoss
- database : MS SQL 2008
When the broker starts up for the first time, table ACTIVEMQ_MSGS is not
getting created automatically which throws the below exception and the broker
never comes up.
Reason: java.io.IOException: Failed to get last broker message id:
com.microsoft.sqlserver.jdbc.SQLServerException: Invalid object name
'ACTIVEMQ_MSGS'.
java.io.IOException: Failed to get last broker message id:
com.microsoft.sqlserver.jdbc.SQLServerException: Invalid object name
'ACTIVEMQ_MSGS'.
at
org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:33)
at
org.apache.activemq.store.jdbc.JDBCPersistenceAdapter.getLastMessageBrokerSequenceId(JDBCPersistenceAdapter.java:170)
at
org.apache.activemq.store.journal.JournalPersistenceAdapter.getLastMessageBrokerSequenceId(JournalPersistenceAdapter.java:212)
at
org.apache.activemq.broker.region.DestinationFactoryImpl.getLastMessageBrokerSequenceId(DestinationFactoryImpl.java:140)
at org.apache.activemq.broker.region.RegionBroker.<init>(RegionBroker.java:106)
at
org.apache.activemq.broker.jmx.ManagedRegionBroker.<init>(ManagedRegionBroker.java:94)
at
org.apache.activemq.broker.BrokerService.createRegionBroker(BrokerService.java:1695)
at
org.apache.activemq.broker.BrokerService.createRegionBroker(BrokerService.java:1689)
at
org.apache.activemq.broker.BrokerService.createBroker(BrokerService.java:1649)
at org.apache.activemq.broker.BrokerService.getBroker(BrokerService.java:667)
at
org.apache.activemq.broker.BrokerService.getAdminConnectionContext(BrokerService.java:1866)
at
org.apache.activemq.broker.BrokerService.startDestinations(BrokerService.java:1853)
at org.apache.activemq.broker.BrokerService.start(BrokerService.java:450)
at
org.apache.activemq.xbean.XBeanBrokerService.afterPropertiesSet(XBeanBrokerService.java:56)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
Only workaround is to create the table ACTIVEMQ_MSGS manually and restart the
broker.
Here is my broker-config.xml :
<beans xmlns="http://activemq.apache.org/schema/core">
<bean xmlns=""
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
<bean xmlns="" id="my-ds" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName"
value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
<property name="url"
value="jdbc:sqlserver://mydb:1433;databaseName=myds"/>
<property name="username" value="sql"/>
<property name="password" value="sql"/>
<property name="initialSize" value="10"/>
<property name="poolPreparedStatements" value="true"/>
</bean>
<!-- shutdown hook is disabled as RAR classloader may be gone at shutdown -->
<broker useJmx="true" brokerName="sample.broker1" useShutdownHook="false">
<destinations>
<topic physicalName="pocket" />
</destinations>
<managementContext>
<!-- use appserver provided context instead of creating one,
for jboss use: -Djboss.platform.mbeanserver -->
<managementContext createConnector="false"/>
</managementContext>
<persistenceAdapter>
<!-- <amqPersistenceAdapter syncOnWrite="false"
directory="${jboss.server.data.dir}/activemq" maxFileLength="20 mb"/> -->
<!-- <journaledJDBC journalLogFiles="5"
dataDirectory="${jboss.server.data.dir}/activemq"/> -->
<!-- To use a different datasource, use th following syntax : -->
<!-- <kahaPersistenceAdapter
directory="${jboss.server.data.dir}/activemq" maxDataFileLength="33554432"/> -->
<journaledJDBC journalLogFiles="5"
dataDirectory="${jboss.server.data.dir}/activemq" dataSource="#my-ds"
useDatabaseLock="false" />
</persistenceAdapter>
<transportConnectors>
<transportConnector name="sample.broker1" uri="tcp://localhost:3030"
discoveryUri="multicast://default"/>
</transportConnectors>
</broker>
</beans>
Note that I don't see the issue with MSSQL 2000 2005, not sure whats the
problem with 2008 version.
Let me know if there is any cofiguration missing which would resolve the issue
with MS SQL 2008 and any other databases which could have the sample problem.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.