activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sparg <sp...@hotmail.es>
Subject ActiveMQ - Could not get JDBC connection with SQL Server 2012
Date Thu, 17 Dec 2015 16:22:08 GMT
I try to replace kahaDB by SQL Server 2012 in ActiveMQ.

After of to implement the persistence with "SQL Server 2012"
(http://activemq.apache.org/sqlserver.html).

I'm find the next problem:

---------------------------------------------------------

activemq.log (summary)
---------------------------------------------------------

2015-12-17 17:10:44,454 | INFO  | Refreshing
org.apache.activemq.xbean.XBeanBrokerFactory$1@75dda1ae: startup date [Thu
Dec 17 17:10:44 CET 2015]; root of context hierarchy |
org.apache.activemq.xbean.XBeanBrokerFactory$1 | WrapperSimpleAppMain
2015-12-17 17:10:45,916 | INFO  |
PListStore:[C:\apache-activemq-5.13.0\bin\win64\..\..\data\localhost\tmp_storage]
started | org.apache.activemq.store.kahadb.plist.PListStoreImpl |
WrapperSimpleAppMain
2015-12-17 17:10:45,951 | INFO  | Using Persistence Adapter:
JDBCPersistenceAdapter(org.apache.commons.dbcp2.BasicDataSource@1bae0625) |
org.apache.activemq.broker.BrokerService | WrapperSimpleAppMain
2015-12-17 17:10:45,961 | WARN  | Could not get JDBC connection: Cannot
create JDBC driver of class 'com.microsoft.sqlserver.jdbc.SQLServerDriver'
for connect URL
'jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=activedb' |
org.apache.activemq.store.jdbc.JDBCPersistenceAdapter | WrapperSimpleAppMain
java.sql.SQLException: Cannot create JDBC driver of class
'com.microsoft.sqlserver.jdbc.SQLServerDriver' for connect URL
'jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=activedb'
    at
org.apache.commons.dbcp2.BasicDataSource.createConnectionFactory(BasicDataSource.java:2161)[commons-dbcp2-2.1.1.jar:2.1.1]
    at
org.apache.commons.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:2033)[commons-dbcp2-2.1.1.jar:2.1.1]
    at
org.apache.commons.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1533)[commons-dbcp2-2.1.1.jar:2.1.1]
    at
org.apache.activemq.store.jdbc.TransactionContext.getConnection(TransactionContext.java:59)[activemq-jdbc-store-5.13.0.jar:5.13.0]
    at
org.apache.activemq.store.jdbc.JDBCPersistenceAdapter.loadAdapter(JDBCPersistenceAdapter.java:449)[activemq-jdbc-store-5.13.0.jar:5.13.0]
    at
org.apache.activemq.store.jdbc.JDBCPersistenceAdapter.createAdapter(JDBCPersistenceAdapter.java:432)[activemq-jdbc-store-5.13.0.jar:5.13.0]
    at
org.apache.activemq.store.jdbc.JDBCPersistenceAdapter.getAdapter(JDBCPersistenceAdapter.java:381)[activemq-jdbc-store-5.13.0.jar:5.13.0]
    at
org.apache.activemq.store.jdbc.JDBCPersistenceAdapter.init(JDBCPersistenceAdapter.java:296)[activemq-jdbc-store-5.13.0.jar:5.13.0]
    at
org.apache.activemq.broker.LockableServiceSupport.preStart(LockableServiceSupport.java:89)[activemq-broker-5.13.0.jar:5.13.0]
    at
org.apache.activemq.util.ServiceSupport.start(ServiceSupport.java:54)[activemq-client-5.13.0.jar:5.13.0]
    at
org.apache.activemq.broker.BrokerService.doStartPersistenceAdapter(BrokerService.java:664)[activemq-broker-5.13.0.jar:5.13.0]
    at
org.apache.activemq.broker.BrokerService.startPersistenceAdapter(BrokerService.java:653)[activemq-broker-5.13.0.jar:5.13.0]
    at
org.apache.activemq.broker.BrokerService.start(BrokerService.java:617)[activemq-broker-5.13.0.jar:5.13.0]
    at
org.apache.activemq.xbean.XBeanBrokerService.afterPropertiesSet(XBeanBrokerService.java:73)[activemq-spring-5.13.0.jar:5.13.0]
2015-12-17 17:10:46,042 | INFO  | No IOExceptionHandler registered, ignoring
IO exception | org.apache.activemq.broker.BrokerService |
WrapperSimpleAppMain
java.io.IOException: Cannot create JDBC driver of class
'com.microsoft.sqlserver.jdbc.SQLServerDriver' for connect URL
'jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=activedb'
    at
