You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by pueffl <wo...@gmail.com> on 2012/11/13 18:09:22 UTC

java.lang.ClassNotFoundException: org.apache.log4j.LogManager on startup of new deployed .war

Hi!

I'm quite new to Geronimo and just tried to deploy an existing application
to it, but got the following trace:

org.apache.catalina.LifecycleException: Failed to start component
[StandardEngine[Catalina].StandardHost[0.0.0.0].StandardContext[/WebApp_ID]]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
	at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:895)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:871)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
	at
org.apache.geronimo.tomcat.TomcatContainer.addContext(TomcatContainer.java:310)
	at
org.apache.geronimo.tomcat.TomcatWebAppContext.doStart(TomcatWebAppContext.java:567)
	at
org.apache.geronimo.gbean.runtime.GBeanInstance.createInstance(GBeanInstance.java:1000)
	at
org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart(GBeanInstanceState.java:271)
	at
org.apache.geronimo.gbean.runtime.GBeanInstanceState.start(GBeanInstanceState.java:105)
	at
org.apache.geronimo.gbean.runtime.GBeanInstance.start(GBeanInstance.java:555)
	at
org.apache.geronimo.gbean.runtime.GBeanDependency.attemptFullStart(GBeanDependency.java:110)
	at
org.apache.geronimo.gbean.runtime.GBeanDependency.addTarget(GBeanDependency.java:145)
	at
org.apache.geronimo.gbean.runtime.GBeanDependency$1.running(GBeanDependency.java:119)
	at
org.apache.geronimo.kernel.basic.BasicLifecycleMonitor.fireRunningEvent(BasicLifecycleMonitor.java:176)
	at
org.apache.geronimo.kernel.basic.BasicLifecycleMonitor.access$300(BasicLifecycleMonitor.java:45)
	at
org.apache.geronimo.kernel.basic.BasicLifecycleMonitor$RawLifecycleBroadcaster.fireRunningEvent(BasicLifecycleMonitor.java:254)
	at
org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart(GBeanInstanceState.java:301)
	at
org.apache.geronimo.gbean.runtime.GBeanInstanceState.start(GBeanInstanceState.java:105)
	at
org.apache.geronimo.gbean.runtime.GBeanInstanceState.startRecursive(GBeanInstanceState.java:127)
	at
org.apache.geronimo.gbean.runtime.GBeanInstance.startRecursive(GBeanInstance.java:569)
	at
org.apache.geronimo.kernel.basic.BasicKernel.startRecursiveGBean(BasicKernel.java:386)
	at
org.apache.geronimo.kernel.config.ConfigurationUtil.startConfigurationGBeans(ConfigurationUtil.java:466)
	at
org.apache.geronimo.kernel.config.KernelConfigurationManager.start(KernelConfigurationManager.java:225)
	at
org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:710)
	at
org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:689)
	at
org.apache.geronimo.deployment.plugin.local.StartCommand.run(StartCommand.java:67)
	at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/LogManager
	at
at.gv.bmi.zps.application.ApplicationInitializer.<clinit>(ApplicationInitializer.java:22)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:247)
	at org.apache.xbean.recipe.RecipeHelper.loadClass(RecipeHelper.java:52)
	at org.apache.xbean.recipe.ObjectRecipe.getType(ObjectRecipe.java:353)
	at
org.apache.xbean.recipe.ObjectRecipe.internalCreate(ObjectRecipe.java:266)
	at org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:96)
	at org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:61)
	at org.apache.geronimo.j2ee.annotation.Holder.newInstance(Holder.java:180)
	at
org.apache.geronimo.tomcat.TomcatInstanceManager.newInstance(TomcatInstanceManager.java:64)
	at
org.apache.catalina.core.ApplicationContext.addListener(ApplicationContext.java:1292)
	at
org.apache.catalina.core.ApplicationContextFacade.addListener(ApplicationContextFacade.java:644)
	at
org.apache.geronimo.web.assembler.Assembler.addListener(Assembler.java:57)
	at org.apache.geronimo.web.assembler.Assembler.assemble(Assembler.java:50)
	at
org.apache.geronimo.tomcat.BaseGeronimoContextConfig.configureStart(BaseGeronimoContextConfig.java:94)
	at
