3 Replies Latest reply on Oct 25, 2013 2:03 PM by devendra sisodia

    remote ejb call EAP 6.1->AS6: NoClassDefFoundError: Could not initialize class org.jnp.interfaces.NamingContext

    devendra sisodia Newbie

      Hello,

      My application has ejb client inside EAP 6.1 that need to invoke remote ejb hosted on Jboss AS6. For this i created module in eap6.1 and in the module.xml file listed resources as all the jars present in JBOSS_HOME/client directory.

      Here i am getting NoClassDefFoundError: Could not initialize class org.jnp.interfaces.NamingContext.

      Quick help will be appreciated.

       

      19:37:40,875 INFO [com.tatacommunications.tp.integration.glowpoint.SdpServicesMediator] (pool-3-thread-14) before InitialContext
      19:37:40,876 ERROR [org.jboss.as.ejb3.invocation] (pool-3-thread-14) JBAS014134: EJB Invocation failed on component GlowpointManagerMBean for method public abstract voi
      d com.tatacommunications.tp.integration.glowpoint.GlowpointManager.synchronize(int): javax.ejb.EJBException: JBAS014580: Unexpected Error
      at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInNoTx(CMTTxInterceptor.java:188) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
      at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInNoTx(CMTTxInterceptor.java:237) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
      at org.jboss.as.ejb3.tx.CMTTxInterceptor.notSupported(CMTTxInterceptor.java:299) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
      at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:212) [jboss-as-ejb3-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]
      at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [jboss-as-ejb3-7.
      2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-2.jar:1.1.1.Final-redhat-2]
      at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64) [jboss-as-ejb3-7.2.0.Final-redhat
      -8.jar:7.2.0.Final-redhat-8]

      ....
      ....
      Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.jnp.interfaces.NamingContext
      at org.jnp.interfaces.NamingContextFactory.getInitialContext(NamingContextFactory.java:55) [jbossjmx-ant.jar:6.0.0.Final]
      at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:684) [rt.jar:1.7.0_21]
      at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:307) [rt.jar:1.7.0_21]
      at javax.naming.InitialContext.init(InitialContext.java:242) [rt.jar:1.7.0_21]
      at javax.naming.InitialContext.(InitialContext.java:216) [rt.jar:1.7.0_21]
      at com.tatacommunications.tp.integration.glowpoint.SdpServicesMediator.getAllocationService(SdpServicesMediator.java:28) [glowpoint-integration-management.jar:]
      at com.tatacommunications.tp.integration.glowpoint.GlowpointManagerMBean.resolveAllocationServiceRemote(GlowpointManagerMBean.java:337) [glowpoint-integration-management.jar:]

       

        • 1. Re: remote ejb call EAP 6.1->AS6: NoClassDefFoundError: Could not initialize class org.jnp.interfaces.NamingContext
          devendra sisodia Newbie

          Approach followed is mentioned here of part and here

          created module for AS6Client jars and copied ALL jars from AS6_HOME/client and created module.xml.  Then using jboss-deployement-structure.xml added dependency to these AS6Client jars.

          Exclusions on module "org.picketbox".

          I have attached module.xml and server logs server.zip

           

          --------------------------------------------------------------------

           

          Because in above approach we are including ALL client jars from AS6 there are some classloading conflicts on cxf package(my application has cxf dependency). AS6Clients jars have one version and EAP 6.1 runtime provides other version. So to resolve this tried to figure out what all client jars are really necessary and i found it here . After doing this I am getting exception like mentioned in attached file  'serverErrorWhenMinClient6JarsUsed.txt'

          • 2. Re: remote ejb call EAP 6.1->AS6: NoClassDefFoundError: Could not initialize class org.jnp.interfaces.NamingContext
            devendra sisodia Newbie

            I added required AS6Client jars to application lib directory then appl is not getting deployed with exception that the jar lib/jboss-ejb3-async-impl.jar file has xml file(lib/jboss-ejb3-async-impl.jar/META-INF/ejb3-async-jboss-beans.xml) that it cannot parse.

             

            09:07:50,645 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service jboss.deployment.unit."glowpoint-integration-ear.ear".PARSE:

            org.jboss.msc.service.StartException in service jboss.deployment.unit."glowpoint-integration-ear.ear".PARSE: JBAS018733: Failed to process phase PARSE of deployment "g

            lowpoint-integration-ear.ear"

                    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:127) [jboss-as-server-7.2.0.Final-redhat-8.jar:7.2.0.Final-re

            dhat-8]

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

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

                    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_21]

                    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_21]

                    at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_21]

            Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS017082: Exception while parsing POJO descriptor file: "/content/glowpoint-integration-ear.ear/lib/jboss-ejb3-async-impl.jar/META-INF/ejb3-async-jboss-beans.xml"

                    at org.jboss.as.pojo.KernelDeploymentParsingProcessor.parseDescriptor(KernelDeploymentParsingProcessor.java:160)

                    at org.jboss.as.pojo.KernelDeploymentParsingProcessor.parseDescriptors(KernelDeploymentParsingProcessor.java:131)

                    at org.jboss.as.pojo.KernelDeploymentParsingProcessor.deploy(KernelDeploymentParsingProcessor.java:88)

                    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:120) [jboss-as-server-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                    ... 5 more

            Caused by: com.ctc.wstx.exc.WstxParsingException: Received non-all-whitespace CHARACTERS or CDATA event in nextTag().

            at [row,col {unknown-source}]: [7,65]

                    at com.ctc.wstx.sr.StreamScanner.constructWfcException(StreamScanner.java:606)

                    at com.ctc.wstx.sr.StreamScanner.throwParseError(StreamScanner.java:479)

                    at com.ctc.wstx.sr.StreamScanner.throwParseError(StreamScanner.java:464)

            ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

            If remove this lib/jboss-ejb3-async-impl.jar then app is deployed successfully but when making context.lookup fails complaining missing jar.

             

            09:03:44,436 ERROR [com.tatacommunications.tp.integration.glowpoint.SdpServicesMediator] (pool-3-thread-36) NamingException: Cannot lookup Bean sdp-services/AllocationS

            erviceRemoteBean/remote in JNDI at 10.133.143.171:1399: javax.naming.NamingException: Could not dereference object [Root exception is java.lang.reflect.UndeclaredThrowa

            bleException]

                    at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1508) [jnp-client.jar:@implementation.version@]

                    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:824) [jnp-client.jar:@implementation.version@]

                    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:688) [jnp-client.jar:@implementation.version@]

                    at javax.naming.InitialContext.lookup(InitialContext.java:411) [rt.jar:1.7.0_21]

                    at com.tatacommunications.tp.integration.glowpoint.SdpServicesMediator.getAllocationService(SdpServicesMediator.java:30) [glowpoint-integration-management.jar:]

                    at com.tatacommunications.tp.integration.glowpoint.GlowpointManagerMBean.resolveAllocationServiceRemote(GlowpointManagerMBean.java:337) [glowpoint-integration-m

            anagement.jar:]

            .......

            .......

            Caused by: java.lang.reflect.UndeclaredThrowableException

                    at com.sun.proxy.$Proxy209.createProxyBusiness(Unknown Source)

                    at org.jboss.ejb3.proxy.impl.objectfactory.session.SessionProxyObjectFactory.createProxy(SessionProxyObjectFactory.java:129) [jboss-ejb3-proxy-impl-client.jar:6.0.0.Final]

                    at org.jboss.ejb3.proxy.impl.objectfactory.session.stateless.StatelessSessionProxyObjectFactory.getProxy(StatelessSessionProxyObjectFactory.java:79) [jboss-ejb3-proxy-impl-client.jar:6.0.0.Final]

                    at org.jboss.ejb3.proxy.impl.objectfactory.ProxyObjectFactory.getObjectInstance(ProxyObjectFactory.java:161) [jboss-ejb3-proxy-impl-client.jar:6.0.0.Final]

                    at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:300) [rt.jar:1.7.0_21]

                    at org.jnp.interfaces.NamingContext.getObjectInstance(NamingContext.java:1483) [jnp-client.jar:@implementation.version@]

                    at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1500) [jnp-client.jar:@implementation.version@]

                    ... 71 more

            Caused by: java.lang.ClassNotFoundException: org.jboss.ejb3.async.impl.interceptor.AsynchronousClientInterceptor

                    at org.jboss.remoting.serialization.ClassLoaderUtility.loadClass(ClassLoaderUtility.java:103) [jboss-remoting.jar:6.0.0.Final]

                    at org.jboss.remoting.loading.RemotingClassLoader.loadClass(RemotingClassLoader.java:94) [jboss-remoting.jar:6.0.0.Final]

                    at java.lang.Class.forName0(Native Method) [rt.jar:1.7.0_21]

                    at java.lang.Class.forName(Class.java:266) [rt.jar:1.7.0_21]

            :

            • 3. Re: remote ejb call EAP 6.1->AS6: NoClassDefFoundError: Could not initialize class org.jnp.interfaces.NamingContext
              devendra sisodia Newbie

              For successfully communicating between EAP 6.1 installed ejb client with AS6 installed ejb following is what I found to work:

              1. Remove jboss-ejb3-async-impl.jar/META-INF/ejb3-async-jboss-beans.xml and package jboss-ejb3-async-impl.jar. Without removing the xml file deployment fails with exception “Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS017082: Exception while parsing POJO descriptor file: "/content/glowpoint-integration-ear.ear/lib/jboss-ejb3-async-impl.jar/META-INF/ejb3-async-jboss-beans.xml"”

              It is a hack that worked for me.

              2. exclusion for <module name="org.picketbox" slot="main"/> in <APP>/META-INF/jboss-deployment-structure.xml

              3. put all jars mentioned in attached module.xml into lib of application.

              <resource-root path="concurrent.jar"/>

              <resource-root path="jboss-aop-client.jar"/>

              <resource-root path="jboss-aspect-jdk50-client.jar"/>

              <resource-root path="jboss-common-core.jar"/>

              <resource-root path="jboss-ejb3-async-impl"/>

              <resource-root path="jboss-ejb3-async-spi.jar"/>

              <resource-root path="jboss-ejb3-common-client.jar"/>

              <resource-root path="jboss-ejb3-context-spi"/>

              <resource-root path="jboss-ejb3-core-client.jar"/>

              <resource-root path="jboss-ejb3-proxy-impl-client.jar"/>

              <resource-root path="jboss-ejb3-proxy-spi-client.jar"/>

              <resource-root path="jboss-ejb3-security-client.jar"/>

              <resource-root path="jboss-integration.jar"/>

              <resource-root path="jboss-metadata-ear.jar"/>

              <resource-root path="jboss-remoting.jar"/>

              <resource-root path="jboss-security-spi.jar"/>

              <resource-root path="jboss-serialization.jar"/>

              <resource-root path="jbosssx-client.jar"/>

              <resource-root path="jnp-client.jar"/>

               


              Note: if you are getting security classcast exception like  " java.lang.ClassCastException: org.jboss .security.plugins.JBossSecurityContext cannot be cast to org.jboss.security.SecurityContext" then step 2(above) and restarting the server should help.