部署Web应用程序后,我的Tomcat 7服务器不再启动,在启动过程中发出异常信号。
所以我尝试配置Tomcat以避免在启动时部署Web应用程序
为此,我修改了${CATALINA_BASE}/conf/server.xml
并向autoDeploy="false"
节点添加了Host
属性。 (我还验证了没有liveDeploy
属性):
<Host appBase="webapps" autoDeploy="false" name="localhost" unpackWARs="true">
...
然后我读到了有关行为略有不同的liveDeploy属性,并确保我也禁用了它:
<Host appBase="webapps" autoDeploy="false" liveDeploy = "false" name="localhost" unpackWARs="true">
...
问题是它似乎无能为力,在输出中我仍然看到“部署配置描述符”行,直到崩溃Tomcat的那一行。
这里有服务器输出;我已经包含了启动,第一个正确部署的应用程序(MyFirstApplication),以及最后一个崩溃服务器的应用程序。
Using CATALINA_BASE: "C:\Users\Jack\AppData\Roaming\NetBeans\7.2\apache-tomcat-7.0.11.0_base" Using CATALINA_HOME: "C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.11" Using CATALINA_TMPDIR: "C:\Users\Jack\AppData\Roaming\NetBeans\7.2\apache-tomcat-7.0.11.0_base\temp" Using JRE_HOME: "C:\Program Files (x86)\Java\jdk1.7.0" Using CLASSPATH: "C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.11\bin\bootstrap.jar;C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.11\bin\tomcat-juli.jar" gen 14, 2013 3:08:28 PM org.apache.catalina.core.AprLifecycleListener init Informazioni: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files (x86)\Java\jdk1.7.0\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Perl64\site\bin;C:\Perl64\bin;C:\Program Files (x86)\CollabNet\Subversion Client;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\OEM\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\OEM\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\OEM\12.0\DLLShared\;C:\Program Files (x86)\Roxio\OEM\AudioCore\;C:\Program Files\Java\jdk1.6.0_23\bin;C:\Program Files (x86)\GnuWin32\bin;C:\Program Files (x86)\spring-roo-1.1.4.RELEASE\bin;C:\Program Files\NetBeans 6.9.1\java\ant\bin;C:\Program Files (x86)\GNU\GnuPG\pub;C:\Program Files (x86)\QuickTime\QTSystem\;c:\Program Files\NetBeans 7.2\java\maven\bin;C:\Program Files (x86)\Nmap;C:\cmdutilities;. gen 14, 2013 3:08:28 PM org.apache.coyote.AbstractProtocolHandler init Informazioni: Initializing ProtocolHandler ["http-bio-8084"] gen 14, 2013 3:08:28 PM org.apache.coyote.AbstractProtocolHandler init Informazioni: Initializing ProtocolHandler ["ajp-bio-8009"] gen 14, 2013 3:08:28 PM org.apache.catalina.startup.Catalina load Informazioni: Initialization processed in 411 ms gen 14, 2013 3:08:28 PM org.apache.catalina.core.StandardService startInternal Informazioni: Starting service Catalina gen 14, 2013 3:08:28 PM org.apache.catalina.core.StandardEngine startInternal Informazioni: Starting Servlet Engine: Apache Tomcat/7.0.11 gen 14, 2013 3:08:28 PM org.apache.catalina.startup.HostConfig deployDescriptor Informazioni: Deploying configuration descriptor MyFirstWebApp.xml from C:\Users\Jack\AppData\Roaming\NetBeans\7.2\apache-tomcat-7.0.11.0_base\conf\Catalina\localhost gen 14, 2013 3:08:38 PM org.springframework.web.context.ContextLoader initWebApplicationContext Informazioni: Root WebApplicationContext: initialization started [...] Informazioni: Deploying configuration descriptor manager.xml from C:\Users\Jack\AppData\Roaming\NetBeans\7.2\apache-tomcat-7.0.11.0_base\conf\Catalina\localhost gen 14, 2013 3:08:40 PM org.apache.catalina.startup.HostConfig deployDescriptor Informazioni: Deploying configuration descriptor MavenSpringHibernate.xml from C:\Users\Jack\AppData\Roaming\NetBeans\7.2\apache-tomcat-7.0.11.0_base\conf\Catalina\localhost Exception in thread "main" Exception in thread "Thread-1"
答案 0 :(得分:5)
您需要设置deployOnStartup,而不是autoDeploy(或可能两者)。没有这样的liveDeploy设置。
来自Host [1]的Tomcat 7文档
<强>自动部署强>
此标志值指示Tomcat是否应定期检查新的 或Tomcat运行时更新的Web应用程序。如果是真的,Tomcat 定期检查appBase和xmlBase目录并进行部署 找到任何新的Web应用程序或上下文XML描述符。更新了网站 应用程序或上下文XML描述符将触发重新加载 Web应用程序。标志的值默认为true。见自动 应用程序部署以获取更多信息。
<强> deployOnStartup 强>
此标志值指示此主机的Web应用程序是否应该是 Tomcat启动时自动部署。标志的值默认值 为真。有关详细信息,请参阅自动应用程序部署。
[1] http://tomcat.apache.org/tomcat-7.0-doc/config/host.html