Wildfly 10.0 deploy war 'cannot be cast to WsServerContainer' exception
See original GitHub issueProblem
I took application from blog post: https://spring.io/blog/2014/11/23/bootiful-java-ee-support-in-spring-boot-1-2 and just up spring-boot version to 1.3.5.RELEASE (1.2.0.BUILD-SNAPSHOT don’t work too)
I tried deploy spring-boot app to WildFly server and got error.
I found that it’s don’t work.
Workaround is globally ignore tomcat-embed-websocket
via “provide” maven trick like this:
<dependency>
<artifactId>tomcat-embed-websocket</artifactId>
<groupId>org.apache.tomcat.embed</groupId>
<scope>provided</scope>
</dependency>
Environment:
Wildfly-10.0.0.Final Spring Boot 1.3.5.RELEASE Jdk1.8.0_31
Bug report
16:38:27,649 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 111) MSC000001: Failed to start service jboss.undertow.deployment.default-server.default-host./ee-test: org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./ee-test: java.lang.RuntimeException: java.lang.ClassCastException: org.apache.tomcat.websocket.server.WsServerContainer cannot be cast to io.undertow.websockets.jsr.ServerWebSocketContainer
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:85)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at org.jboss.threads.JBossThread.run(JBossThread.java:320)
Caused by: java.lang.RuntimeException: java.lang.ClassCastException: org.apache.tomcat.websocket.server.WsServerContainer cannot be cast to io.undertow.websockets.jsr.ServerWebSocketContainer
at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:231)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:100)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:82)
... 6 more
Caused by: java.lang.ClassCastException: org.apache.tomcat.websocket.server.WsServerContainer cannot be cast to io.undertow.websockets.jsr.ServerWebSocketContainer
at io.undertow.websockets.jsr.Bootstrap$WebSocketListener.contextInitialized(Bootstrap.java:104)
at io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:187)
at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:198)
... 8 more
16:38:27,651 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 4) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "ee-test.war")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.undertow.deployment.default-server.default-host./ee-test" => "org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./ee-test: java.lang.RuntimeException: java.lang.ClassCastException: org.apache.tomcat.websocket.server.WsServerContainer cannot be cast to io.undertow.websockets.jsr.ServerWebSocketContainer
Caused by: java.lang.RuntimeException: java.lang.ClassCastException: org.apache.tomcat.websocket.server.WsServerContainer cannot be cast to io.undertow.websockets.jsr.ServerWebSocketContainer
Caused by: java.lang.ClassCastException: org.apache.tomcat.websocket.server.WsServerContainer cannot be cast to io.undertow.websockets.jsr.ServerWebSocketContainer"}}
16:38:27,653 ERROR [org.jboss.as.server] (management-handler-thread - 4) WFLYSRV0021: Deploy of deployment "ee-test.war" was rolled back with the following failure message:
{"WFLYCTL0080: Failed services" => {"jboss.undertow.deployment.default-server.default-host./ee-test" => "org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./ee-test: java.lang.RuntimeException: java.lang.ClassCastException: org.apache.tomcat.websocket.server.WsServerContainer cannot be cast to io.undertow.websockets.jsr.ServerWebSocketContainer
Caused by: java.lang.RuntimeException: java.lang.ClassCastException: org.apache.tomcat.websocket.server.WsServerContainer cannot be cast to io.undertow.websockets.jsr.ServerWebSocketContainer
Caused by: java.lang.ClassCastException: org.apache.tomcat.websocket.server.WsServerContainer cannot be cast to io.undertow.websockets.jsr.ServerWebSocketContainer"}}
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Spring Boot Websockets in Wildfly - Stack Overflow
Hi I need to deploy my Spring Boot app ...
Read more >ClassCastException: org.apache.tomcat.websocket.server ...
WsServerContainer cannot be cast to io.undertow.websockets.jsr. ... are getting an exception trying to deploy our application in JBoss EAP 7.
Read more >org.dom4j.Documen...| JBoss.org Content Archive (Read Only)
When I try to deploy my .war in a Wilfly 10.0.0 Final I get the next error. ... DocumentFactory cannot be cast to...
Read more >Building a Spring Boot RESTful Web Service for Wildfly 8.2
RuntimeException : java.lang.ClassCastException: org.apache.tomcat.websocket.server.WsServerContainer cannot be cast to.
Read more >WildFly 8 / 9 / 10 - Logi Analytics
JBoss has been rebranded as WildFly. It requires JDK 1.8+ or OpenJDK 8+. For Widfly 8 and 9, use Step 1 below to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
To resolve this in Wildfly 11 I edited pom.xml like this
Also I resolved here problems with log4j2
@zaenk That’s Gradle and you were posting Maven snippets earlier. As you’ve shown, Gradle handles exclusions differently to Maven.