исключение при развертывании весеннего приложения на Tomcat 6 - PullRequest
0 голосов
/ 15 февраля 2010

Я пытаюсь создать простое веб-приложение с использованием Spring и развернуть его на Tomcat 6. Когда я пытаюсь развернуть его на сервере, оно выдает мне следующую ошибку. Я не могу понять, связана ли проблема с Tomcat или моим приложением.

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.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)
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

Мое приложение пытается получить имя пользователя на одной странице, а при отправке на другой странице отображается приветственное сообщение: "Добрый день, !"

Может кто-нибудь помочь разобраться в этом исключении?

Спасибо, Neetu.

Ответы [ 3 ]

4 голосов
/ 15 февраля 2010

Я думаю, что проблема заключается здесь:

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

А здесь:

Servlet mapping specifies an unknown servlet name profile

Похоже, вы хотите сопоставить сервер с заданным путем, например:

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

но вам не хватает этого определения сервлета:

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

Возможно, опечатка?

0 голосов
/ 15 февраля 2010

Исключение исчезло после того, как я переместил пружинные банки в папку lib web-inf из папки web-inf.

0 голосов
/ 15 февраля 2010

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>

Профиль

...