Spring应用在JBoss ActiveMQ artemis JMS部署问题

问题描述 投票:0回答:1

在 EAR 中包含 Spring Boot WAR 后,应用程序 EAR 未部署在 JBoss EAP 7.0.0 上

应用程序使用 JBOSS 7 ActiveMQ 消息服务,工作正常,没有任何问题。但是,当我们在应用程序 EAR 中使用 SpringBOOT 添加 WAR 构建并尝试在集群环境中部署 EAR 时,EAR 部署会回滚,并且会出现异常。 工厂方法“artemisServer”抛出异常;嵌套异常是 java.lang.NoSuchMethodError: org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS.setConfiguration (请参阅完整的异常跟踪)

问题在于 Spring boot 自动配置,因为当我们从应用程序类路径中删除 spring-boot-autoconfigure-1.5.4.RELEASE.jar 时,部署成功并且应用程序运行良好。我们需要一种可以专门禁用 Spring Boot ActiveMQ 自动配置的机制。

完整的异常跟踪

Error creating bean with name 'artemisServer' defined in class path resource [org/springframework/boot/autoconfigure/jms/artemis/ArtemisEmbeddedServerConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS]: Factory method 'artemisServer' threw exception; nested exception is java.lang.NoSuchMethodError: org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS.setConfiguration(Lorg/apache/activemq/artemis/core/config/Configuration;)Lorg/apache/activemq/artemis/jms/server/embedded/EmbeddedJMS;
                at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)
                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173)
                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067)
                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
                at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
                at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
                at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
                at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
                at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761)
                at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)
                at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)
                at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
                at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
                at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
                at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
                at org.springframework.boot.web.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:151)
                at org.springframework.boot.web.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:131)
                at org.springframework.boot.web.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:86)
                at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:169)
                at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:184)
                at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:100)
                at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:82)
                at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
                at java.util.concurrent.FutureTask.run(FutureTask.java:266)
                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
                at java.lang.Thread.run(Thread.java:748)
                at org.jboss.threads.JBossThread.run(JBossThread.java:320)
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS]: Factory method 'artemisServer' threw exception; nested exception is java.lang.NoSuchMethodError: org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS.setConfiguration(Lorg/apache/activemq/artemis/core/config/Configuration;)Lorg/apache/activemq/artemis/jms/server/embedded/EmbeddedJMS;
                at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
                at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
                ... 28 more
Caused by: java.lang.NoSuchMethodError: org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS.setConfiguration(Lorg/apache/activemq/artemis/core/config/Configuration;)Lorg/apache/activemq/artemis/jms/server/embedded/EmbeddedJMS;
                at org.springframework.boot.autoconfigure.jms.artemis.ArtemisEmbeddedServerConfiguration.artemisServer(ArtemisEmbeddedServerConfiguration.java:82)
                at org.springframework.boot.autoconfigure.jms.artemis.ArtemisEmbeddedServerConfiguration$$EnhancerBySpringCGLIB$$145801e2.CGLIB$artemisServer$2(<generated>)
                at org.springframework.boot.autoconfigure.jms.artemis.ArtemisEmbeddedServerConfiguration$$EnhancerBySpringCGLIB$$145801e2$$FastClassBySpringCGLIB$$f9d0b616.invoke(<generated>)
                at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
                at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:358)
                at org.springframework.boot.autoconfigure.jms.artemis.ArtemisEmbeddedServerConfiguration$$EnhancerBySpringCGLIB$$145801e2.artemisServer(<generated>)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.lang.reflect.Method.invoke(Method.java:498)
                at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
                ... 29 more

请建议在这种情况下可以做什么

spring-boot jms activemq-artemis jboss-eap-7
1个回答
0
投票

全部。 我使用以下属性来禁用 ArtemisEmbeddedServerConfiguration.class 的自动配置,这对我有用。希望这篇文章对我们即将到来的人们有所帮助。

spring.artemis.embedded.enabled=false

谢谢, 法鲁克

© www.soinside.com 2019 - 2024. All rights reserved.