quality@glassfish.java.net

Errors with Log4J

From: Jose Noheda <jose.noheda_at_gmail.com>
Date: Sun, 31 Aug 2008 18:08:47 +0200

Hi,

I'm getting this trace when deploying IWebMvc:

GRAVE: Exception in command execution :
java.lang.ExceptionInInitializerError
java.lang.ExceptionInInitializerError
        at org.hibernate.util.ReflectHelper.<clinit>(ReflectHelper.java:23)
        at
org.hibernate.ejb.Ejb3Configuration.classForName(Ejb3Configuration.java:1041)
        at
org.hibernate.ejb.Ejb3Configuration.addNamedAnnotatedClasses(Ejb3Configuration.java:1113)
        at
org.hibernate.ejb.Ejb3Configuration.addClassesToSessionFactory(Ejb3Configuration.java:905)
        at
org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:792)
        at
org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:416)
        at
org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:126)
        at
org.glassfish.persistence.jpa.JPAApplication.loadPU(JPAApplication.java:183)
        at
org.glassfish.persistence.jpa.JPAApplication.loadAllPus(JPAApplication.java:139)
        at
org.glassfish.persistence.jpa.JPAApplication.<init>(JPAApplication.java:86)
        at
org.glassfish.persistence.jpa.JPADeployer.prepare(JPADeployer.java:108)
        at
com.sun.enterprise.v3.server.ApplicationLifecycle.prepare(ApplicationLifecycle.java:556)
        at
com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:263)
        at
com.sun.enterprise.v3.deployment.DeployCommand.execute(DeployCommand.java:279)
        at
com.sun.enterprise.v3.admin.CommandRunner.doCommand(CommandRunner.java:286)
        at
com.sun.enterprise.v3.admin.CommandRunner.doCommand(CommandRunner.java:114)
        at
com.sun.enterprise.v3.admin.CommandRunner.doCommand(CommandRunner.java:94)
        at
com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:240)
        at
com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:166)
        at
com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:147)
        at
com.sun.grizzly.http.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:621)
        at
com.sun.grizzly.http.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:552)
        at
com.sun.grizzly.http.DefaultProcessorTask.process(DefaultProcessorTask.java:800)
        at
com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:152)
        at
com.sun.enterprise.v3.services.impl.HttpProtocolFilter.execute(HttpProtocolFilter.java:82)
        at
com.sun.enterprise.v3.services.impl.GlassfishProtocolChain.executeProtocolFilter(GlassfishProtocolChain.java:70)
        at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:103)
        at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:89)
        at
com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:67)
        at
com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:56)
        at
com.sun.grizzly.util.WorkerThreadImpl.processTask(WorkerThreadImpl.java:309)
        at
com.sun.grizzly.util.WorkerThreadImpl.run(WorkerThreadImpl.java:168)
Caused by: org.apache.commons.logging.LogConfigurationException:
org.apache.commons.logging.LogConfigurationException: No suitable Log
constructor
        at
org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:509)
        at
org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:285)
        at
org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:255)
        at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:381)
        at
org.hibernate.property.BasicPropertyAccessor.<clinit>(BasicPropertyAccessor.java:26)
        ... 32 more
Caused by: org.apache.commons.logging.LogConfigurationException: No suitable
Log constructor
        at
org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:420)
        at
org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:502)
        ... 36 more
Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Category
        at java.lang.Class.getDeclaredConstructors0(Native Method)
        at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
        at java.lang.Class.getConstructor0(Class.java:2699)
        at java.lang.Class.getConstructor(Class.java:1657)
        at
org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:417)
        ... 37 more
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Category
        at
org.apache.felix.framework.searchpolicy.R4SearchPolicyCore.findClass(R4SearchPolicyCore.java:200)
        at
org.apache.felix.framework.searchpolicy.R4SearchPolicy.findClass(R4SearchPolicy.java:45)
        at
org.apache.felix.framework.searchpolicy.ContentClassLoader.loadClass(ContentClassLoader.java:109)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
        ... 42 more
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Category
        at
org.apache.felix.framework.searchpolicy.R4SearchPolicyCore.findClassOrResource(R4SearchPolicyCore.java:488)
        at
org.apache.felix.framework.searchpolicy.R4SearchPolicyCore.findClass(R4SearchPolicyCore.java:187)
        ... 46 more

Log4J 1.2.14 is included with the WAR inside the WEB-INF/lib dir. Good
points while deploying where:

1) sun-resources was recognized and applied correctly (and the pool was
created)
2) JPA entities were detected
3) Hibernate Entity Manager was loaded

Regards,