org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:345)
	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:5161)
	at
org.apache.geronimo.tomcat.GeronimoStandardContext.access$201(GeronimoStandardContext.java:121)
	at
org.apache.geronimo.tomcat.GeronimoStandardContext$SystemMethodValve.invoke(GeronimoStandardContext.java:722)
	at
org.apache.geronimo.tomcat.valve.GeronimoBeforeAfterValve.invoke(GeronimoBeforeAfterValve.java:48)
	at
org.apache.geronimo.tomcat.valve.ProtectedTargetValve.invoke(ProtectedTargetValve.java:53)
	at
org.apache.geronimo.tomcat.GeronimoStandardContext.startInternal(GeronimoStandardContext.java:459)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	... 26 more
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.LogManager
	at
org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:467)
	at
org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
	at
org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
	at
org.apache.geronimo.hook.equinox.GeronimoClassLoader.loadClass(GeronimoClassLoader.java:85)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
	... 51 more


Form me it seems that I just have forgotten to configure something
correctly. Classloading? (Log4j is packaged correctly), or do I have do
configure log4j specific. For me this must be a quit common problem and I
hope, someone can give me some hints to solve this.

Regards, Wolfgang



--
View this message in context: http://apache-geronimo.328035.n3.nabble.com/java-lang-ClassNotFoundException-org-apache-log4j-LogManager-on-startup-of-new-deployed-war-tp3986018.html
Sent from the Users mailing list archive at Nabble.com.

Re: java.lang.ClassNotFoundException: org.apache.log4j.LogManager on startup of new deployed .war

Posted by David Jencks <da...@yahoo.com>.
Are you including a Log4j implementation in your app?  Geronimo provides log4j interfaces through pax-logging and the result is that by default you can't use the log4j configuration system in your app.

IIRC you can either use geronimo's log4j (remove the log4j from your app and configure app-speciifc logging as described in the docs  https://cwiki.apache.org/GMOxDOC30/configuring-application-specific-logging-with-log4j.html ) or configure your app to not import the log4j classes.  Unfortunately I don't recall the exact way to exclude the log4j classes, I think you put them in a <hidden-classes> element in the environment in your plan.

hope this helps
david jencks


On Nov 13, 2012, at 9:09 AM, pueffl wrote:

