2013-01-24 50 views
0

我在this topic錯誤,同時部署到Tomcat:tomcatManager狀態代碼:404,ReasonPhrase:未找到

現在創建Spring配置我嘗試部署從IntelliJ IDEA的我的戰爭文件到Tomcat 7 tomcat7有一個問題-maven-plugin和我正面臨另一個問題。

這是pom.xml的設置爲:

<build> 
    <finalName>employee-list</finalName> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <version>3.0</version> 
      <configuration> 
       <source>1.7</source> 
       <target>1.7</target> 
      </configuration> 
     </plugin> 
     <plugin> 
      <groupId>org.apache.tomcat.maven</groupId> 
      <artifactId>tomcat7-maven-plugin</artifactId> 
      <version>2.0</version> 
      <configuration> 
       <url>http://127.0.0.1:8080/employee-list</url> 
       <server>TomcatServer</server> 
       <path>/employee-list</path> 
      </configuration> 
     </plugin> 
    </plugins> 
</build> 

這是web.xml中

 <?xml version="1.0" encoding="UTF-8"?> 
<web-app id="WebApp_ID" version="2.4" 
     xmlns="http://java.sun.com/xml/ns/j2ee" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
     http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> 


<display-name>employee-list</display-name> 

    <!-- Spring MVC configurations--> 

    <context-param> 
     <param-name>contextConfigLocation</param-name> 
     <param-value> 
      /WEB-INF/spring-security.xml 
      /WEB-INF/applicationContext.xml 
     </param-value> 
    </context-param> 

    <servlet> 
     <servlet-name>spring</servlet-name> 
     <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> 
     <load-on-startup>1</load-on-startup> 
    </servlet> 

    <servlet-mapping> 
     <servlet-name>spring</servlet-name> 
     <url-pattern>/employee/*</url-pattern> 
    </servlet-mapping> 

    <listener> 
     <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 
    </listener> 

    <!-- Spring Security configurations--> 
    <filter> 
     <filter-name>springSecurityFilterChain</filter-name> 
     <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> 
    </filter> 

    <filter-mapping> 
     <filter-name>springSecurityFilterChain</filter-name> 
     <url-pattern>/*</url-pattern> 
    </filter-mapping> 

</web-app> 

所以,我用org.apache.tomcat.maven:tomcat7-maven-plugin:2.0:deploy -e tomcat7 - Maven的插件 和得到這個調試日誌:

[INFO] <<< tomcat7-maven-plugin:2.0:deploy (default-cli) @ employee <<< 
[INFO] 
[INFO] --- tomcat7-maven-plugin:2.0:deploy (default-cli) @ employee --- 
[INFO] Deploying war to http://127.0.0.1:8080/employee-list 
Uploading: http://127.0.0.1:8080/employee-list/deploy?path=%2Femployee-list 
Uploaded: http://127.0.0.1:8080/employee-list/deploy?path=%2Femployee-list (27914 KB at 8258.5 KB/sec) 

[INFO] tomcatManager status code:404, ReasonPhrase:Not Found 
[INFO] <html><head><title>Apache Tomcat/7.0.28 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 404 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The requested resource() is not available.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/7.0.28</h3></body></html> 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD SUCCESS 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 12.686s 
[INFO] Finished at: Wed Jan 23 22:03:27 EET 2013 

in localhost_access_log我得到這一行:

127.0.0.1 - - [23/Jan/2013:22:03:23 +0200] "PUT /employee-list/deploy?path=%2Femployee-list HTTP/1.1" 404 952 

在tomcat7,標準輸出我得到:

янв 23, 2013 9:44:23 PM org.apache.catalina.startup.ContextConfig parseWebXml 
SEVERE: Parse error in application web.xml file at jndi:/localhost/employee-list/WEB-INF/web.xml 
org.xml.sax.SAXParseException; systemId: jndi:/localhost/employee-list/WEB-INF/web.xml; lineNumber: 25; columnNumber: 15; Error at (25, 15) : org.apache.catalina.deploy.WebXml addServlet 
    at org.apache.tomcat.util.digester.Digester.createSAXException(Digester.java:2687) 
    at org.apache.tomcat.util.digester.Digester.createSAXException(Digester.java:2719) 
    at org.apache.tomcat.util.digester.Digester.endElement(Digester.java:1054) 
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Unknown Source) 

    ... 

    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1770) 
    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: java.lang.NoSuchMethodException: org.apache.catalina.deploy.WebXml addServlet 
    at org.apache.tomcat.util.IntrospectionUtils.callMethod1(IntrospectionUtils.java:855) 
    at org.apache.tomcat.util.digester.SetNextRule.end(SetNextRule.java:201) 
    at org.apache.tomcat.util.digester.Digester.endElement(Digester.java:1051) 
    ... 46 more 

янв 23, 2013 9:44:23 PM org.apache.catalina.startup.ContextConfig parseWebXml 
SEVERE: Occurred at line 25 column 15 
янв 23, 2013 9:44:23 PM org.apache.catalina.startup.ContextConfig configureStart 
SEVERE: Marking this application unavailable due to previous error(s) 
янв 23, 2013 9:44:23 PM org.apache.catalina.core.StandardContext startInternal 
SEVERE: Error getConfigured 
янв 23, 2013 9:44:23 PM org.apache.catalina.core.StandardContext startInternal 
SEVERE: Context [/employee-list] startup failed due to previous errors 

line25是豆結束:

<servlet> 
     <servlet-name>spring</servlet-name> 
     <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> 
     <load-on-startup>1</load-on-startup> 
    </servlet> 

可有人告訴我去哪裏錯了?

回答

1

<url>tomcat7-maven-plugin配置是一個Tomcat管理URL,而不是應用程序URL:

<url>http://127.0.0.1:8080/manager/html</url> 

參見:

+0

axtavt,thnanks!它確實有用 - 我設法部署了我的項目 – Serge

相關問題