2 Replies Latest reply on Dec 28, 2012 11:00 AM by jrantav

    Porting from JBoss5.1 to JBoss7.1.1 - javax.naming.NamingException can't be found

    Dejan Stefanovic Newbie

      I am trying to port JEE application from JBoss 5.1 where it works for some time now to JBoss 7.1.1. Problem that I am facing now is related to different approach in class loading on JBoss7, which I am solving by creating my own module which contains libraries that are uses by my application. After solving several dependencies this way,  following failure occurred:

       

      {code}

      10:40:23,042 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC00001: Failed to start service jboss.deployment.unit."server-backend.jar".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."server-backend.jar".POST_MODULE: Failed to process phase POST_MODULE of deployment "server-backend.jar"

          at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_19]

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_19]

          at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_19]

      Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS014402: Could not merge data for DeviceEJB

          at org.jboss.as.ejb3.deployment.processors.merging.AbstractMergingProcessor.deploy(AbstractMergingProcessor.java:75)

          at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]

          ... 5 more

      Caused by: java.lang.RuntimeException: Error getting reflective information for interface com.device.tracker.emr.server.enterprisebeans.interfaces.IDeviceEJB with ClassLoader ModuleClassLoader for Module "com.device.tracker:main" from local module loader @faa550 (roots: D:\Projects\SV\jboss-as-7.1.1.Final\modules)

          at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:70) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.as.ee.metadata.MethodAnnotationAggregator.runtimeAnnotationInformation(MethodAnnotationAggregator.java:58)

          at org.jboss.as.ejb3.deployment.processors.merging.TransactionAttributeMergingProcessor.processTransactionAttributeAnnotation(TransactionAttributeMergingProcessor.java:91)

          at org.jboss.as.ejb3.deployment.processors.merging.TransactionAttributeMergingProcessor.handleAnnotations(TransactionAttributeMergingProcessor.java:81)

          at org.jboss.as.ejb3.deployment.processors.merging.AbstractMergingProcessor.processComponentConfig(AbstractMergingProcessor.java:91)

          at org.jboss.as.ejb3.deployment.processors.merging.AbstractMergingProcessor.deploy(AbstractMergingProcessor.java:73)

          ... 6 more

      Caused by: java.lang.NoClassDefFoundError: javax/naming/NamingException

          at java.lang.Class.getDeclaredMethods0(Native Method) [rt.jar:1.6.0_19]

          at java.lang.Class.privateGetDeclaredMethods(Class.java:2427) [rt.jar:1.6.0_19]

          at java.lang.Class.getDeclaredMethods(Class.java:1791) [rt.jar:1.6.0_19]

          at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:65) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:66) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]

          ... 11 more

      Caused by: java.lang.ClassNotFoundException: javax.naming.NamingException from [Module "com.device.tracker:main" from local module loader @faa550 (roots: D:\Projects\SV\jboss-as-7.1.1.Final\modules)]

          at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)

          at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)

          at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)

          at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)

          at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)

          at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)

          ... 16 more

      {code}

       

      Problem here is that reported class javax.naming.NamingException is defined in rt.jar, which is part of the java installation and is not defined as implicit dependency. Just for the test, I added rt.jar to my module, and problem dissapppeared. However, this does not seem like proper solution for me.

      How this could be done in a better  way?