> Hi!
> 
> I'm quite new to Geronimo and just tried to deploy an existing application
> to it, but got the following trace:
> 
> org.apache.catalina.LifecycleException: Failed to start component
> [StandardEngine[Catalina].StandardHost[0.0.0.0].StandardContext[/WebApp_ID]]
> 	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
> 	at
> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:895)
> 	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:871)
> 	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
> 	at
> org.apache.geronimo.tomcat.TomcatContainer.addContext(TomcatContainer.java:310)
> 	at
> org.apache.geronimo.tomcat.TomcatWebAppContext.doStart(TomcatWebAppContext.java:567)
> 	at
> org.apache.geronimo.gbean.runtime.GBeanInstance.createInstance(GBeanInstance.java:1000)
> 	at
> org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart(GBeanInstanceState.java:271)
> 	at
> org.apache.geronimo.gbean.runtime.GBeanInstanceState.start(GBeanInstanceState.java:105)
> 	at
> org.apache.geronimo.gbean.runtime.GBeanInstance.start(GBeanInstance.java:555)
> 	at
> org.apache.geronimo.gbean.runtime.GBeanDependency.attemptFullStart(GBeanDependency.java:110)
> 	at
> org.apache.geronimo.gbean.runtime.GBeanDependency.addTarget(GBeanDependency.java:145)
> 	at
> org.apache.geronimo.gbean.runtime.GBeanDependency$1.running(GBeanDependency.java:119)
> 	at
> org.apache.geronimo.kernel.basic.BasicLifecycleMonitor.fireRunningEvent(BasicLifecycleMonitor.java:176)
> 	at
> org.apache.geronimo.kernel.basic.BasicLifecycleMonitor.access$300(BasicLifecycleMonitor.java:45)
> 	at
> org.apache.geronimo.kernel.basic.BasicLifecycleMonitor$RawLifecycleBroadcaster.fireRunningEvent(BasicLifecycleMonitor.java:254)
> 	at
> org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart(GBeanInstanceState.java:301)
> 	at
> org.apache.geronimo.gbean.runtime.GBeanInstanceState.start(GBeanInstanceState.java:105)
> 	at
> org.apache.geronimo.gbean.runtime.GBeanInstanceState.startRecursive(GBeanInstanceState.java:127)
> 	at
> org.apache.geronimo.gbean.runtime.GBeanInstance.startRecursive(GBeanInstance.java:569)
> 	at
> org.apache.geronimo.kernel.basic.BasicKernel.startRecursiveGBean(BasicKernel.java:386)
> 	at
> org.apache.geronimo.kernel.config.ConfigurationUtil.startConfigurationGBeans(ConfigurationUtil.java:466)
> 	at
> org.apache.geronimo.kernel.config.KernelConfigurationManager.start(KernelConfigurationManager.java:225)
> 	at
> org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:710)
> 	at
> org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:689)
> 	at
> org.apache.geronimo.deployment.plugin.local.StartCommand.run(StartCommand.java:67)
> 	at java.lang.Thread.run(Thread.java:662)
> Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/LogManager
> 	at
> at.gv.bmi.zps.application.ApplicationInitializer.<clinit>(ApplicationInitializer.java:22)
> 	at java.lang.Class.forName0(Native Method)
> 	at java.lang.Class.forName(Class.java:247)
> 	at org.apache.xbean.recipe.RecipeHelper.loadClass(RecipeHelper.java:52)
> 	at org.apache.xbean.recipe.ObjectRecipe.getType(ObjectRecipe.java:353)
> 	at
> org.apache.xbean.recipe.ObjectRecipe.internalCreate(ObjectRecipe.java:266)
> 	at org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:96)
> 	at org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:61)
> 	at org.apache.geronimo.j2ee.annotation.Holder.newInstance(Holder.java:180)
> 	at
> org.apache.geronimo.tomcat.TomcatInstanceManager.newInstance(TomcatInstanceManager.java:64)
> 	at
> org.apache.catalina.core.ApplicationContext.addListener(ApplicationContext.java:1292)
> 	at
> org.apache.catalina.core.ApplicationContextFacade.addListener(ApplicationContextFacade.java:644)
> 	at
> org.apache.geronimo.web.assembler.Assembler.addListener(Assembler.java:57)
> 	at org.apache.geronimo.web.assembler.Assembler.assemble(Assembler.java:50)
> 	at
> org.apache.geronimo.tomcat.BaseGeronimoContextConfig.configureStart(BaseGeronimoContextConfig.java:94)
> 	at
> org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:345)
> 	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:5161)
> 	at
> org.apache.geronimo.tomcat.GeronimoStandardContext.access$201(GeronimoStandardContext.java:121)
> 	at
> org.apache.geronimo.tomcat.GeronimoStandardContext$SystemMethodValve.invoke(GeronimoStandardContext.java:722)
> 	at
> org.apache.geronimo.tomcat.valve.GeronimoBeforeAfterValve.invoke(GeronimoBeforeAfterValve.java:48)
> 	at
> org.apache.geronimo.tomcat.valve.ProtectedTargetValve.invoke(ProtectedTargetValve.java:53)
> 	at
> org.apache.geronimo.tomcat.GeronimoStandardContext.startInternal(GeronimoStandardContext.java:459)
> 	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
> 	... 26 more
> Caused by: java.lang.ClassNotFoundException: org.apache.log4j.LogManager
> 	at
> org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:467)
> 	at
> org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
> 	at
> org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
> 	at
> org.apache.geronimo.hook.equinox.GeronimoClassLoader.loadClass(GeronimoClassLoader.java:85)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
> 	... 51 more
> 
> 
> Form me it seems that I just have forgotten to configure something
> correctly. Classloading? (Log4j is packaged correctly), or do I have do
> configure log4j specific. For me this must be a quit common problem and I
> hope, someone can give me some hints to solve this.
> 
> Regards, Wolfgang
> 
> 
> 
> --
> View this message in context: http://apache-geronimo.328035.n3.nabble.com/java-lang-ClassNotFoundException-org-apache-log4j-LogManager-on-startup-of-new-deployed-war-tp3986018.html
> Sent from the Users mailing list archive at Nabble.com.