2 Replies Latest reply on Oct 10, 2018 11:56 AM by h11sam

    Wildfly 10 - Linkage Error on lookup

    Hugo Silva Newbie

      Hello,

       

      I'm getting this error when executing this code on ctx.lookup. Can you please help? Thanks in advance.

      String ip = LegacyConfig.INST.getSmrEngineIp();

       

        String port = LegacyConfig.INST.getSmrEngineNamingPort();

       

        Properties jndiProps = new Properties();

        jndiProps.put(Context.INITIAL_CONTEXT_FACTORY,        

           "org.jboss.naming.remote.client.InitialContextFactory");

        jndiProps.put(Context.PROVIDER_URL, "http-remoting://" + ip+":"+port); // remote machine IP

        jndiProps.put("jboss.naming.client.ejb.context", true);

          

        InitialContext ctx = new InitialContext(jndiProps);

       

      error when executing ----->  USFFrameworkRemote result = (USFFrameworkRemote)ctx.lookup("APP_USF/USFFrameworkRemoteImp/remote");

       

      The error that I'm getting is:

       

      19:48:41,425 ERROR [org.jboss.as.ejb3.invocation] (default task-6) WFLYEJB0034: EJB Invocation failed on component USFService for method public com.crossjoin.usf.client.types.USFLoginInfo com.crossjoin.xviewer.usf.services.USFService.authenticateGuiUser(java.lang.String,java.lang.String,java.lang.String): javax.ejb.EJBException: java.lang.RuntimeException: java.lang.LinkageError: loader constraint violation: when resolving method "org.jboss.ejb.client.EJBClientContext.registerConnection(Lorg/jboss/remoting3/Connection;)V" the class loader (instance of org/jboss/modules/ModuleClassLoader) of the current class, org/jboss/naming/remote/client/ejb/RemoteNamingStoreEJBClientHandler, and the class loader (instance of org/jboss/modules/ModuleClassLoader) for the method's defining class, org/jboss/ejb/client/EJBClientContext, have different Class objects for the type org/jboss/remoting3/Connection used in the signature

        at org.jboss.as.ejb3.tx.BMTInterceptor.handleException(BMTInterceptor.java:85)

        at org.jboss.as.ejb3.tx.EjbBMTInterceptor.checkStatelessDone(EjbBMTInterceptor.java:91)

        at org.jboss.as.ejb3.tx.EjbBMTInterceptor.handleInvocation(EjbBMTInterceptor.java:106)

        at org.jboss.as.ejb3.tx.BMTInterceptor.processInvocation(BMTInterceptor.java:58)

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

        at org.jboss.as.ee.concurrent.ConcurrentContextInterceptor.processInvocation(ConcurrentContextInterceptor.java:45)

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

        at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

        at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)

        at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:52)

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

        at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51)

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

        at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

        at org.jboss.as.ejb3.component.invocationmetrics.WaitTimeInterceptor.processInvocation(WaitTimeInterceptor.java:47)

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

        at org.jboss.as.ejb3.security.SecurityContextInterceptor.processInvocation(SecurityContextInterceptor.java:100)

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

        at org.jboss.as.ejb3.deployment.processors.StartupAwaitInterceptor.processInvocation(StartupAwaitInterceptor.java:22)

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

        at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64)

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

        at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:67)

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

        at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

        at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:54)

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

        at org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:64)

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

        at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:356)

        at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:636)

        at org.jboss.invocation.AccessCheckingInterceptor.processInvocation(AccessCheckingInterceptor.java:61)

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

        at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:356)

        at org.jboss.invocation.PrivilegedWithCombinerInterceptor.processInvocation(PrivilegedWithCombinerInterceptor.java:80)

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

        at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)

        at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:198)

        at org.jboss.as.webservices.invocation.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:137)

        at org.jboss.wsf.stack.cxf.JBossWSInvoker.performInvocation(JBossWSInvoker.java:169)

        at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)

        at org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.invoke(AbstractJAXWSMethodInvoker.java:232)

        at org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:85)

        at org.jboss.wsf.stack.cxf.JBossWSInvoker.invoke(JBossWSInvoker.java:145)

        at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)

        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)

        at java.util.concurrent.FutureTask.run(Unknown Source)

        at org.apache.cxf.interceptor.ServiceInvokerInterceptor$2.run(ServiceInvokerInterceptor.java:126)

        at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)

        at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:131)

        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)

        at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)

        at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:254)

        at org.jboss.wsf.stack.cxf.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:108)

        at org.jboss.wsf.stack.cxf.transport.ServletHelper.callRequestHandler(ServletHelper.java:134)

        at org.jboss.wsf.stack.cxf.CXFServletExt.invoke(CXFServletExt.java:88)

        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:298)

        at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:217)

        at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)

        at org.jboss.wsf.stack.cxf.CXFServletExt.service(CXFServletExt.java:136)

        at org.jboss.wsf.spi.deployment.WSFServlet.service(WSFServlet.java:140)

        at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)

        at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)

        at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)

        at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)

        at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)

        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

        at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)

        at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)

        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

        at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)

        at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)

        at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)

        at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)

        at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)

        at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)

        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

        at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)

        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

        at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292)

        at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81)

        at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138)

        at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)

        at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)

        at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)

        at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)

        at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)

        at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)

        at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)

        at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)

        at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272)

        at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)

        at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104)

        at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)

        at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:805)

        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

        at java.lang.Thread.run(Unknown Source)

      Caused by: java.lang.RuntimeException: java.lang.LinkageError: loader constraint violation: when resolving method "org.jboss.ejb.client.EJBClientContext.registerConnection(Lorg/jboss/remoting3/Connection;)V" the class loader (instance of org/jboss/modules/ModuleClassLoader) of the current class, org/jboss/naming/remote/client/ejb/RemoteNamingStoreEJBClientHandler, and the class loader (instance of org/jboss/modules/ModuleClassLoader) for the method's defining class, org/jboss/ejb/client/EJBClientContext, have different Class objects for the type org/jboss/remoting3/Connection used in the signature

        ... 102 more

      Caused by: java.lang.LinkageError: loader constraint violation: when resolving method "org.jboss.ejb.client.EJBClientContext.registerConnection(Lorg/jboss/remoting3/Connection;)V" the class loader (instance of org/jboss/modules/ModuleClassLoader) of the current class, org/jboss/naming/remote/client/ejb/RemoteNamingStoreEJBClientHandler, and the class loader (instance of org/jboss/modules/ModuleClassLoader) for the method's defining class, org/jboss/ejb/client/EJBClientContext, have different Class objects for the type org/jboss/remoting3/Connection used in the signature

        at org.jboss.naming.remote.client.ejb.RemoteNamingStoreEJBClientHandler.associate(RemoteNamingStoreEJBClientHandler.java:78)

        at org.jboss.naming.remote.protocol.v1.RemoteNamingStoreV1.<init>(RemoteNamingStoreV1.java:71)

        at org.jboss.naming.remote.protocol.v1.VersionOne.getRemoteNamingStore(VersionOne.java:50)

        at org.jboss.naming.remote.protocol.Versions.getRemoteNamingStore(Versions.java:55)

        at org.jboss.naming.remote.client.RemoteContextFactory.createVersionedStore(RemoteContextFactory.java:73)

        at org.jboss.naming.remote.client.HaRemoteNamingStore.failOverSequence(HaRemoteNamingStore.java:202)

        at org.jboss.naming.remote.client.HaRemoteNamingStore.namingStore(HaRemoteNamingStore.java:149)

        at org.jboss.naming.remote.client.HaRemoteNamingStore.namingOperation(HaRemoteNamingStore.java:130)

        at org.jboss.naming.remote.client.HaRemoteNamingStore.lookup(HaRemoteNamingStore.java:272)

        at org.jboss.naming.remote.client.RemoteContext.lookupInternal(RemoteContext.java:104)

        at org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:93)

        at org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:146)

        at javax.naming.InitialContext.lookup(Unknown Source)

        at javax.naming.InitialContext.lookup(Unknown Source)

        at com.crossjoin.xviewer.usf.USFFacade.getUSFFrameworkRemote(USFFacade.java:76)

        at com.crossjoin.xviewer.usf.services.USFService.authenticateGuiUser(USFService.java:187)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

        at java.lang.reflect.Method.invoke(Unknown Source)

        at org.jboss.as.ee.component.ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptor.java:52)

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

        at org.jboss.as.ejb3.component.invocationmetrics.ExecutionTimeInterceptor.processInvocation(ExecutionTimeInterceptor.java:43)

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

        at org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:47)

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

        at org.jboss.as.ejb3.tx.EjbBMTInterceptor.handleInvocation(EjbBMTInterceptor.java:103)

        ... 99 more

        • 1. Re: Wildfly 10 - Linkage Error on lookup
          Jason Glass Newbie

          While this is an old question, I'll try and answer it in case other people run into similar problems.  I get this exception sometimes daily and other times weekly.  It's because I've bundled the jboss-client-7.2.0.Final.jar with my application because the application needs to send to a JBoss EAP 6 JMS queue which uses HornetQ instead of ActiveMQ Artemis.  I know you're not supposed to deploy/bundle jboss-client-7.2.0.Final.jar in your application, its only supposed to be used in standalone pojo/non JBoss applications but it was the only way I could get things working.  As stated, the application will send the JMS's fine for anywhere from a day to a week and then JBoss appears to no longer honor my JBoss-deployment-structure messaging exclusions and instead starts using its own newer version of the jboss client jar - or its own version of remoting.

           

          TLDR; - you shouldnt deploy jboss-client-7.2.0.Final.jar within an application deployed within JBoss, well at least if it's  JBoss EAP 7/Wildfly 10 or higher.

           

          Hope this possibly helps someone - I'm still stuck though trying to figure out how to get this to work O_o

          • 2. Re: Wildfly 10 - Linkage Error on lookup
            h11sam Newbie

            Hi Jason,

             

            Hope this helps. But when I got the linkage error. I removed any JBoss jars from the application's library and then in the standalone.xml added the remoting module as a global module in there.

            Adding in the lines to the subsystem '<subsystem xmlns="urn:jboss:domain:ee:1.2">':
            <global-modules>
            module name="org.jboss.remote-naming" slot="main"/>
            <global-modules>

             

             

            Or you could add a jboss-deployment-structure.xml in your META-INF folder or WEB-INF if a web app with this in:

            <jboss-deployment-structure>
              <deployment>
                <dependencies>
                  <module name="org.jboss.remote-naming" />
                </dependencies>
              </deployment>
            </jboss-deployment-structure>
            Hope that makes sense