2012-10-08 145 views
-3

當我嘗試啓動我的應用程序時,出現此錯誤。我已經證實JarScanner存在於CATALINA_HOME目錄中,所以我不知道它爲什麼無法找到它。有什麼可能導致這個問題開始我的應用程序?Tomcat 7 ClassNotFoundException:org.apache.tomcat.JarScanner

Oct 8, 2012 1:24:01 PM org.apache.catalina.core.ContainerBase addChildInternal 
SEVERE: ContainerBase.addChild: start: 
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/client]] 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) 
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) 
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) 
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:618) 
    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:650) 
    at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1582) 
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) 
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:138) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) 
    at java.lang.Thread.run(Thread.java:662) 
Caused by: java.lang.NoClassDefFoundError: org/apache/tomcat/JarScanner 
    at java.lang.ClassLoader.defineClass1(Native Method) 
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) 
    at java.lang.ClassLoader.defineClass(ClassLoader.java:615) 
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) 
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:283) 
    at java.net.URLClassLoader.access$000(URLClassLoader.java:58) 
    at java.net.URLClassLoader$1.run(URLClassLoader.java:197) 
    at java.security.AccessController.doPrivileged(Native Method) 
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306) 
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:295) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247) 
    at org.apache.catalina.core.StandardContext.getJarScanner(StandardContext.java:1025) 
    at org.apache.catalina.startup.ContextConfig.processJarsForWebFragments(ContextConfig.java:1911) 
    at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1265) 
    at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:878) 
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:369) 
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) 
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) 
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5173) 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
    ... 11 more 
Caused by: java.lang.ClassNotFoundException: org.apache.tomcat.JarScanner 
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202) 
    at java.security.AccessController.doPrivileged(Native Method) 
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306) 
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247) 
    ... 33 more 
Oct 8, 2012 1:24:01 PM org.apache.catalina.startup.HostConfig deployDescriptor 
SEVERE: Error deploying configuration descriptor /software/sirsi/tomcat_sbox7/conf/Catalina/localhost/client.xml 
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/client]] 
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:904) 
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) 
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:618) 
    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:650) 
    at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1582) 
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) 
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:138) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) 
    at java.lang.Thread.run(Thread.java:662) 
Oct 8, 2012 1:24:01 PM org.apache.catalina.startup.HostConfig deployDescriptor 
INFO: Deploying configuration descriptor /software/sirsi/tomcat_sbox7/conf/Catalina/localhost/custom.xml 
Oct 8, 2012 1:24:01 PM org.apache.catalina.core.StandardContext setPath 
WARNING: A context path must either be an empty string or start with a '/'. The path [custom] does not meet these criteria and has been changed to [/custom] 
Oct 8, 2012 1:24:01 PM org.apache.catalina.startup.SetContextPropertiesRule begin 
WARNING: [SetContextPropertiesRule]{Context} Setting property 'debug' to '0' did not find a matching property. 
Oct 8, 2012 1:24:01 PM org.apache.catalina.core.ContainerBase addChildInternal 
SEVERE: ContainerBase.addChild: start: 
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/custom]] 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) 
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) 
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) 
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:618) 
    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:650) 
    at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1582) 
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) 
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:138) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) 
    at java.lang.Thread.run(Thread.java:662) 
Caused by: java.lang.NoClassDefFoundError: org/apache/tomcat/util/scan/StandardJarScanner 
    at org.apache.catalina.core.StandardContext.getJarScanner(StandardContext.java:1025) 
    at org.apache.catalina.startup.ContextConfig.processJarsForWebFragments(ContextConfig.java:1911) 
    at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1265) 
    at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:878) 
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:369) 
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) 
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) 
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5173) 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
    ... 11 more 
Oct 8, 2012 1:24:01 PM org.apache.catalina.startup.HostConfig deployDescriptor 
SEVERE: Error deploying configuration descriptor /software/sirsi/tomcat_sbox7/conf/Catalina/localhost/custom.xml 
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/custom]] 
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:904) 
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) 
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:618) 
    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:650) 
    at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1582) 
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) 
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:138) 
    at  java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) 
     at java.lang.Thread.run(Thread.java:662) 
+0

offtopic;屬於serverfault。 – bmargulies

回答

-2

該jar文件需要在類路徑上(不在CATALINA_HOME中)。

+0

那麼在我的應用程序(CATALINA_BASE)的catalina.properties文件中,我有common.loader = $ {catalina.home}/lib/*。jar,它似乎可以找到CATALINA_HOME中的所有其他jar。這解決了我之前在tomcat無法找到Catalina類的問題。 –

+0

我的回答是錯誤的 - JarScanner是Tomcat的一部分。 Tomcat的根目錄中是否有JarScanner.jar文件?你把它移到那裏了嗎? –

+0

不,我發現JarScanner類是lib目錄中的tomcat-api.jar的一部分。我也發現這個錯誤發生在同一個日誌的開始部分:[從文件加載org.apache.tomcat.JarScanner:/usr/local/apache-tomcat-7.0.30/lib/tomcat-api.jar] –

-3

把你的罐子在你的webapps目錄按照步驟

1.Go到PROGRAMFILES> Apache軟件基金會>的Tomcat> 的webapps。

  1. 把你一罐(你的目錄中創建)/ WEB-INF/lib目錄

然後在本地主機上運行時執行它。

+0

這是一個unix系統,也請參閱下面的答案。 –