2016-01-22 54 views
0

我剛開始使用Eclipse Servlet,當嘗試使用Eclipse Servlet時出現此錯誤在服務器上運行一個動態的Web項目:Java EE Eclipse Servlet Tomcat 7錯誤:名爲[...]的Servlet都映射到不允許的url-pattern

Jan 22, 2016 7:16:51 PM org.apache.tomcat.util.digester.SetPropertiesRule begin 
    WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:couchfriendslsrs' did not find a matching property. 
    Jan 22, 2016 7:16:51 PM org.apache.catalina.startup.VersionLoggerListener log 
    INFO: Server version:  Apache Tomcat/7.0.67 
    Jan 22, 2016 7:16:51 PM org.apache.catalina.startup.VersionLoggerListener log 
    INFO: Server built:   Dec 7 2015 13:07:11 UTC 
    Jan 22, 2016 7:16:51 PM org.apache.catalina.startup.VersionLoggerListener log 
    INFO: Server number:   7.0.67.0 
    Jan 22, 2016 7:16:51 PM org.apache.catalina.startup.VersionLoggerListener log 
    INFO: OS Name:    Windows 8.1 
    Jan 22, 2016 7:16:51 PM org.apache.catalina.startup.VersionLoggerListener log 
    INFO: OS Version:   6.3 
    Jan 22, 2016 7:16:51 PM org.apache.catalina.startup.VersionLoggerListener log 
    INFO: Architecture:   amd64 
    Jan 22, 2016 7:16:51 PM org.apache.catalina.startup.VersionLoggerListener log 
    INFO: Java Home:    C:\Program Files\Java\jdk1.8.0_71\jre 
    Jan 22, 2016 7:16:51 PM org.apache.catalina.startup.VersionLoggerListener log 
    INFO: JVM Version:   1.8.0_71-b15 
    Jan 22, 2016 7:16:51 PM org.apache.catalina.startup.VersionLoggerListener log 
    INFO: JVM Vendor:   Oracle Corporation 
    Jan 22, 2016 7:16:51 PM org.apache.catalina.startup.VersionLoggerListener log 
    INFO: CATALINA_BASE:   C:\Programming Files\EclipseJEE\.metadata\.plugins\org.eclipse.wst.server.core\tmp0 
    Jan 22, 2016 7:16:51 PM org.apache.catalina.startup.VersionLoggerListener log 
    INFO: CATALINA_HOME:   C:\Program Files\Apache Tomcat\apache-tomcat-7.0.67-windows-x64\apache-tomcat-7.0.67 
    Jan 22, 2016 7:16:51 PM org.apache.catalina.startup.VersionLoggerListener log 
    INFO: Command line argument: -Dcatalina.base=C:\Programming Files\EclipseJEE\.metadata\.plugins\org.eclipse.wst.server.core\tmp0 
    Jan 22, 2016 7:16:51 PM org.apache.catalina.startup.VersionLoggerListener log 
    INFO: Command line argument: -Dcatalina.home=C:\Program Files\Apache Tomcat\apache-tomcat-7.0.67-windows-x64\apache-tomcat-7.0.67 
    Jan 22, 2016 7:16:51 PM org.apache.catalina.startup.VersionLoggerListener log 
    INFO: Command line argument: -Dwtp.deploy=C:\Programming Files\EclipseJEE\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps 
    Jan 22, 2016 7:16:51 PM org.apache.catalina.startup.VersionLoggerListener log 
    INFO: Command line argument: -Djava.endorsed.dirs=C:\Program Files\Apache Tomcat\apache-tomcat-7.0.67-windows-x64\apache-tomcat-7.0.67\endorsed 
    Jan 22, 2016 7:16:51 PM org.apache.catalina.startup.VersionLoggerListener log 
    INFO: Command line argument: -Dfile.encoding=Cp1252 
    Jan 22, 2016 7:16:51 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent 
    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\Java\jdk1.8.0_71\bin;C:\windows\Sun\Java\bin;C:\windows\system32;C:\windows;C:/Program Files/Java/jre1.8.0_71/bin/server;C:/Program Files/Java/jre1.8.0_71/bin;C:/Program Files/Java/jre1.8.0_71/lib/amd64;C:\ProgramData\Oracle\Java\javapath;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\MATLAB\R2014a\bin;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files\nodejs\;C:\Program Files (x86)\Skype\Phone\;C:\Users\s142966\AppData\Local\atom\bin;C:\Users\s142966\AppData\Roaming\npm;C:\Program Files\eclipse-jee-kepler-R-win32-x86_64;;. 
    Jan 22, 2016 7:16:51 PM org.apache.coyote.AbstractProtocol init 
    INFO: Initializing ProtocolHandler ["http-bio-8080"] 
    Jan 22, 2016 7:16:51 PM org.apache.coyote.AbstractProtocol init 
    INFO: Initializing ProtocolHandler ["ajp-bio-8009"] 
    Jan 22, 2016 7:16:51 PM org.apache.catalina.startup.Catalina load 
    INFO: Initialization processed in 479 ms 
    Jan 22, 2016 7:16:51 PM org.apache.catalina.core.StandardService startInternal 
    INFO: Starting service Catalina 
    Jan 22, 2016 7:16:51 PM org.apache.catalina.core.StandardEngine startInternal 
    INFO: Starting Servlet Engine: Apache Tomcat/7.0.67 
    Jan 22, 2016 7:16:51 PM 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[/couchfriendslsrs]] 
     at java.util.concurrent.FutureTask.report(FutureTask.java:122) 
     at java.util.concurrent.FutureTask.get(FutureTask.java:192) 
     at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1122) 
     at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:819) 
     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
     at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1574) 
     at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1564) 
     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: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/couchfriendslsrs]] 
     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) 
     ... 6 more 
    Caused by: java.lang.IllegalArgumentException: The servlets named [action_edit_profile] and [ro.lsrs.couchfriends.controllers.ActionEditProfile] are both mapped to the url-pattern [/action_edit_profile] which is not permitted 
     at org.apache.catalina.deploy.WebXml.addServletMapping(WebXml.java:293) 
     at org.apache.catalina.startup.ContextConfig.processAnnotationWebServlet(ContextConfig.java:2443) 
     at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2118) 
     at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2079) 
     at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2072) 
     at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2072) 
     at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2072) 
     at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2072) 
     at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1304) 
     at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:889) 
     at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:386) 
     at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) 
     at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) 
     at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5479) 
     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
     ... 6 more 

    Jan 22, 2016 7:16:51 PM 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(FutureTask.java:122) 
     at java.util.concurrent.FutureTask.get(FutureTask.java:192) 
     at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1122) 
     at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:300) 
     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:739) 
     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
     at org.apache.catalina.startup.Catalina.start(Catalina.java:693) 
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
     at java.lang.reflect.Method.invoke(Method.java:497) 
     at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294) 
     at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:428) 
    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:1574) 
     at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1564) 
     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: org.apache.catalina.LifecycleException: A child container failed during start 
     at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1130) 
     at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:819) 
     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
     ... 6 more 

    Jan 22, 2016 7:16:51 PM 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:693) 
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
     at java.lang.reflect.Method.invoke(Method.java:497) 
     at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294) 
     at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:428) 
    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:739) 
     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:1130) 
     at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:300) 
     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
     ... 11 more 

    Jan 22, 2016 7:16:51 PM org.apache.coyote.AbstractProtocol pause 
    INFO: Pausing ProtocolHandler ["http-bio-8080"] 
    Jan 22, 2016 7:16:51 PM org.apache.coyote.AbstractProtocol pause 
    INFO: Pausing ProtocolHandler ["ajp-bio-8009"] 
    Jan 22, 2016 7:16:51 PM org.apache.catalina.core.StandardService stopInternal 
    INFO: Stopping service Catalina 
    Jan 22, 2016 7:16:51 PM org.apache.coyote.AbstractProtocol destroy 
    INFO: Destroying ProtocolHandler ["http-bio-8080"] 
    Jan 22, 2016 7:16:51 PM org.apache.coyote.AbstractProtocol destroy 
    INFO: Destroying ProtocolHandler ["ajp-bio-8009"] 

