0
votes

I am trying to upgrade the version of activemq from 5.7 to 5.14.5. Steps I followed are as follows:

  1. Downloaded new files for 5.14.5

  2. Replaced with the existing 5.7 files.

  3. Modified Activemq.xml for the customized configuration and also added ojdbc14.jar to lib folder. Modifed some of the customized files in conf folder.

  4. In the logs i am getting following error :


2018-03-12 09:26:34,077 | INFO  | Using Persistence Adapter: JDBCPersistenceAdapter(org.apache.commons.dbcp2.BasicDataSource@66998e4b) | org.apache.activemq.broker.BrokerService | main

2018-03-12 09:26:34,168 | INFO  | JMX consoles can connect to service:jmx:rmi:///jndi/rmi://localhost:2017/jmxrmi | org.apache.activemq.broker.jmx.ManagementContext | JMX connector

2018-03-12 09:26:34,565 | WARN  | Exception encountered during context initialization - **cancelling refresh attempt: 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.AbstractMethodError | org.apache.activemq.xbean.XBeanBrokerFactory$1 | main

2018-03-12 09:26:34,579 | ERROR | Failed to load: class path resource** [activemq.xml], reason: 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.AbstractMethodError | org.apache.activemq.xbean.XBeanBrokerFactory | main
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.AbstractMethodError
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1572)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:755)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:762)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
    at org.apache.xbean.spring.context.ResourceXmlApplicationContext.(ResourceXmlApplicationContext.java:64)
    at org.apache.xbean.spring.context.ResourceXmlApplicationContext.(ResourceXmlApplicationContext.java:52)
    at org.apache.activemq.xbean.XBeanBrokerFactory$1.(XBeanBrokerFactory.java:104)
    at org.apache.activemq.xbean.XBeanBrokerFactory.createApplicationContext(XBeanBrokerFactory.java:104)
    at org.apache.activemq.xbean.XBeanBrokerFactory.createBroker(XBeanBrokerFactory.java:67)
    at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:71)
    at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:54)
    at org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:87)
    at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:63)
    at org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:154)
    at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:63)
    at org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:104)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.activemq.console.Main.runTaskClass(Main.java:262)
    at org.apache.activemq.console.Main.main(Main.java:115)
Caused by: java.lang.AbstractMethodError
    at org.apache.commons.dbcp2.DelegatingConnection.isValid(DelegatingConnection.java:918)
    at org.apache.commons.dbcp2.DelegatingConnection.isValid(DelegatingConnection.java:918)
    at org.apache.commons.dbcp2.PoolableConnection.validate(PoolableConnection.java:283)
    at org.apache.commons.dbcp2.PoolableConnectionFactory.validateConnection(PoolableConnectionFactory.java:357)
    at org.apache.commons.dbcp2.BasicDataSource.validateConnectionFactory(BasicDataSource.java:2307)
    at org.apache.commons.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:2290)
    at org.apache.commons.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:2039)
    at org.apache.commons.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1533)
    at org.apache.activemq.store.jdbc.TransactionContext.lockAndWrapped(TransactionContext.java:70)
    at org.apache.activemq.store.jdbc.TransactionContext.getConnection(TransactionContext.java:63)
    at org.apache.activemq.store.jdbc.JDBCPersistenceAdapter.loadAdapter(JDBCPersistenceAdapter.java:451)
    at org.apache.activemq.store.jdbc.JDBCPersistenceAdapter.createAdapter(JDBCPersistenceAdapter.java:434)
    at org.apache.activemq.store.jdbc.JDBCPersistenceAdapter.getAdapter(JDBCPersistenceAdapter.java:383)
    at org.apache.activemq.store.jdbc.JDBCPersistenceAdapter.init(JDBCPersistenceAdapter.java:296)
    at org.apache.activemq.broker.LockableServiceSupport.preStart(LockableServiceSupport.java:89)
    at org.apache.activemq.util.ServiceSupport.start(ServiceSupport.java:54)
    at org.apache.activemq.broker.BrokerService.doStartPersistenceAdapter(BrokerService.java:675)
    at org.apache.activemq.broker.BrokerService.startPersistenceAdapter(BrokerService.java:659)
    at org.apache.activemq.broker.BrokerService.start(BrokerService.java:623)
    at org.apache.activemq.xbean.XBeanBrokerService.afterPropertiesSet(XBeanBrokerService.java:73)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1700)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1639)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1568)

ActiveMQ.xml is as follows:

  <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">
                <list>
                    <value>file:${activemq.conf}/credentials.properties</value>
                    <value>file:${activemq.conf}/jdbc.properties</value>
                </list>
            </property>
        </bean>

       <!-- Allows accessing the server log -->
        <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=">" producerFlowControl="true">

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


            <managementContext>
                <managementContext createConnector="true"/>
            </managementContext>


            <persistenceAdapter>
                <jdbcPersistenceAdapter dataDirectory="${base}/data/" dataSource="#oracle-ds">
                    <statements>
                        <statements tablePrefix="AMQ_"/>
                    </statements>
                </jdbcPersistenceAdapter>
            </persistenceAdapter>


              <systemUsage>
                <systemUsage>
                    <memoryUsage>
                        <memoryUsage percentOfJvmHeap="70" />
                    </memoryUsage>
                    <storeUsage>
                        <storeUsage limit="100 gb"/>
                    </storeUsage>
                    <tempUsage>
                        <tempUsage limit="50 gb"/>
                    </tempUsage>
                </systemUsage>
            </systemUsage>

            <transportConnectors>
                <!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB -->
                  <transportConnector name="openwire" uri="tcp://0.0.0.0:61616?maximumConnections=1000&amp;wireformat.maxFrameSize=104857600"/>
                <transportConnector name="stomp" uri="stomp://0.0.0.0:61613"/>
            </transportConnectors>

            <!-- destroy the spring context on shutdown to stop jetty -->
            <shutdownHooks>
                <bean xmlns="http://www.springframework.org/schema/beans" class="org.apache.activemq.hooks.SpringContextHook" />
            </shutdownHooks>

        </broker>

     <import resource="jetty.xml"/>

        <bean id="oracle-ds" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
            <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
            <property name="url" value="${url} />
            <property name="username" value="${oracle.jdbc.username}"/>
            <property name="password" value="${oracle.jdbc.password}"/>
            <property name="maxTotal" value="20"/>  
            <property name="poolPreparedStatements" value="true"/>
          </bean>
    </beans>
2

2 Answers

2
votes

The solution is I was using ojdbc14.jar which does not implement new JDBC APIs required for this ActiveMQ version so downloading "ojdbc6.jar" which supports oracle 11g solves the issue.

1
votes

Is it possible that you're downgrading ?

Please take a look at the order of ActiveMQ releases

...

  • ActiveMQ 5.14.4 Release
  • ActiveMQ 5.14.5 Release
  • ActiveMQ 5.15.0 Release

...

  • ActiveMQ 5.6.0 Release
  • ActiveMQ 5.7.0 Release