2011-01-12 43 views
0

運行這個項目時,我使用的tomcat6那麼就會拋出一個錯誤runig我的項目在MyEclipse中,像這樣我應該怎麼做這個錯誤關於春天類,但我會從MyEclipse的加載所有春天庫錯誤而在tomcat6中

Jan 12, 2011 5:24:09 PM org.apache.catalina.core.AprLifecycleListener init 
INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre1.6.0\bin;C:\Program Files\Genuitec\Common\plugins\com.genuitec.eclipse.easie.tomcat.myeclipse_8.6.0.me201007231647\tomcat\bin 
Jan 12, 2011 5:24:10 PM org.apache.coyote.http11.Http11Protocol init 
INFO: Initializing Coyote HTTP/1.1 on http-8080 
Jan 12, 2011 5:24:10 PM org.apache.catalina.startup.Catalina load 
INFO: Initialization processed in 2559 ms 
Jan 12, 2011 5:24:10 PM org.apache.catalina.core.StandardService start 
INFO: Starting service Catalina 
Jan 12, 2011 5:24:10 PM org.apache.catalina.core.StandardEngine start 
INFO: Starting Servlet Engine: Apache Tomcat/6.0.13 
Jan 12, 2011 5:24:19 PM org.apache.catalina.loader.WebappLoader start 
SEVERE: LifecycleException 
java.lang.ClassNotFoundException: org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader 
    at java.net.URLClassLoader$1.run(Unknown Source) 
    at java.security.AccessController.doPrivileged(Native Method) 
    at java.net.URLClassLoader.findClass(Unknown Source) 
    at java.lang.ClassLoader.loadClass(Unknown Source) 
    at java.lang.ClassLoader.loadClass(Unknown Source) 
    at java.lang.ClassLoader.loadClassInternal(Unknown Source) 
    at java.lang.Class.forName0(Native Method) 
    at java.lang.Class.forName(Unknown Source) 
    at org.apache.catalina.loader.WebappLoader.createClassLoader(WebappLoader.java:770) 
    at org.apache.catalina.loader.WebappLoader.start(WebappLoader.java:639) 
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4196) 
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) 
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) 
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525) 
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920) 
    at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883) 
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492) 
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138) 
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311) 
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) 
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) 
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:719) 
    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:566) 
    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) 
Jan 12, 2011 5:24:19 PM org.apache.catalina.core.ContainerBase addChildInternal 
SEVERE: ContainerBase.addChild: start: 
LifecycleException: start: : java.lang.ClassNotFoundException: org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader 
    at org.apache.catalina.loader.WebappLoader.start(WebappLoader.java:676) 
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4196) 
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) 
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) 
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525) 
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920) 
    at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883) 
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492) 
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138) 
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311) 
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) 
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) 
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:719) 
    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:566) 
    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) 
Jan 12, 2011 5:24:19 PM org.apache.catalina.startup.HostConfig deployDirectory 
SEVERE: Error deploying web application directory servlet 
java.lang.IllegalStateException: ContainerBase.addChild: start: LifecycleException: start: : java.lang.ClassNotFoundException: org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader 
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:795) 
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) 
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525) 
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920) 
    at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883) 
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492) 
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138) 
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311) 
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) 
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) 
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:719) 
    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:566) 
    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) 
Jan 12, 2011 5:24:19 PM org.apache.coyote.http11.Http11Protocol start 
INFO: Starting Coyote HTTP/1.1 on http-8080 
Jan 12, 2011 5:24:20 PM org.apache.jk.common.ChannelSocket init 
INFO: JK: ajp13 listening on /0.0.0.0:8009 
Jan 12, 2011 5:24:20 PM org.apache.jk.server.JkMain start 
INFO: Jk running ID=0 time=0/219 config=null 
Jan 12, 2011 5:24:20 PM org.apache.catalina.startup.Catalina start 
INFO: Server startup in 9998 ms 
+0

[java.lang.ClassNotFoundException:org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader]的可能重複(http://stackoverflow.com/questions/4615164/java-lang-classnotfoundexception-org-springframework-instrument-類加載到) – axtavt 2011-01-12 13:31:24

回答

0

您的Tomcat已被配置爲使用Spring的類加載器工具框架,但您的類路徑中缺少Spring。

你需要刪除該檢測配置,或將Spring添加到類路徑中。

0

看起來像一個Spring Jars不在你的類路徑中。

0

這個問題是很難不要求更多的細節來回答......我曾在不同的情況下,這(或類似)錯誤,其中一個正好解決了。

如果您使用Eclipse的「Run As/Run on Server」命令/菜單運行應用程序,那麼您可以嘗試手動向Tomcat的安裝home/lib /目錄添加spring-instrument-tomcat-.jar , 然後再試一次;或者(如果你實際上不需要LTW和工具) - 檢查你的項目..webapp/META-INF/context.xml中是否有loaderClass =「org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader」並將其刪除。如果你實際上使用Maven並從eclipse運行爲「Run As/Maven ...」(然後 - tomcat6:run命令;也可以從控制檯執行),那麼這是一個不同的故事。下面的POM的配置既適用於部署在獨立的Tomcat(正如我上面描述的,如果你已經添加了春天JAR)和嵌入式之一: ...

<build> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-war-plugin</artifactId> 
      <version>2.2</version> 
      <configuration> 
       <webResources> 
        <resource> 
         <targetPath>META-INF</targetPath> 
         <directory>src/main/config</directory> 
         <includes> 
          <include>context.xml</include> 
         </includes> 
        </resource> 
       </webResources> 
      </configuration> 
     </plugin> 
     <plugin> 
      <groupId>org.apache.tomcat.maven</groupId> 
      <artifactId>tomcat6-maven-plugin</artifactId> 
      <version>2.0</version> 
      <configuration> 
       <port>8080</port> 
       <path>/</path>     
       <update>true</update>    
       <classLoaderClass>org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader</classLoaderClass> 
      </configuration> 
      <dependencies> 
       <dependency> 
        <groupId>org.springframework</groupId> 
        <artifactId>spring-instrument-tomcat</artifactId> 
        <version>${spring.version}</version> 
       </dependency> 
      </dependencies> 
     </plugin> 
    </plugins> 
</build> 

注:TomcatInstrumentableClassLoader的和間INF/context.xml文件與tomcat6-maven-plugin(在context.xml文件不在src/main/webapp/META-INF/context.xml中時工作)有衝突,所以我不得不將它移動到src/main/config,然後讓maven-war-plugin來照顧它。

乾杯, IR。