javax.servlet.ServletException: Not running on Jetty, JSR-356 support unavailable
Asked Answered
D

4

7

I am facing a problem while deploying a war on to tomcat instance,

Tomcat version details,

D:\Kiran\Kiran\Softwares DH\Webservers\apache-tomcat-7.0.63\bin>version.bat
Using CATALINA_BASE:   "D:\Kiran\Kiran\Softwares DH\Webservers\apache-tomcat-7.0.63"
Using CATALINA_HOME:   "D:\Kiran\Kiran\Softwares DH\Webservers\apache-tomcat-7.0.63"
Using CATALINA_TMPDIR: "D:\Kiran\Kiran\Softwares DH\Webservers\apache-tomcat-7.0.63\temp"
Using JRE_HOME:        "C:\Program Files\Java\jdk1.7.0_07"
Using CLASSPATH:       "D:\Kiran\Kiran\Softwares DH\Webservers\apache-tomcat-7.0.63\bin\bootstrap.jar;D:\Kiran\Kiran\Softwares DH\Webservers\apache-to
mcat-7.0.63\bin\tomcat-juli.jar"
Server version: Apache Tomcat/7.0.63
Server built:   Jun 30 2015 08:08:33 UTC
Server number:  7.0.63.0
OS Name:        Windows 7
OS Version:     6.1
Architecture:   amd64
JVM Version:    1.7.0_07-b11
JVM Vendor:     Oracle Corporation
D:\Kiran\Kiran\Softwares DH\Webservers\apache-tomcat-7.0.63\bin>

POM Dependency :

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-websocket</artifactId>
</dependency>

I have created a war using maven plugin and tried to deploy on tomcat 7. I was able to deploy but unable to start the webapp. When I find the logs for it, it gave below stacktrace,

SEVERE: Error during ServletContainerInitializer processing
javax.servlet.ServletException: Not running on Jetty, JSR-356 support unavailable
    at org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer.onStartup(WebSocketServerContainerInitializer.java:146)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5520)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.manager.ManagerServlet.start(ManagerServlet.java:1322)
    at org.apache.catalina.manager.HTMLManagerServlet.start(HTMLManagerServlet.java:694)
    at org.apache.catalina.manager.HTMLManagerServlet.doPost(HTMLManagerServlet.java:217)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)

Any help would be appreciated. Thank you.


Edit :

It runs fine when I run the application using STS

Dehiscence answered 25/8, 2015 at 11:4 Comment(3)
Does Tomcat 7 have JSR-356 support?Neysa
According to this link. Yes tomcat 7 has JSR 356 supportDehiscence
@Neysa Please check the answer. I have updated it.Dehiscence
D
7

The problem is identified to be confusion over the websocket jars of tomcat and my application jars. I have removed it from the war file and it started working,

I used maven plug in to remove the jars as below,

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <configuration>
        <packagingExcludes>WEB-INF/lib/websocket-*.jar</packagingExcludes>
    </configuration>
</plugin>

The jars which were creating problem are,

enter image description here

Dehiscence answered 25/8, 2015 at 14:58 Comment(0)
O
8

Search in pom.xml for

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-jetty</artifactId>
</dependency>

and remove it.

October answered 22/9, 2015 at 12:51 Comment(1)
@kryger - I have removed the spring-boot-starter-jetty from my dependency, but still its not working and below are my tomcat details Server version: Apache Tomcat/9.0.33 Server built: Mar 11 2020 09:31:38 UTC Server number: 9.0.33.0 OS Name: Windows 10 OS Version: 10.0 Architecture: amd64 JVM Version: 1.8.0_151-b12 JVM Vendor: Oracle CorporationChenee
D
7

The problem is identified to be confusion over the websocket jars of tomcat and my application jars. I have removed it from the war file and it started working,

I used maven plug in to remove the jars as below,

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <configuration>
        <packagingExcludes>WEB-INF/lib/websocket-*.jar</packagingExcludes>
    </configuration>
</plugin>

The jars which were creating problem are,

enter image description here

Dehiscence answered 25/8, 2015 at 14:58 Comment(0)
S
1

I fixed this problem by adding a WEB-INF/web.xml file with the following contents. We need to configure Tomcat to ignore Jetty SCI(ServerContainerInitializer) implementations.

<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
                      http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
  version="3.1"
  metadata-complete="true">

  <absolute-ordering>
    <name>spring_web</name>
  </absolute-ordering>

</web-app>

There are some explanation on this:

Syndicalism answered 5/8, 2022 at 10:1 Comment(0)
T
0

As already mentioned by Kiran in another answer, the problematic libraries are websocket-*.jar(s). I encountered these dependencies to be introduced by (upgrade of) Active MQ library in a project. So in case you have the same error, look for the maven dependency tree in your project and exclude the dependencies:

mvn dependency:tree -Dverbose -Dincludes=javax.websocket  
Toucan answered 1/7, 2021 at 15:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.