我正在尝试部署使用Webscoket客户端作为Wildfly 13使用者的骆驼路线。
当我尝试运行项目时,出现以下错误:
Caused by: [java.lang.RuntimeException - Could not find an implementation class.]: java.lang.RuntimeException: Could not find an implementation class.
at javax.websocket.ContainerProvider.getWebSocketContainerImpl(ContainerProvider.java:89)
at javax.websocket.ContainerProvider.getWebSocketContainer(ContainerProvider.java:69)
我正在使用以下依赖关系:
<dependency>
<groupId>org.glassfish.tyrus.bundles</groupId>
<artifactId>tyrus-standalone-client</artifactId>
<version>1.15</version>
</dependency>
在Eclipse上运行代码,一切正常。
我需要在Wildfly或项目中进行一些特定的配置才能运行此代码吗?
我的Maven版本:
<build>
<resources>
<resource>
<filtering>true</filtering>
<directory>src/main/resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathLayoutType>custom</classpathLayoutType>
<customClasspathLayout>META-INF</customClasspathLayout>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
答案 0 :(得分:1)
很难从您的描述中看出您的特定设置有什么问题,但是通常,在WildFly之上编写Camel集成的最简单方法是使用WildFly Camel:https://wildfly-extras.github.io/wildfly-camel/#_getting_started
Websockets通过Undertow组件支持。对于像以下这样的简单路线
from("undertow:ws://localhost:8080/my-app")
.log("Message received from WebSocket Client : ${body}")
您只需要underwow-component依赖项(请注意provided
范围):
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.wildfly.camel</groupId>
<artifactId>wildfly-camel-bom</artifactId>
<version><!-- your WF Camel version --></version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-undertow</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
免责声明:我是WildFly Camel的维护者之一