ActiveMQ Artemis REST集成引发异常



我正试图通过构建集成的REST war文件并将war文件复制到";apache-arteis-2.13.0\web";以及开始服务。

为了进行配置,我遵循了此文档。

正在获取异常

2020-12-07 16:47:11,894 INFO  [org.apache.activemq.artemis.core.server] AMQ221013: Using NIO Journal
2020-12-07 16:47:11,933 INFO  [org.apache.activemq.artemis.core.server] AMQ221057: Global Max Size is being adjusted to 1/2 of the JVM max size (-Xmx). being defined as 477,364,224
2020-12-07 16:47:11,952 ERROR [org.apache.activemq.artemis.core.server] AMQ224097: Failed to start server: java.util.ServiceConfigurationError: org.apache.activemq.artemis.spi.core.protocol.ProtocolManagerFactory: org.apache.activemq.artemis.protocol.amqp.broker.ProtonProtocolManagerFactory not a subtype
at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:590) [java.base:]
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1237)

2020-12-07 16:47:12,077 WARN  [org.apache.activemq.artemis.rest] AMQ182004: REST configuration parameter consumer-window-size' is deprecated. Use 'url' instead.
2020-12-07 16:47:12,409 WARN  [org.eclipse.jetty.webapp.WebAppContext] Failed startup of context o.e.j.w.WebAppContext@6b9c42bd{/artemis-rest-1.0,file:///D:/ABroker2.13.0/tmp/jetty-localhost-8161-artemis-rest-1_0_war-_artemis-rest-1_0-any-9922358792097605704.dir/webapp/,UNAVAILABLE}{D:apache-artemis-2.13.0-binapache-artemis-2.13.0webartemis-rest-1.0.war}: java.lang.RuntimeException: ActiveMQNotConnectedException[errorType=NOT_CONNECTED message=AMQ219007: Cannot connect to server(s). Tried with all available servers.]
at org.apache.activemq.artemis.rest.integration.RestMessagingBootstrapListener.contextInitialized(RestMessagingBootstrapListener.java:54) [artemis-rest-2.13.0.jar:2.13.0]

我已经提到了关于类似问题的旧帖子,但并没有解决我的问题。

我的pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.jdanekrh</groupId>
<artifactId>artemis-rest</artifactId>
<version>1.0</version>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>3.0.19.Final</version>
</dependency>       
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxb-provider</artifactId>
<version>3.0.19.Final</version>
</dependency>       
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jackson-provider</artifactId>
<version>3.0.19.Final</version>
</dependency>       
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>tjws</artifactId>
<version>3.0.19.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-server</artifactId>
<version>2.13.0</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-jms-client</artifactId>
<version>2.13.0</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-core-client</artifactId>
<version>2.13.0</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-commons</artifactId>
<version>2.13.0</version>
</dependency>
<dependency>
<groupId>org.apache.activemq.rest</groupId>
<artifactId>artemis-rest</artifactId>
<version>2.13.0</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
</dependencies>
</project>

web.xml:

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<context-param>
<param-name>rest.messaging.config.file</param-name>
<param-value>rest.xml</param-value>
</context-param>

<listener>
<listener-class>
org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap
</listener-class>
</listener>
<!-- this commented out section is the only difference from the embedded config -->
<!--<listener>-->
<!--<listener-class>-->
<!--org.apache.activemq.artemis.rest.integration.ActiveMQBootstrapListener-->
<!--</listener-class>-->
<!--</listener>-->
<listener>
<listener-class>
org.apache.activemq.artemis.rest.integration.RestMessagingBootstrapListener
</listener-class>
</listener>
<filter>
<filter-name>Rest-Messaging</filter-name>
<filter-class>
org.jboss.resteasy.plugins.server.servlet.FilterDispatcher
</filter-class>
</filter>
<filter-mapping>
<filter-name>Rest-Messaging</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

</web-app>

如果我遗漏了什么,有人能帮我吗?

您在web.xml 上写过设置

<param-value>rest.xml</param-value>
  1. 确保您的集成REST war文件确实包含/WEB-IBF/classes/REST.xml
  2. 确保它包含设置
<rest-messaging>
...
<url>tcp://localhost:61616</url>
</rest-messaging>

文档指定了vm://0,但在我看来,这不起作用,或者需要为emdeded broker进行一些自定义(非默认(配置。

最新更新