尝试将 grails 应用部署到 jelastic 环境并配置了正确的TomEE应用服务器并且所有与activemq相关的插件我在服务器上收到以下异常:
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没有足够的权限以便在磁盘上创建一些文件这一事实有关。不幸的是,我无法弄清楚问题出在哪里。任何建议都非常感谢。
答案 0 :(得分:2)
在下面找到适用于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启动没有任何问题。