tomcat提示找不到log4j问题

今天在设置applet程序的本地引用包,设置完成后,发现web程序运行不起来,一直报错:

org.apache.commons.logging.LogConfigurationException:org.apache.commons.logging.LogConfigurationException:NosuitableLogconstructor[Ljava.lang.Class;@13dcd27fororg.apache.commons.logging.impl.Log4JLogger

atorg.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:532)

atorg.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:272)

atorg.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:246)

atorg.apache.commons.logging.LogFactory.getLog(LogFactory.java:395)

atorg.apache.catalina.session.ManagerBase.<init>(ManagerBase.java:63)

atorg.apache.catalina.session.StandardManager.<init>(StandardManager.java:64)

atorg.apache.catalina.startup.ContextConfig.managerConfig(ContextConfig.java:317)

atorg.apache.catalina.startup.ContextConfig.start(ContextConfig.java:638)

atorg.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:216)

atorg.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)

atorg.apache.catalina.core.StandardContext.start(StandardContext.java:4270)

atorg.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:823)

atorg.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)

atorg.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)

atorg.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:277)

atorg.apache.catalina.core.StandardHost.install(StandardHost.java:832)

atorg.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:701)

atorg.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:432)

atorg.apache.catalina.startup.HostConfig.start(HostConfig.java:983)

atorg.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:349)

atorg.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)

atorg.apache.catalina.core.ContainerBase.start(ContainerBase.java:1091)

atorg.apache.catalina.core.StandardHost.start(StandardHost.java:789)

atorg.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)

atorg.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)

atorg.apache.catalina.core.StandardService.start(StandardService.java:480)

atorg.apache.catalina.core.StandardServer.start(StandardServer.java:2313)

atorg.apache.catalina.startup.Catalina.start(Catalina.java:556)

atsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)

atsun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

atjava.lang.reflect.Method.invoke(Method.java:324)

atorg.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287)

atorg.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)

Causedby:org.apache.commons.logging.LogConfigurationException:NosuitableLogconstructor[Ljava.lang.Class;@13dcd27fororg.apache.commons.logging.impl.Log4JLogger

atorg.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:432)

atorg.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:525)

...33more

Causedby:java.lang.NoClassDefFoundError:org/apache/log4j/Logger

atjava.lang.Class.getDeclaredConstructors0(NativeMethod)

atjava.lang.Class.privateGetDeclaredConstructors(Class.java:1610)

atjava.lang.Class.getConstructor0(Class.java:1922)

atjava.lang.Class.getConstructor(Class.java:1019)

atorg.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:429)

...34more

查找了lib,明明有引用log4j的包,也有commons-logging.jar包,但一直提示找不到这个包。试了下以前的web程序,同样报这样的错误,运行不起来。google了一翻,没有能有具体的解决办法,后来想想是不是因为设置了jre/lib/applet和jre/lib/ext包的问题。重新设置jdk1.6的classpath和设置tomcat的jdk位置,从新运行,一切OK.

相关推荐