java javax.servlet.ServletException:未在 Jetty 上运行,JSR-356 支持不可用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32202344/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-02 19:49:29  来源:igfitidea点击:

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

javaspringtomcatspring-websocket

提问by Kiran Joshi

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

我在向 tomcat 实例部署War时遇到问题,

Tomcat version details,

Tomcat 版本详情,

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 :

POM 依赖:

<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,

我使用 maven 插件创建了一场War,并尝试在 tomcat 7 上部署。我能够部署但无法启动 webapp。当我找到它的日志时,它给出了堆栈跟踪,

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

当我使用 STS 运行应用程序时它运行良好

采纳答案by Kiran Joshi

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,

问题被确定为对 tomcat 的 websocket jar 和我的应用程序 jar 的混淆。我已将其从War文件中删除并开始工作,

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

我使用 maven 插件来删除罐子,如下所示,

<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

在此处输入图片说明

回答by Cristiano DC

Search in pom.xml for

在 pom.xml 中搜索

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

and remove it.

并将其删除。