org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:45)[activemq-client-5.13.0.jar:5.13.0]
    at
org.apache.activemq.store.jdbc.TransactionContext.getConnection(TransactionContext.java:71)[activemq-jdbc-store-5.13.0.jar:5.13.0]
    at
org.apache.activemq.store.jdbc.JDBCPersistenceAdapter.loadAdapter(JDBCPersistenceAdapter.java:449)[activemq-jdbc-store-5.13.0.jar:5.13.0]
    at
org.apache.activemq.store.jdbc.JDBCPersistenceAdapter.createAdapter(JDBCPersistenceAdapter.java:432)[activemq-jdbc-store-5.13.0.jar:5.13.0]
    at
org.apache.activemq.store.jdbc.JDBCPersistenceAdapter.getAdapter(JDBCPersistenceAdapter.java:381)[activemq-jdbc-store-5.13.0.jar:5.13.0]
    at
org.apache.activemq.store.jdbc.JDBCPersistenceAdapter.init(JDBCPersistenceAdapter.java:296)[activemq-jdbc-store-5.13.0.jar:5.13.0]
    at
org.apache.activemq.broker.LockableServiceSupport.preStart(LockableServiceSupport.java:89)[activemq-broker-5.13.0.jar:5.13.0]
    at
org.apache.activemq.util.ServiceSupport.start(ServiceSupport.java:54)[activemq-client-5.13.0.jar:5.13.0]
    at
org.apache.activemq.broker.BrokerService.doStartPersistenceAdapter(BrokerService.java:664)[activemq-broker-5.13.0.jar:5.13.0]
    at
org.apache.activemq.broker.BrokerService.startPersistenceAdapter(BrokerService.java:653)[activemq-broker-5.13.0.jar:5.13.0]
    at
org.apache.activemq.broker.BrokerService.start(BrokerService.java:617)[activemq-broker-5.13.0.jar:5.13.0]
    at
org.apache.activemq.xbean.XBeanBrokerService.afterPropertiesSet(XBeanBrokerService.java:73)[activemq-spring-5.13.0.jar:5.13.0]
2015-12-17 17:10:46,047 | ERROR | Failed to start Apache ActiveMQ
([localhost, null], java.io.IOException: Cannot create JDBC driver of class
'com.microsoft.sqlserver.jdbc.SQLServerDriver' for connect URL
'jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=activedb') |
org.apache.activemq.broker.BrokerService | WrapperSimpleAppMain
2015-12-17 17:10:46,052 | INFO  | Apache ActiveMQ 5.13.0 (localhost, null)
is shutting down | org.apache.activemq.broker.BrokerService |
WrapperSimpleAppMain
2015-12-17 17:10:46,054 | INFO  | Connector openwire stopped |
org.apache.activemq.broker.TransportConnector | WrapperSimpleAppMain
2015-12-17 17:10:46,056 | INFO  | Connector amqp stopped |
org.apache.activemq.broker.TransportConnector | WrapperSimpleAppMain
2015-12-17 17:10:46,058 | INFO  | Connector stomp stopped |
org.apache.activemq.broker.TransportConnector | WrapperSimpleAppMain
2015-12-17 17:10:46,060 | INFO  | Connector mqtt stopped |
org.apache.activemq.broker.TransportConnector | WrapperSimpleAppMain
2015-12-17 17:10:46,062 | INFO  | Connector ws stopped |
org.apache.activemq.broker.TransportConnector | WrapperSimpleAppMain
2015-12-17 17:10:46,068 | INFO  |
PListStore:[C:\apache-activemq-5.13.0\bin\win64\..\..\data\localhost\tmp_storage]
stopped | org.apache.activemq.store.kahadb.plist.PListStoreImpl |
WrapperSimpleAppMain
2015-12-17 17:10:46,077 | INFO  | Apache ActiveMQ 5.13.0 (localhost, null)
uptime 0.151 seconds | org.apache.activemq.broker.BrokerService |
WrapperSimpleAppMain
2015-12-17 17:10:46,080 | INFO  | Apache ActiveMQ 5.13.0 (localhost, null)
is shutdown | org.apache.activemq.broker.BrokerService |
WrapperSimpleAppMain
2015-12-17 17:10:46,082 | INFO  | Closing
org.apache.activemq.xbean.XBeanBrokerFactory$1@75dda1ae: startup date [Thu
Dec 17 17:10:44 CET 2015]; root of context hierarchy |
org.apache.activemq.xbean.XBeanBrokerFactory$1 | WrapperSimpleAppMain
2015-12-17 17:10:46,087 | WARN  | Exception thrown from LifecycleProcessor
on context close | org.apache.activemq.xbean.XBeanBrokerFactory$1 |
WrapperSimpleAppMain
java.lang.IllegalStateException: LifecycleProcessor not initialized - call
'refresh' before invoking lifecycle methods via the context:
org.apache.activemq.xbean.XBeanBrokerFactory$1@75dda1ae: startup date [Thu
Dec 17 17:10:44 CET 2015]; root of context hierarchy
    at
