我有一个Spring Boot应用程序。此应用程序需要侦听来自部署在另一个应用程序中的JMS主题的消息(假设此应用程序名称为Topic)。该主题应用程序在wildfly 11上运行,并使用ActiveMQ Artemis。
做了以下事情,
将我的JNDI属性指向“主题”应用程序的地址,如下所示,
java.naming.factory.initial=org.jboss.naming.remote.client.InitialContextFactory
java.naming.provider.url=http-remoting://topic-application-address:port
java.naming.security.principal=username
java.naming.security.credentials=password
在Spring Boot应用程序中包含了jboss-as-cli库。
compile group: 'org.jboss.as', name: 'jboss-as-cli', version: '7.2.0.Final'
当我启动Spring Boot应用程序时,
我收到以下异常
2019-03-07 08:43:45.384 WARN 5307 --- [main] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'connectionFactory' defined in class path resource [org/springframework/boot/autoconfigure/jms/JndiConnectionFactoryAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.jms.ConnectionFactory]: Factory method 'connectionFactory' threw exception; nested exception is javax.naming.NamingException: Failed to create remoting connection [Root exception is java.lang.VerifyError: org/jboss/remoting3/remote/HttpUpgradeConnectionProvider]
2019-03-07 08:43:45.385 INFO 5307 --- [main] o.s.s.c.ThreadPoolTaskScheduler : Shutting down ExecutorService 'threadPoolTaskScheduler'
2019-03-07 08:43:45.395 INFO 5307 --- [main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2019-03-07 08:43:45.395 INFO 5307 --- [main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
2019-03-07 08:43:45.399 INFO 5307 --- [main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
此异常从jboss-client.jar抛出。因为我正在使用
,所以需要这个jarjava.naming.factory.initial = org.jboss.naming.remote.client.InitialContextFactory
如果我删除了这个罐子,我将遇到错误
2019-03-06 08:38:10.015 WARN 39134 --- [main] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'connectionFactory' defined in class path resource [org/springframework/boot/autoconfigure/jms/JndiConnectionFactoryAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.jms.ConnectionFactory]: Factory method 'connectionFactory' threw exception; nested exception is javax.naming.NoInitialContextException: Cannot instantiate class: org.jboss.naming.remote.client.InitialContextFactory [Root exception is java.lang.ClassNotFoundException: org.jboss.naming.remote.client.InitialContextFactory]
所以我需要这两个罐子,但不确定如何解决此错误