3

Trying to deploy my grails app to jelastic environment and having a proper TomEE app server configured and all the plugins related to activemq I got the following exception on the server:

INFO: For help or more information please see: http://activemq.apache.org
2016-03-06 20:04:17,194 [localhost-startStop-1] ERROR context.GrailsContextLoader  - Error initializing the application: Error creating bean with name 'myBrokerService': Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.apache.activemq.usage.TempUsage.getStore()Lorg/apache/activemq/store/kahadb/plist/PListStore;
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myBrokerService': Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.apache.activemq.usage.TempUsage.getStore()Lorg/apache/activemq/store/kahadb/plist/PListStore;
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoSuchMethodError: org.apache.activemq.usage.TempUsage.getStore()Lorg/apache/activemq/store/kahadb/plist/PListStore;
    at org.apache.activemq.xbean.XBeanBrokerService.ensureSystemUsageHasStore(XBeanBrokerService.java:72)
    at org.apache.activemq.xbean.XBeanBrokerService.afterPropertiesSet(XBeanBrokerService.java:56)
    ... 5 more

On my local environment I use IntelliJ with the embedded tomcat and tomEE servers and it works properly. I suppose the issue is related to the fact that activemq doesn't have enough rights in order to create some files on the disk. Unfortunetly I'm not able to figure out where is the problem. Any advise is highly appreciated.

user226578
  • 71
  • 4

1 Answers1

2

Find below the solution that works for Jelastic (tomcat 7, java7, grails 2.2.4) environment:

BuildConfig.groovy:

compile 'org.grails.plugins:jms:1.3'
compile 'org.apache.activemq:activemq-core:5.7.0'
compile 'org.apache.xbean:xbean-spring:4.1'

resources.groovy:

import org.apache.activemq.broker.TransportConnector
import org.apache.activemq.xbean.XBeanBrokerService
import org.springframework.jms.connection.SingleConnectionFactory

beans = {

tcpConnector(TransportConnector,uri:'tcp://localhost:61616'){}

connectors(ArrayList,[ref('tcpConnector')]){}
myBrokerService(XBeanBrokerService){bean->
    myBrokerService.useJmx = false
    myBrokerService.persistent = true
    myBrokerService.dataDirectory = 'my-activemq_data'
    myBrokerService.transportConnectors = ref('connectors')
}
amqConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory) {
    brokerURL = 'vm://localhost'
}

jmsConnectionFactory(SingleConnectionFactory) { bean ->
    targetConnectionFactory = ref(amqConnectionFactory)
 }
}

Embedded activemq started without any issues.

user226578
  • 71
  • 4