[undertow-dev] Classpath conflict with Tyrus client

Christian Bauer mail at christianbauer.name
Tue Apr 5 08:37:49 EDT 2016


Hi

I'm creating and testing websockets in my project and I have the following classpath:

    compile "io.undertow:undertow-servlet:$undertowVersion"
    compile "io.undertow:undertow-websockets-jsr:$undertowVersion"
    testCompile "org.glassfish.tyrus:tyrus-client:$tyrusVersion"
    testCompile "org.glassfish.tyrus:tyrus-container-grizzly-client:$tyrusVersion"

This doesn't work:

Caused by: java.lang.ClassCastException: org.glassfish.tyrus.client.ClientManager cannot be cast to io.undertow.websockets.jsr.ServerWebSocketContainer
	at io.undertow.websockets.jsr.Bootstrap.handleDeployment(Bootstrap.java:62)
	at io.undertow.servlet.core.DeploymentManagerImpl.handleExtensions(DeploymentManagerImpl.java:252)
	at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:152)

The code in Bootstrap.java randomly picks an implementation through ServiceLoader and tries to cast it:

https://github.com/undertow-io/undertow/blob/master/websockets-jsr/src/main/java/io/undertow/websockets/jsr/Bootstrap.java#L62

Why not load the desired type directly? Should I be able to deploy several websocket implementations? If not, what's the best option for testing?

Thanks,
Christian




More information about the undertow-dev mailing list