grails activemq 应用程序不适用于 jelastic paas

grails activemq application doesn't work for jelastic paas

尝试将我的 grails 应用程序部署到 jelastic 环境并配置适当的 TomEE 应用程序服务器以及与 activemq I 相关的所有插件服务器出现以下异常:

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

在我的本地环境中,我将 IntelliJ 与嵌入式 tomcat 和 tomEE 服务器一起使用,它工作正常。我想这个问题与 activemq 没有足够的权限来在磁盘上创建一些文件有关。不幸的是,我无法弄清楚问题出在哪里。非常感谢任何建议。

在下面找到适用于 Jelastic(tomcat 7、java7、grails 2.2.4)环境的解决方案:

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)
 }
}

嵌入式 activemq 启动没有任何问题。