vitorvr
vitorvr

Reputation: 655

Deploy Websocket Client in Wildfly 13

I'm trying to deploy a Camel Route that use a Webscoket client as a consumer in Wildfly 13.

When I try to run the project I got the follow error:

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)

I'm using the follow depencencies:

<dependency>
 <groupId>org.glassfish.tyrus.bundles</groupId>
 <artifactId>tyrus-standalone-client</artifactId>
 <version>1.15</version>
</dependency>

Running the code on Eclipse, everything works fine.

I need to do some specific configuration on Wildfly or in the project to run this code?

My Maven build:

<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>

Upvotes: 0

Views: 812

Answers (1)

Peter Palaga
Peter Palaga

Reputation: 161

It is hard to tell from your description what's wrong with you particular setup, but generally, the easiest way to write Camel integrations on top of WildFly is to use WildFly Camel: https://wildfly-extras.github.io/wildfly-camel/#_getting_started

Websockets are supported via Undertow component. For a simple route like the following

from("undertow:ws://localhost:8080/my-app")
    .log("Message received from WebSocket Client : ${body}")

you'd need just the undertow-component dependency (note the provided scope):

    <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>

Disclaimer: I am one of the maintainers of WildFly Camel

Upvotes: 1

Related Questions