gpt4 book ai didi

java - tomcat 8部署后启动web服务失败

转载 作者:行者123 更新时间:2023-11-28 22:27:18 25 4
gpt4 key购买 nike

我在 tomcat 7 下部署了我的 Web 服务,没有任何问题。

因为我尝试在 tomcat 8 下安装一个新的 WebServices 实例。它似乎有一些问题,webapp 已部署但是当我尝试时: http://locahost:8080/VICWebServices

它只返回空白页。

这是我在尝试启动服务器时收到的 catalina 错误日志:

30-Jun-2016 10:56:27.149 SEVERE [localhost-startStop-1]
org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/VICWebServices]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:587)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1798)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Caused by: java.lang.NoSuchMethodError: javax.servlet.ServletContext.getVirtualServerName()Ljava/lang/String;
at org.apache.tomcat.websocket.server.WsServerContainer.<init>(WsServerContainer.java:150)
at org.apache.tomcat.websocket.server.WsSci.init(WsSci.java:131)
at org.apache.tomcat.websocket.server.WsSci.onStartup(WsSci.java:47)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5292)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)

30-Jun-2016 10:56:27.149 SEVERE [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Error deploying configuration descriptor C:\apache-tomcat-8.0.36-AWS-VIC-PROD-2\conf\Catalina\localhost\VICWebServices.xml
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/VICWebServices]]
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:729)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:587)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1798)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

30-Jun-2016 10:56:27.150 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of configuration descriptor C:\apache-tomcat-8.0.36-AWS-VIC-PROD-2\conf\Catalina\localhost\VICWebServices.xml has finished in 21,855 ms
30-Jun-2016 10:56:27.152 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-apr-8280"]
30-Jun-2016 10:56:27.162 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-apr-8209"]
30-Jun-2016 10:56:27.166 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 21903 ms

请告知我这些错误信息。谢谢维克

更新 -verbose:class 日志

[Loaded javax.servlet.ServletContext from C:\apache-tomcat-8.0.36-AWS-VIC-PROD-2\endorsed\servlet-api.jar]
[Loaded javax.servlet.ServletContextAttributeListener from C:\apache-tomcat-8.0.36-AWS-VIC-PROD-2\endorsed\servlet-api.jar]
[Loaded javax.servlet.ServletContextListener from C:\apache-tomcat-8.0.36-AWS-VIC-PROD-2\endorsed\servlet-api.jar]
[Loaded com.sun.xml.ws.transport.http.servlet.WSServletContextListener from C:\apache-tomcat-8.0.36-AWS-VIC-PROD-2\endorsed\webservices-rt.jar]
[Loaded javax.servlet.ServletContextEvent from C:\apache-tomcat-8.0.36-AWS-VIC-PROD-2\endorsed\servlet-api.jar]
[Loaded javax.servlet.ServletContextAttributeEvent from C:\apache-tomcat-8.0.36-AWS-VIC-PROD-2\endorsed\servlet-api.jar]

最佳答案

最可能的原因是您在 WAR 中打包了旧版本的 API(tomcat 应该忽略它)或者您将这样的版本放在 tomcat/lib 中。

您可以通过运行带有详细类加载的 tomcat 来识别有问题的 JAR。这可以通过将 -verbose:class 添加到 JVM 参数来完成。您可以通过将其添加到环境变量 JAVA_OPTS 来将其添加到那里:

  • 在 Linux 上:export JAVA_OPTS=-verbose:class
  • 在 Windows 上:set JAVA_OPTS=-verbose:class

然后当你启动tomcat时,你会得到很多类似的输出:

[Loaded javax.websocket.server.ServerEndpointConfig$Builder from file:/C:/Users/xxx/Downloads/software/apache-tomcat-8.0.36/apache-tomcat-8.0.36/lib/websocket-api.jar]
[Loaded javax.websocket.server.ServerEndpointConfig from file:/C:/Users/xxx/Downloads/software/apache-tomcat-8.0.36/apache-tomcat-8.0.36/lib/websocket-api.jar]
[Loaded org.apache.tomcat.websocket.server.DefaultServerEndpointConfigurator from file:/C:/Users/xxx/Downloads/software/apache-tomcat-8.0.36/apache-tomcat-8.0.36/lib/tomcat-
[Loaded javax.websocket.server.DefaultServerEndpointConfig from file:/C:/Users/xxx/Downloads/software/apache-tomcat-8.0.36/apache-tomcat-8.0.36/lib/websocket-api.jar]
[Loaded org.apache.tomcat.websocket.pojo.PojoMethodMapping from file:/C:/Users/xxx/Downloads/software/apache-tomcat-8.0.36/apache-tomcat-8.0.36/lib/tomcat-websocket.jar]

然后找到从哪个 jar 加载的 servlet 上下文,如果它不是来自 tomcat 则将其删除或修复它的版本。

关于java - tomcat 8部署后启动web服务失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38113544/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com