由于java.lang.NoSuchMethodError,Tomcat 7无法部署应用程序

时间:2019-04-07 00:05:56

标签: java jvm tomcat7

我有一个无法部署的Tomcat 7应用程序,导致此错误:

SEVERE: ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/canje]]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1073)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1857)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:473)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:622)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NoSuchMethodError: org.apache.tomcat.util.res.StringManager.getManager(Ljava/lang/Class;)Lorg/apache/tomcat/util/res/StringMana$
        at org.apache.tomcat.websocket.WsWebSocketContainer.<clinit>(WsWebSocketContainer.java:77)
        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:5502)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        ... 10 more

Apr 05, 2019 10:46:55 PM org.apache.catalina.startup.HostConfig deployWAR
SEVERE: Error deploying web application archive /var/lib/tomcat7/webapps/app.war

可能由于某些版本问题?

这些是我服务器中的版本:

Server version: Apache Tomcat/7.0.52 (Ubuntu)
Server built:   Oct 10 2018 11:13:44
Server number:  7.0.52.0
OS Name:        Linux
OS Version:     3.13.0-161-generic
Architecture:   amd64
JVM Version:    1.7.0_181-b01
JVM Vendor:     Oracle Corporation

有什么帮助吗?

谢谢 海梅

1 个答案:

答案 0 :(得分:0)

如果您使用的是springboot,则嵌入的tomcat与您的tomcat之间的冲突可能导致此错误。 您应该从springboot中排除tomcat。

   <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <exclusions>
            <exclusion>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-tomcat</artifactId>
            </exclusion>
        </exclusions>
   </dependency>