2013-10-25 209 views
0

我試圖更新xml.file,但Tomcat不斷崩潰與Eclipse開普勒 我試圖在2與Tomcat 7不同pc,但我不斷收到相同的錯誤消息。 我已經卸載並重新安裝Eclipse和Tomcat,但是一樣。 xml文件中存在鱈魚,導致機器崩潰。 我稱1個文件index.jsp和1周所謂的login.jsp服務器Tomcat v7.0無法啓動

我試圖用斜線 以取代/ loginpage URL模式loginpage,但我得到了同樣的錯誤。

被更新之前使用的代碼如下:該更新後不工作

<?xml version="1.0" encoding="UTF-8"?> 
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> 
<display-name>Deployment</display-name> 
<welcome-file-list> 
<welcome-file>index.html</welcome-file> 
<welcome-file>index.htm</welcome-file> 
<welcome-file>index.jsp</welcome-file> 
<welcome-file>default.html</welcome-file> 
<welcome-file>default.htm</welcome-file> 
<welcome-file>default.jsp</welcome-file> 
</welcome-file-list> 
<servlet> 
<servlet-name>Hello</servlet-name> 
<servlet-class>demo.Hello</servlet-class> 
</servlet> 
<servlet-mapping> 
<servlet-name>Hello</servlet-name> 
<url-pattern>/HelloTest</url-pattern> 
</servlet-mapping> 

代碼如下:

<?xml version="1.0" encoding="UTF-8"?> 
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> 
<display-name>Deployment</display-name> 
<welcome-file-list> 

<welcome-file>index.html</welcome-file> 
<welcome-file>index.htm</welcome-file> 
<welcome-file>index.jsp</welcome-file> 
<welcome-file>default.html</welcome-file> 
<welcome-file>default.htm</welcome-file> 
<welcome-file>default.jsp</welcome-file> 
</welcome-file-list> 

<servlet> 
<servlet-name>Hello</servlet-name> 
<servlet-class>demo.Hello</servlet-class> 
</servlet> 
<servlet-mapping> 
<servlet-name>Hello</servlet-name> 
<url-pattern>HelloTest</url-pattern> 
</servlet-mapping> 

<servlet> 
<servlet-name>login</servlet-name> 
<jsp-file>login.jsp</jsp-file> 
</servlet> 
<servlet-mapping> 
<servlet-name>login</servlet-name> 
<url-pattern>/loginpage</url-pattern> 
</servlet-mapping> 



</web-app> 

========== ===========================================

然後控制檯中的錯誤消息:

Oct 25, 2013 8:39:43 AM org.apache.catalina.core.AprLifecycleListener init 
INFO: 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\jre7\bin;C:\windows\Sun\Java\bin;C:\windows\system32;C:\windows;C:/Program Files (x86)/Java/jre7/bin/client;C:/Program Files (x86)/Java/jre7/bin;C:/Program Files (x86)/Java/jre7/lib/i386;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Program Files\Common Files\Microsoft Shared\Microsoft Online Services;C:\Program Files (x86)\Common Files\Microsoft Shared\Microsoft Online Services;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Users\v-mcor\.m2\bin;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\nodejs\;C:\Users\v-mcor\AppData\Roaming\npm;C:\Program Files (x86)\Java\jre7\bin;C:\Users\v-mcor\Desktop\eclipse;;. 
Oct 25, 2013 8:39:43 AM org.apache.tomcat.util.digester.SetPropertiesRule begin 
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:Deployment' did not find a matching property. 
Oct 25, 2013 8:39:43 AM org.apache.coyote.AbstractProtocol init 
INFO: Initializing ProtocolHandler ["http-bio-8080"] 
Oct 25, 2013 8:39:43 AM org.apache.coyote.AbstractProtocol init 
INFO: Initializing ProtocolHandler ["ajp-bio-8009"] 
Oct 25, 2013 8:39:43 AM org.apache.catalina.startup.Catalina load 
INFO: Initialization processed in 285 ms 
Oct 25, 2013 8:39:43 AM org.apache.catalina.core.StandardService startInternal 
INFO: Starting service Catalina 
Oct 25, 2013 8:39:43 AM org.apache.catalina.core.StandardEngine startInternal 
INFO: Starting Servlet Engine: Apache Tomcat/7.0.42 
Oct 25, 2013 8:39:43 AM org.apache.catalina.core.ContainerBase startInternal 
SEVERE: A child container failed during start 
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/Deployment]] 
at java.util.concurrent.FutureTask.report(Unknown Source) 
at java.util.concurrent.FutureTask.get(Unknown Source) 
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123) 
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:800) 
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) 
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) 
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: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/Deployment]] 
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) 
... 6 more 
Caused by: java.lang.IllegalArgumentException: JSP file login.jsp must start with a '/ 
at org.apache.catalina.startup.ContextConfig.convertJsp(ContextConfig.java:1523) 
at org.apache.catalina.startup.ContextConfig.convertJsps(ContextConfig.java:1507) 
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1341) 
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:878) 
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:376) 
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) 
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) 
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5322) 
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
... 6 more 

