• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Web module deployment in Glassfish not able to find log4j classes

 
Greenhorn
Posts: 19
Hibernate Eclipse IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I tried to deploy a web application which uses log4j in glassfish application server. The application was not deployed due to its in ablitiy to find the log4j classes. Following is the portion of the stack trace....

java.lang.ExceptionInInitializerError
at org.springframework.web.context.ContextLoaderListener.createContextLoader(Unknown Source)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(Unknown Source)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4632)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:5312)
at com.sun.enterprise.web.WebModule.start(WebModule.java:353)
at com.sun.enterprise.web.LifecycleStarter.doRun(LifecycleStarter.java:58)
at com.sun.appserv.management.util.misc.RunnableBase.runSync(RunnableBase.java:304)
at com.sun.appserv.management.util.misc.RunnableBase.run(RunnableBase.java:341)
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:885)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.apache.commons.logging.LogConfigurationException: java.lang.reflect.InvocationTargetException
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:532)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:272)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:246)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:395)
at org.springframework.web.context.ContextLoader.<clinit>(Unknown Source)
... 14 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:525)
... 18 more
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.apache.log4j.Logger
at org.apache.commons.logging.impl.Log4JLogger.<init>(Log4JLogger.java:102)
... 23 more
|#]

[#|2010-04-11T23:52:58.375+0200|SEVERE|sun-appserver2.1|org.apache.catalina.core.StandardContext|_ThreadID=11;_ThreadName=pool-1-thread-7;_RequestID=30875be4-dcd8-4164-860e-bdc10ad15623;|PWC1306: Startup of context /ps2facade failed due to previous errors|#]

[#|2010-04-11T23:52:58.421+0200|INFO|sun-appserver2.1|javax.enterprise.system.stream.out|_ThreadID=11;_ThreadName=pool-1-thread-7;|
classLoader = WebappClassLoader
delegate: true
repositories:
/WEB-INF/classes/
----------> Parent Classloader:
EJBClassLoader :
urlSet = []
doneCalled = false
Parent -> java.net.URLClassLoader@3468f4
------------------------------------------------------------------------
I am using Sun GlassFish Enterprise Server v2.1.
The webapplication which i am trying to deploy has the log4j jar in its WEB-INF/lib folder. I am not sure why glassfish is failing to deploy the application where as its working fine in tomcat5.5.
since its very urgent someone please help me.
Thanks
J Suk
 
Bartender
Posts: 1210
25
Android Python PHP C++ Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is common-logging jar also available under WEB-INF/lib?
 
J Suk
Greenhorn
Posts: 19
Hibernate Eclipse IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply.
commons-logging-1.1.1.jar is also there in the WEB-INF/lib folder.
is there anything else I am missing...???

J Suk
 
Karthik Shiraly
Bartender
Posts: 1210
25
Android Python PHP C++ Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just a guess, but such differences in behaviour between two servers with the same war, is usually due to differences in their ClassLoader hierarchies. Maybe you can try putting all dependencies, including spring fw, in WEB-INF/lib. And ensure these jars are not duplicated in GLASSFISH/lib or GLASSFISH/domains/domain1/lib.
 
J Suk
Greenhorn
Posts: 19
Hibernate Eclipse IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Already the WEB-INF/lib contains all the Spring fw jars and I checked thre is not duplication of these jars in glassfish lib folders.
still its the same stack trace.
 
This will take every ounce of my mental strength! All for a tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!