title: WildFly 14: class org.apache.tomcat.websocket.server.WsServerContainer cannot be cast to class io.undertow.websockets.jsr.ServerWebSocketContainer
body: <p>Trying to deploy a Spring Boot application to WildFly 14 I get the following error:</p>
  
  <blockquote>
    <p>{"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"application_name\".undertow-deployment" => "java.lang.RuntimeException: java.lang.ClassCastException: class org.apache.tomcat.websocket.server.WsServerContainer cannot be cast to class io.undertow.websockets.jsr.ServerWebSocketContainer (org.apache.tomcat.websocket.server.WsServerContainer is in unnamed module of loader 'deployment.application_name.war' @56a6a8b7; io.undertow.websockets.jsr.ServerWebSocketContainer is in unnamed module of loader 'io.undertow.websocket@2.0.13.Final' @59ba0563)
        Caused by: java.lang.RuntimeException: java.lang.ClassCastException: class org.apache.tomcat.websocket.server.WsServerContainer cannot be cast to class io.undertow.websockets.jsr.ServerWebSocketContainer (org.apache.tomcat.websocket.server.WsServerContainer is in unnamed module of loader 'deployment.application_name.war' @56a6a8b7; io.undertow.websockets.jsr.ServerWebSocketContainer is in unnamed module of loader 'io.undertow.websocket@2.0.13.Final' @59ba0563)
        Caused by: java.lang.ClassCastException: class org.apache.tomcat.websocket.server.WsServerContainer cannot be cast to class io.undertow.websockets.jsr.ServerWebSocketContainer (org.apache.tomcat.websocket.server.WsServerContainer is in unnamed module of loader 'deployment.application_name.war' @56a6a8b7; io.undertow.websockets.jsr.ServerWebSocketContainer is in unnamed module of loader 'io.undertow.websocket@2.0.13.Final' @59ba0563)"}}</p>
  </blockquote>
  
  <p>I have already tried everything that I could find in stackoverflow or other blogs, forums etc. but with no luck. I endeded up with the following pom.xml.</p>
  
  <pre><code>&lt;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"&gt;
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
  &lt;groupId&gt;com.foo.application_name&lt;/groupId&gt;
  &lt;artifactId&gt;application_name&lt;/artifactId&gt;
  &lt;version&gt;xxx&lt;/version&gt;
  
  &lt;parent&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
      &lt;version&gt;2.0.5.RELEASE&lt;/version&gt;
  &lt;/parent&gt;
  
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.glassfish.jaxb&lt;/groupId&gt;
          &lt;artifactId&gt;jaxb-runtime&lt;/artifactId&gt;
          &lt;version&gt;2.3.0.1&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.activation&lt;/groupId&gt;
          &lt;artifactId&gt;activation&lt;/artifactId&gt;
          &lt;version&gt;1.1.1&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.transaction&lt;/groupId&gt;
          &lt;artifactId&gt;jta&lt;/artifactId&gt;
          &lt;version&gt;1.1&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
         &lt;exclusions&gt;
             &lt;exclusion&gt;
                 &lt;groupId&gt;org.apache.tomcat.embed&lt;/groupId&gt;
                 &lt;artifactId&gt;tomcat-embed-websocket&lt;/artifactId&gt;
             &lt;/exclusion&gt;
             &lt;exclusion&gt;
                 &lt;groupId&gt; org.springframework.boot&lt;/groupId&gt;
                 &lt;artifactId&gt; spring-boot-starter-tomcat&lt;/artifactId&gt;
             &lt;/exclusion&gt;
         &lt;/exclusions&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-undertow&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.maven&lt;/groupId&gt;
          &lt;artifactId&gt;maven-model&lt;/artifactId&gt;
          &lt;version&gt;3.5.4&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.modelmapper&lt;/groupId&gt;
          &lt;artifactId&gt;modelmapper&lt;/artifactId&gt;
          &lt;version&gt;2.2.0&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.h2database&lt;/groupId&gt;
          &lt;artifactId&gt;h2&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-validation&lt;/artifactId&gt;
          &lt;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;artifactId&gt;tomcat-embed-el&lt;/artifactId&gt;
                  &lt;groupId&gt;org.apache.tomcat.embed&lt;/groupId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.projectlombok&lt;/groupId&gt;
          &lt;artifactId&gt;lombok&lt;/artifactId&gt;
          &lt;optional&gt;true&lt;/optional&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;!-- update Hibernate dependency on Javassist to 3.23.1 for Java 11 compatibility --&gt;
          &lt;groupId&gt;org.javassist&lt;/groupId&gt;
          &lt;artifactId&gt;javassist&lt;/artifactId&gt;
          &lt;version&gt;3.23.1-GA&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;!-- update Mockito dependency for Java 11 compatibility --&gt;
          &lt;groupId&gt;org.mockito&lt;/groupId&gt;
          &lt;artifactId&gt;mockito-core&lt;/artifactId&gt;
          &lt;version&gt;2.22.0&lt;/version&gt;&lt;!--$NO-MVN-MAN-VER$ --&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;mysql&lt;/groupId&gt;
          &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
          &lt;version&gt;8.0.12&lt;/version&gt;&lt;!--$NO-MVN-MAN-VER$ --&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
          &lt;artifactId&gt;javax.servlet-api&lt;/artifactId&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  
  &lt;packaging&gt;war&lt;/packaging&gt;
  
  &lt;build&gt;
      &lt;defaultGoal&gt;install&lt;/defaultGoal&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
              &lt;configuration&gt;
                  &lt;executable&gt;true&lt;/executable&gt;
                  &lt;skipTests&gt;true&lt;/skipTests&gt;
              &lt;/configuration&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;repackage&lt;/goal&gt;
                      &lt;/goals&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  
  &lt;repositories&gt;
      &lt;repository&gt;
          &lt;id&gt;spring-releases&lt;/id&gt;
          &lt;url&gt;https://repo.spring.io/libs-release&lt;/url&gt;
      &lt;/repository&gt;
  &lt;/repositories&gt;
  &lt;pluginRepositories&gt;
      &lt;pluginRepository&gt;
          &lt;id&gt;spring-releases&lt;/id&gt;
          &lt;url&gt;https://repo.spring.io/libs-release&lt;/url&gt;
      &lt;/pluginRepository&gt;
  &lt;/pluginRepositories&gt;
  </code></pre>
  
  <p></p>
  
  <p>Could somebody please check my pom.xml and tell what am I missing?</p>