开发者

exception while deploying spring app on tomcat 6

开发者 https://www.devze.com 2022-12-19 23:51 出处:网络
I\'m trying to make a simple web app using spring and deploying it on Tomcat 6. When I try to deploy it on the server, it gives me the following error. I\'m unable to figure out if the problem is with

I'm trying to make a simple web app using spring and deploying it on Tomcat 6. When I try to deploy it on the server, it gives me the following error. I'm unable to figure out if the problem is with Tomcat or my app.

Feb 12, 2010 3:45:43 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:SpringPOC' did not find a matching property.
Feb 12, 2010 3:45:43 PM 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\Java\jre1.5.0_15\bin;.;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jre1.5.0_15/bin/client;C:/Program Files/Java/jre1.5.0_15/bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Windows Imaging\;C:\Program Files\Java\jdk1.5.0_15\bin
Feb 12, 2010 3:45:43 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Feb 12, 2010 3:45:43 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 737 ms
Feb 12, 2010 3:45:43 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Feb 12, 2010 3:45:43 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.20
Feb 12, 2010 3:45:43 PM org.apache.tomcat.util.digester.Digester endElement
SEVERE: End event threw exception
java.lang.reflect.InvocationTargetException
      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.tomcat.util.IntrospectionUtils.callMethodN(IntrospectionUtils.java:956)
      at org.apache.catalina.startup.CallMethodMultiRule.end(WebRuleSet.java:789)
      at org.apache.tomcat.util.digester.Rule.end(Rule.java:229)
      at org.apache.tomcat.util.digester.Digester.endElement(Digester.java:1140)
      at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Unknown Source)
      at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
      at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
      at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
      at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
      at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
      at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
      at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
      at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1644)
      at org.apache.catalina.startup.ContextConfig.applicationWebConfig(ContextConfig.java:365)
      at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:1066)
      at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:261)
      at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4339)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
      at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
      at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
      at org.apache.catalina.core.StandardService.start(StandardService.java:516)
      at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
      at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
      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:288)
      at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: java.lang.IllegalArgumentException: Servlet mapping specifies an unknown servlet name profile
      at org.apache.catalina.core.StandardContext.addServletMapping(StandardContext.java:2470)
      at org.apache.catalina.core.StandardContext.addServletMapping(StandardContext.java:2450)
      ... 35 more
Feb 12, 2010 3:45:43 PM org.apache.catalina.startup.ContextConfig applicationWebConfig
SEVERE: Parse error in application web.xml file at jndi:/localhost/SpringPOC/WEB-INF/web.xml
java.lang.IllegalArgumentException: Servlet mapping specifies an unknown servlet name profile
      at org.apache.tomcat.util.digester.Digester.createSAXException(Digester.java:2808)
      at org.apache.tomcat.util.digester.Digester.createSAXException(Digester.java:2834)
      at org.apache.tomcat.util.digester.Digester.endElement(Digester.java:1143)
      at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Unknown Source)
      at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
      at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
      at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
      at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
      at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
      at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
      at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
      at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1644)
      at org.apache.catalina.startup.ContextConfig.applicationWebConfig(ContextConfig.java:365)
      at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:1066)
      at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:261)
      at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4339)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
      at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
      at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
      at org.apache.cata开发者_开发问答lina.core.StandardService.start(StandardService.java:516)
      at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
      at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
      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:288)
      at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Feb 12, 2010 3:45:43 PM org.apache.catalina.startup.ContextConfig applicationWebConfig
SEVERE: Occurred at line 8 column 23
Feb 12, 2010 3:45:43 PM org.apache.catalina.startup.ContextConfig start
SEVERE: Marking this application unavailable due to previous error(s)
Feb 12, 2010 3:45:43 PM org.apache.catalina.core.StandardContext start
SEVERE: Error getConfigured
Feb 12, 2010 3:45:43 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/SpringPOC] startup failed due to previous errors
Feb 12, 2010 3:45:43 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Feb 12, 2010 3:45:43 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Feb 12, 2010 3:45:43 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/31  config=null
Feb 12, 2010 3:45:43 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 635 ms

My app tries to take the users name in one page and on submit displays a welcome message on another page saying "good day, <username>!"

Can anybody please help make sense of this exception?

Thanks, Neetu.


I think the problem lies here:

Parse error in application web.xml file at jndi:/localhost/SpringPOC/WEB-INF/web.xml

And here:

Servlet mapping specifies an unknown servlet name profile

Seems like you want to map a server to a given path like for example:

<servlet-mapping>
  <servlet-name>profile</servlet-name>
  <url-pattern>*</url-pattern>
</servlet-mapping>

but you're missing that servlet definition like so:

<servlet>
  <servlet-name>profile</servlet-name>
  <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
</servlet>

Probably a typo?


web.xml

http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">

SpringPOC

   <servlet-name>profile</servlet-name>

   <url-pattern>/profile</url-pattern>

  <servlet-name>profile</servlet-name>

  <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>

  <load-on-startup>1</load-on-startup>

</servlet>

profile


Exception disappeared after I moved the spring jars into the web-inf's lib folder from the web-inf folder.

0

精彩评论

暂无评论...
验证码 换一张
取 消