org.apache.catalina.core.StandardContext listenerStart java.lang.NoClassDefFoundError:

时间:2011-10-14 16:11:09

标签: java eclipse eclipse-plugin m2eclipse

请帮助我,我以前从未在eclipse IDE上工作过。我正在myeclipse上做一个自我项目。现在我的日食已经过期了。然后我下载了eclipse indigo。然后导入我的项目。之后我无法部署我的项目。

我正在使用struts 1.2和tomcat。 我在eclipse中配置了tomcat。我也可以开始吧。但是当我部署项目时。它甚至无法找到listner类(web.xml条目)。

请帮帮我。

我在启动服务器时面临以下问题

Oct 15, 2011 3:17:28 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\jre6\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files (x86)/Java/jre6/bin/client;C:/Program Files (x86)/Java/jre6/bin;C:\app\abhi\product\11.2.0\dbhome_1\bin;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\ThinkPad\Bluetooth Software\;C:\Program Files\ThinkPad\Bluetooth Software\syswow64;C:\Program Files\Broadcom\WHL\;C:\Program Files\Broadcom\WHL\syswow64;C:\Program Files\Broadcom\WHL\SysWow64\;C:\Program Files\Broadcom\WHL\SysWow64\syswow64;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Common Files\Lenovo;C:\Program Files (x86)\Common Files\Ulead Systems\MPEG;C:\Program Files (x86)\Windows Live\Shared;C:\SWTOOLS\ReadyApps;C:\Program Files (x86)\Intel\Services\IPT\;C:\Oracle\Middleware\jdk160_21\bin;.
Oct 15, 2011 3:17:28 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:friend' did not find a matching property.
Oct 15, 2011 3:17:28 AM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Oct 15, 2011 3:17:28 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 367 ms
Oct 15, 2011 3:17:28 AM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Oct 15, 2011 3:17:28 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.33
Oct 15, 2011 3:17:29 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Error configuring application listener of class jaha.Customer.util.ApplicationScopeInit
java.lang.NoClassDefFoundError: ServletContextListener
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(Unknown Source)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2818)
    at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1159)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1647)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4149)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
    at org.apache.catalina.core.StandardService.start(StandardService.java:525)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
    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:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.lang.ClassNotFoundException: ServletContextListener
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
    ... 23 more
Oct 15, 2011 3:17:29 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Skipped installing application listeners due to previous error(s)
Oct 15, 2011 3:17:29 AM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
Oct 15, 2011 3:17:29 AM org.apache.catalina.core.StandardContext start
SEVERE: Context [/friend] startup failed due to previous errors
Oct 15, 2011 3:17:29 AM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor host-manager.xml
Oct 15, 2011 3:17:29 AM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor manager.xml
Oct 15, 2011 3:17:29 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory docs
Oct 15, 2011 3:17:29 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory examples
Oct 15, 2011 3:17:29 AM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Oct 15, 2011 3:17:29 AM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
Oct 15, 2011 3:17:29 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory ROOT
Oct 15, 2011 3:17:29 AM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Oct 15, 2011 3:17:29 AM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Oct 15, 2011 3:17:29 AM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/14  config=null
Oct 15, 2011 3:17:29 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 593 ms

...

<?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" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">

 <display-name>friend</display-name>
 <context-param>
  <param-name>imagePath</param-name>
  <param-value>D:\\OrderID_images</param-value>
 </context-param>
 <listener>
  <listener-class>jaha.Customer.util.ApplicationScopeInit</listener-class>
 </listener>
 <servlet>
  <servlet-name>action</servlet-name>
  <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
  <init-param>
   <param-name>config</param-name>
   <param-value>/WEB-INF/struts-config.xml</param-value>
  </init-param>
  <init-param>
   <param-name>debug</param-name>
   <param-value>3</param-value>
  </init-param>
  <init-param>
   <param-name>detail</param-name>
   <param-value>3</param-value>
  </init-param>
  <load-on-startup>1</load-on-startup>
 </servlet>
 <servlet>
  <servlet-name>action_tmp</servlet-name>
  <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
  <init-param>
   <param-name>config</param-name>
   <param-value>/WEB-INF/struts-config.xml</param-value>
  </init-param>
  <init-param>
   <param-name>debug</param-name>
   <param-value>3</param-value>
  </init-param>
  <init-param>
   <param-name>detail</param-name>
   <param-value>3</param-value>
  </init-param>
  <load-on-startup>0</load-on-startup>
 </servlet>
 <servlet-mapping>
  <servlet-name>action</servlet-name>
  <url-pattern>*.do</url-pattern>
 </servlet-mapping>
 <welcome-file-list>
  <welcome-file>welcome.jsp</welcome-file>
 </welcome-file-list>
 <taglib>
  <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
  <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
 </taglib>
 <taglib>
  <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
  <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
 </taglib>
 <taglib>
  <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
  <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
 </taglib>
 <taglib>
  <taglib-uri>/WEB-INF/struts-tiles.tld</taglib-uri>
  <taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
 </taglib>
 <!-- The JSTL and Struts-EL tlds -->
 <taglib>
  <taglib-uri>/WEB-INF/struts-bean-el.tld</taglib-uri>
  <taglib-location>/WEB-INF/struts-bean-el.tld</taglib-location>
 </taglib>
 <taglib>
  <taglib-uri>/WEB-INF/struts-html-el.tld</taglib-uri>
  <taglib-location>/WEB-INF/struts-html-el.tld</taglib-location>
 </taglib>
 <taglib>
  <taglib-uri>/WEB-INF/struts-logic-el.tld</taglib-uri>
  <taglib-location>/WEB-INF/struts-logic-el.tld</taglib-location>
 </taglib>
 <taglib>
  <taglib-uri>/WEB-INF/c.tld</taglib-uri>
  <taglib-location>/WEB-INF/c.tld</taglib-location>
 </taglib>
 <taglib>
  <taglib-uri>/WEB-INF/pager-taglib.tld</taglib-uri>
  <taglib-location>/WEB-INF/pager-taglib.tld</taglib-location>
 </taglib>
 <taglib>
  <taglib-uri>/WEB-INF/mytags.tld</taglib-uri>
  <taglib-location>/WEB-INF/mytags.tld</taglib-location>
 </taglib>
 <taglib>
  <taglib-uri>/WEB-INF/displaytag.tld</taglib-uri>
  <taglib-location>/WEB-INF/displaytag-jsp1.1-1.0-b3.tld</taglib-location>
 </taglib>
 <login-config>
  <auth-method>BASIC</auth-method>
 </login-config>

  <description>MySQL Test App</description>
  <resource-ref>
      <description>DB Connection</description>
      <res-ref-name>jdbc/TestDB</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
  </resource-ref>


</web-app>

1 个答案:

答案 0 :(得分:1)

确保:

  • 您的tomcat安装很好(您不应该从其lib文件夹中删除任何jar)
  • servlet-api.jar
  • 中没有WEB-INF/lib
  • 您已在eclipse中正确配置了服务器。如果在eclipse之外启动它是否正常运行