Geronimo
  1. Geronimo
  2. GERONIMO-6419

java.lang.NoClassDefFoundError: org/apache/log4j/CategoryKey

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 3.0.0
    • Fix Version/s: None
    • Component/s: Logging
    • Security Level: public (Regular issues)
    • Labels:
      None
    • Environment:

      Windows xp professional,eclipse3.6, jdk1.6.0_21, Geronimo 3.0.0, log4j-1.2.15.jar

      Description

      My EAR contains a Web project and a EJB project, I put a log4j-1.2.15.jar in the EAR/EarContent/lib directoty, and use the org.apache.log4j.Logger in the Web project,it works ok,but if i refer org.apache.log4j.Logger in the EJB project,i could not deploy the EAR project to the Geronimo3.0
      log message is as follows:
      java.lang.NoClassDefFoundError: org/apache/log4j/CategoryKey
      at org.apache.log4j.Hierarchy.getLogger(Hierarchy.java:262)
      at org.apache.log4j.Hierarchy.getLogger(Hierarchy.java:243)
      at org.apache.log4j.LogManager.getLogger(LogManager.java:199)
      at org.apache.log4j.Logger.getLogger(Logger.java:118)
      at sampleear.MyStatelessSessionBean.<clinit>(MyStatelessSessionBean.java:19)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:247)
      at org.apache.openejb.util.Classes.forName(Classes.java:62)
      at org.apache.openejb.config.rules.ValidationBase.loadClass(ValidationBase.java:139)
      at org.apache.openejb.config.rules.CheckMethods.check_unusedCreateMethods(CheckMethods.java:305)
      at org.apache.openejb.config.rules.CheckMethods.validate(CheckMethods.java:52)
      at org.apache.openejb.config.rules.ValidationBase.validate(ValidationBase.java:45)
      at org.apache.openejb.config.AppValidator.validate(AppValidator.java:88)
      at org.apache.openejb.config.ValidateModules.deploy(ValidateModules.java:29)
      at org.apache.openejb.config.ConfigurationFactory$Chain.deploy(ConfigurationFactory.java:263)
      at org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:692)
      at org.apache.geronimo.openejb.deployment.EjbModuleBuilder.configureApplication(EjbModuleBuilder.java:966)
      at org.apache.geronimo.openejb.deployment.EjbModuleBuilder.getAppInfo(EjbModuleBuilder.java:886)
      at org.apache.geronimo.openejb.deployment.EjbModuleBuilder.doInitContext(EjbModuleBuilder.java:796)
      at org.apache.geronimo.openejb.deployment.EjbModuleBuilder.initContext(EjbModuleBuilder.java:775)
      at org.apache.geronimo.j2ee.deployment.EARConfigBuilder.buildConfiguration(EARConfigBuilder.java:686)
      at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:256)
      at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:140)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.apache.geronimo.gbean.runtime.ReflectionMethodInvoker.invoke(ReflectionMethodInvoker.java:34)
      at org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:131)
      at org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:883)
      at org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:245)
      at org.apache.geronimo.kernel.KernelGBean.invoke(KernelGBean.java:344)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.apache.geronimo.gbean.runtime.ReflectionMethodInvoker.invoke(ReflectionMethodInvoker.java:34)
      at org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:131)
      at org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:883)
      at org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:245)
      at org.apache.geronimo.system.jmx.MBeanGBeanBridge.invoke(MBeanGBeanBridge.java:172)
      at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
      at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
      at com.sun.jmx.remote.security.MBeanServerAccessController.invoke(MBeanServerAccessController.java:447)
      at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1427)
      at javax.management.remote.rmi.RMIConnectionImpl.access$200(RMIConnectionImpl.java:72)
      at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1265)
      at java.security.AccessController.doPrivileged(Native Method)
      at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1367)
      at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:788)
      at sun.reflect.GeneratedMethodAccessor69.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
      at sun.rmi.transport.Transport$1.run(Transport.java:159)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
      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:619)
      Caused by: java.lang.ClassNotFoundException: org.apache.log4j.CategoryKey
      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:248)
      ... 63 more
      2012-11-29 20:46:13,687 INFO [OpenEJB] Auto-deploying ejb MyStatelessSessionBean: EjbDeployment(deployment-id=Geronimo3EJB.jar/MyStatelessSessionBean)
      2012-11-29 20:46:13,703 ERROR [validation] ERROR ... null: Cannot validate jar: org/apache/log4j/CategoryKey
      2012-11-29 20:46:13,703 ERROR [validation] Invalid AppModule(name=Geronimo3EAR, path=default\Geronimo3-ear\1.0\ear)

        Activity

        Hide
        xiezhi added a comment -

        It looks like you have loaded your log4j.jar successfully.I confused there is a org.apache.log4j.CategoryKey.java in the two log4j jar files. It seems a impossible issue.

        Show
        xiezhi added a comment - It looks like you have loaded your log4j.jar successfully.I confused there is a org.apache.log4j.CategoryKey.java in the two log4j jar files. It seems a impossible issue.
        Hide
        Aaron Qian added a comment -

        yes,i add my own log4j.jar to the EAR, which is useful to WAR project,but for EJB project,It failed,so,how to deal with it?

        Show
        Aaron Qian added a comment - yes,i add my own log4j.jar to the EAR, which is useful to WAR project,but for EJB project,It failed,so,how to deal with it?
        Hide
        Ivan added a comment -

        Could you try to configure the hidden-classes in geronimo-application.xml ? With this, it should prevent loading log4j classes from server runtime.

        Show
        Ivan added a comment - Could you try to configure the hidden-classes in geronimo-application.xml ? With this, it should prevent loading log4j classes from server runtime.
        Hide
        xiezhi added a comment -

        I guess he has configure the hidden-classes, and the error log shows the
        server has loaded the log4j-1.2.15.jar.

        2012/12/2 Ivan (JIRA) <jira@apache.org>


        Best Regards
        Gary

        Show
        xiezhi added a comment - I guess he has configure the hidden-classes, and the error log shows the server has loaded the log4j-1.2.15.jar. 2012/12/2 Ivan (JIRA) <jira@apache.org> – Best Regards Gary

          People

          • Assignee:
            Unassigned
            Reporter:
            Aaron Qian
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:

              Development