org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:357)[spring-context-4.1.8.RELEASE.jar:4.1.8.RELEASE]
    at
org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:881)[spring-context-4.1.8.RELEASE.jar:4.1.8.RELEASE]
    at
org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:840)[spring-context-4.1.8.RELEASE.jar:4.1.8.RELEASE]
    at
org.apache.activemq.hooks.SpringContextHook.run(SpringContextHook.java:30)[activemq-spring-5.13.0.jar:5.13.0]
    at java.lang.reflect.Method.invoke(Unknown Source)[:1.8.0_66]
2015-12-17 17:10:46,151 | WARN  | Exception encountered during context
initialization - cancelling refresh attempt |
org.apache.activemq.xbean.XBeanBrokerFactory$1 | WrapperSimpleAppMain
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.io.IOException: Cannot create JDBC driver of class
'com.microsoft.sqlserver.jdbc.SQLServerDriver' for connect URL
'jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=activedb'
    at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1572)[spring-beans-4.1.8.RELEASE.jar:4.1.8.RELEASE]
    at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)[spring-beans-4.1.8.RELEASE.jar:4.1.8.RELEASE]
    at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)[spring-beans-4.1.8.RELEASE.jar:4.1.8.RELEASE]

----------------------------------------

[activemq.xml]

----------------------------------------

<beans
  xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
  http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core.xsd">

    
    <bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <value>file:${activemq.conf}/credentials.properties</value>
        </property>
    </bean>

   
    <bean id="logQuery" class="io.fabric8.insight.log.log4j.Log4jLogQuery"
          lazy-init="false" scope="singleton"
          init-method="start" destroy-method="stop">
    </bean>

    
    <broker xmlns="http://activemq.apache.org/schema/core"
brokerName="localhost" dataDirectory="${activemq.data}">

        <destinationPolicy>
            <policyMap>
              <policyEntries>
                <policyEntry topic=">" >
                    
                  <pendingMessageLimitStrategy>
                    <constantPendingMessageLimitStrategy limit="1000"/>
                  </pendingMessageLimitStrategy>
                </policyEntry>
              </policyEntries>
            </policyMap>
        </destinationPolicy>


        
        <managementContext>
            <managementContext createConnector="false"/>
        </managementContext>

        
				
        <persistenceAdapter>
			<jdbcPersistenceAdapter dataSource="#mssql-ds"
createTablesOnStartup="false"   />
        </persistenceAdapter>
		
          
          <systemUsage>
            <systemUsage>
                <memoryUsage>
                    <memoryUsage percentOfJvmHeap="70" />
                </memoryUsage>
                <storeUsage>
                    <storeUsage limit="10 gb"/>
                </storeUsage>
                <tempUsage>
                    <tempUsage limit="5 gb"/>
                </tempUsage>
            </systemUsage>
        </systemUsage>

        
        <transportConnectors>
            
            <transportConnector name="openwire"
uri="tcp://0.0.0.0:61616?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
            <transportConnector name="amqp"
uri="amqp://0.0.0.0:5672?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
            <transportConnector name="stomp"
uri="stomp://0.0.0.0:61613?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
            <transportConnector name="mqtt"
uri="mqtt://0.0.0.0:1883?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
            <transportConnector name="ws"
uri="ws://0.0.0.0:61614?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
        </transportConnectors>

        
        <shutdownHooks>
            <bean xmlns="http://www.springframework.org/schema/beans"
class="org.apache.activemq.hooks.SpringContextHook" />
        </shutdownHooks>

    </broker>

	
	<bean id="mssql-ds" class="org.apache.commons.dbcp2.BasicDataSource"
destroy-method="close">
		<property name="driverClassName"
value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
		<property name="url"
value="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=activedb"/>
		<property name="username" value="zetes"/>
		<property name="password" value="zetes"/>
		<property name="poolPreparedStatements" value="true"/>
	</bean>

    
    <import resource="jetty.xml"/>

</beans>

----------------------------------------

Could you please help me fixing this issue?
Thanks,




--
View this message in context: http://activemq.2283324.n4.nabble.com/ActiveMQ-Could-not-get-JDBC-connection-with-SQL-Server-2012-tp4705127.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Mime
View raw message