信息:

  • jdk1.8.0_71運行項目和服務器。
  • C:\ PathToWorkspace.metadata.plugins \ org.eclipse.wst.server.core \ tmp0 \ wtpwebapps顯示項目名稱。
  • 關於鏈接錯誤:The servlets named [action_edit_profile] and [ro.lsrs.couchfriends.controllers.ActionEditProfile] are both mapped to the url-pattern [/action_edit_profile] which is not permitted,web.xml文件被如此設定(在給定的誤差例如用於小服務程序):

    <servlet> 
        <servlet-name>action_edit_profile</servlet-name> 
        <servlet-class>ro.lsrs.couchfriends.controllers.ActionEditProfile</servlet-class> 
    </servlet> 
    
    <servlet-mapping> 
        <servlet-name>action_edit_profile</servlet-name> 
        <url-pattern>/action_edit_profile</url-pattern> 
    </servlet-mapping> 
    

    EDIT:就this問題可能的重複,它不是同樣的問題。我的問題是URL衝突(映射被設置在xml和java類中)。相反,this問題幫助我解決了這個問題。

+1

看看「由......引起的」行。看到一個提到URI模式? – nitind

+0

感謝@nitind,這的確是問題所在。下次我會知道更好地從控制檯發現錯誤。我的答案中提到了類似的問題已經得到解決。 – dannychris37

回答

0

事實上,正如評論中提到的,問題在於servlet映射到相同的url模式。我不得不在web.xml中對多個<servlet-mapping>塊進行評論以供服務器運行。

此問題也回答了here回答者解釋說,在web.xml和java類中映射都會導致此錯誤。

相關問題