2016-01-21 53 views
0

我正在嘗試將Spring應用程序部署到運行Apache Tomcat的服務器。然而,我得到這個錯誤:無法部署到運行Tomcat的服務器

SEVERE: ContainerBase.addChild: start: … org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/RuralIvrs]] 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:633) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:976) at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1653) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.NoSuchMethodError: javax.servlet.ServletContext.getVirtualServerName()Ljava/lang/String; at org.apache.tomcat.websocket.server.WsServerContainer.(WsServerContainer.java:147) 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:5423) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ... 10 more

Jan 21, 2016 12:16:42 PM org.apache.catalina.startup.HostConfig deployWAR … SEVERE: Error deploying web application archive /home/ruralivrs/Ruralict/apache-tomcat-7.0.42/webapps/RuralIvrs.war java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/RuralIvrs]] at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:904) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:976) at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1653) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)

我搜索了幾個小時後無法找到解決方案。由於我對此很新,任何幫助將不勝感激。謝謝!

+0

我猜你正在使用'Spring Boot',是否正確?你試圖運行一個Tomcat 7,是嗎? –

+0

發佈完整的例外消息 –

+0

我很高興,似乎你已經找到了解決方案。您可能會分享給未來的讀者什麼解決您的問題;) –

回答

1

this blog post中可以找到類似的問題。

的解決方案可能是添加一個tomcat.version屬性,你的Maven的pom.xml

<properties> 
    <tomcat.version>7.0.67</tomcat.version> 
</properties> 

原因是春季啓動文檔中解釋爲embedded-servlet-containers一樣簡單。
Spring Boot默認爲Tomcat 8,所以你需要告訴Spring Boot你的目標是Tomcat 7

+0

謝謝!我必須弄清楚如何將它包含在Gradle中。 – raptor123

+0

在Gradle中它會是:'ext ['tomcat.version'] ='7.0.67'' –

+0

我補充:ext ['tomcat.version'] ='7.0.42'不幸的是它沒有工作。 – raptor123

相關問題