Oct 25, 2013 8:39:43 AM org.apache.catalina.core.ContainerBase startInternal 
SEVERE: A child container failed during start 
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]] 
at java.util.concurrent.FutureTask.report(Unknown Source) 
at java.util.concurrent.FutureTask.get(Unknown Source) 
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123) 
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:302) 
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443) 
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:732) 
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
at org.apache.catalina.startup.Catalina.start(Catalina.java:691) 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
at java.lang.reflect.Method.invoke(Unknown Source) 
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322) 
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:456) 
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]] 
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) 
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) 
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) 
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: org.apache.catalina.LifecycleException: A child container failed during start 
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1131) 
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:800) 
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
... 6 more 

Oct 25, 2013 8:39:43 AM org.apache.catalina.startup.Catalina start 
SEVERE: The required Server component failed to start so Tomcat is unable to start. 
org.apache.catalina.LifecycleException: Failed to start component [StandardServer[8005]] 
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) 
at org.apache.catalina.startup.Catalina.start(Catalina.java:691) 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
at java.lang.reflect.Method.invoke(Unknown Source) 
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322) 
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:456) 
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Catalina]] 
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) 
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:732) 
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
... 7 more 
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina]] 
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) 
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443) 
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
... 9 more 
Caused by: org.apache.catalina.LifecycleException: A child container failed during start 
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1131) 
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:302) 
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
... 11 more 

Oct 25, 2013 8:39:43 AM org.apache.coyote.AbstractProtocol pause 
INFO: Pausing ProtocolHandler ["http-bio-8080"] 
Oct 25, 2013 8:39:43 AM org.apache.coyote.AbstractProtocol pause 
INFO: Pausing ProtocolHandler ["ajp-bio-8009"] 
Oct 25, 2013 8:39:43 AM org.apache.catalina.core.StandardService stopInternal 
INFO: Stopping service Catalina 
Oct 25, 2013 8:39:43 AM org.apache.coyote.AbstractProtocol destroy 
INFO: Destroying ProtocolHandler ["http-bio-8080"] 
Oct 25, 2013 8:39:43 AM org.apache.coyote.AbstractProtocol destroy 
INFO: Destroying ProtocolHandler ["ajp-bio-8009"] 

===========================================

謝謝

回答

3

從您的堆棧跟蹤

Caused by: java.lang.IllegalArgumentException: JSP file login.jsp must start with a '/ 

標籤<jsp-file> from oracle docs says,

的完整路徑的Web應用程序中的JSP文件相對於Web應用程序根目錄。

Rhand answer提到的鏈接,從該鏈接

的必須以正斜槓(/)如果JSP是在應用程序的根目錄。

只是改變

<jsp-file>/login.jsp</jsp-file> 

一兩件事,從網頁。XML working before update你有

<url-pattern>/HelloTest</url-pattern> 

而且在web.xmlafter update你有

<url-pattern>HelloTest</url-pattern> //missing/ 
      ↑ 

糾正它

<url-pattern>/HelloTest</url-pattern> 
+0

謝謝你的答案。 它看起來像我沒有從以前的錯誤消息,但當我將行更改爲 /login.jsp,然後我在鏈接「http:// localhost:8080/Deployment/WEB-INF/web.xml「: \t HTTP狀態404 - \t ------------------------------- ------------------------------------------------- \t類型狀態報告 \t消息 \t描述所請求的資源不可用。 ----------------------------------------------- --------------------------------- \t Apache Tomcat/7.0.42 – user1805

+0

不要嘗試運行web .xml'。試試http:// localhost:8080/Deployment/login.jsp –

+0

非常感謝,現在都在工作:-)。標記爲已解決 – user1805

相關問題