Hi I need to deploy my Spring Boot app into Wildfly 8.1 and I\'m getting the following exception:
Caused by: java.lang.RuntimeException: java.lang.Cl
I'm not sure, but your POM around websockets should be like this:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-websocket</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
spring-messaging
, spring-websocket
, jackson-databind
, spring-boot-starter-web
are redundant.
There is also spring-boot-starter-thymeleaf
.
However I think the root of your cause is tomcat-embed-websocket
.
For me , spring-boot-starter-websocket and spring-boot-starter-web by default includes the spring-boot-starter-tomcat so exclude the tomcat, like below without version of spring boot:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-websocket</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
spring-boot-starter-web and spring-boot-starter-websocket by default includes the spring-boot-starter-tomcat so exclude the tomcat, like below
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>${spring-boot.version}</version>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
<version>${spring-boot.version}</version>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
and include undertow, make sure the tomcat exists no where in the classpath.
You need exclude tomcat-embed-websocket
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-websocket</artifactId>
</exclusion>
</exclusions>
</dependency>
Use the following command to find all dependencies that includes spring-boot-starter-tomcat
:
mvn dependency:tree -Dincludes=org.springframework.boot:spring-boot-starter-tomcat
Exclude Tomcat starter from all your dependencies listed by this command.
After that, you might need to add javax.servlet-api
as a provided dependency:
<dependency>
<artifactId>javax.servlet</artifactId>
<groupId>javax.servlet-api</groupId>
<scope>provided</scope>
</dependency>
Gradle users with this issue: check out the comments on this ticket: https://github.com/spring-projects/spring-boot/issues/6166