[jboss-as7-dev] Remote JNDI lookup from the messaging subsystem

David M. Lloyd david.lloyd at redhat.com
Tue May 22 12:51:40 EDT 2012


Looks like it must be a missing dependency from remote.naming to 
ejb.client.  Not sure why it wouldn't have come up sooner though - 
perhaps you're attempting to use the autoconfig API which isn't 
appropriate for in-AS usage?

On 05/22/2012 11:14 AM, Jeff Mesnil wrote:
> Hi,
>
> I'm working on a task to add managed JMS bridges to AS7 and needs some
> help with modules loading and dependencies.
>
> A JMS bridge is a piece of code provided by HornetQ that allows to
> consume messages from one "source" broker (often a legacy or proprietary
> broker) to another "target" broker (e.g. HornetQ).
> It is completely separated from HornetQ JMS implementation and relies
> only on JavaEE APIs (JNDI, JMS, JTA).
>
> I got something working using the simplest case possible: both the
> source and target brokers are the AS7 instance where the JMS bridge is
> deployed. It's useless but it's a start :)
>
> The 3 use cases that are useful are:
> 1. setup the source broker to be another AS7 instance
> 2. setup the source broker to be an older AS version (e.g. for updates)
> 3. setup the source broker to be *any other JMS implementation* (e.g.
> for migration)
>
> I'm having some issues with the use cases dealing with JNDI setup and
> modules.
>
> For all 3 use cases, the JMS bridge code (coming from HornetQ)
> instantiates a JNDI InitialContext with configurable properties to
> lookup the source and destination JMS resources.
> I got it working when everything is in the same AS7 instance.
>
> However, it doesn't when I am looking up from another AS7 instance using
> our JNDI remote: protocol. It's failing because  org.jboss.as.messaging
> is not able to load org.jboss.remote.naming classes. I added
> org.jboss.remote-naming to the messaging modules.xml but it is not
> enough. I now get a linkage error (cf at the end of my mail)
>
> Basically my problem is do be able to do a remote JNDI lookup from
> inside an AS7 service. There is some documentation to do that for EJBs
> with outbound socket bindings[2]. I could make it work to lookup from
> another AS7 instance but it's not general enough. In real use case, the
> lookup will be to another broker (or an older AS version) with its own
> set of classes that needs to be isolated from the rest of the messaging
> service.
>
> Does someone have a pointer that could help? Have we another AS7 service
> doing something similar?
>
> btw, the documentation about modules[1] displays nothing: "Latest
> content for this page is not approved!"
>
> thanks,
> jeff
>
>
> [1]: https://docs.jboss.org/author/display/MODULES/Specifying+dependencies
> [2]:
> https://docs.jboss.org/author/display/AS71/EJB+invocations+from+a+remote+server+instance
> The linkage error:
>
>
> 17:39:45,979 WARN  [org.jboss.modules] (MSC service thread 1-5) Failed
> to define class
> org.jboss.naming.remote.client.ejb.RemoteNamingEjbClientContextSelector
> in Module "org.jboss.remote-naming:main" from local module loader
> @851052d (roots:
> /home/jmesnil/Developer/jboss-as/build/target/jboss-as-7.2.0.Alpha1-SNAPSHOT/modules):
> java.lang.LinkageError: Failed to link
> org/jboss/naming/remote/client/ejb/RemoteNamingEjbClientContextSelector
> (Module "org.jboss.remote-naming:main" from local module loader @851052d
> (roots:
> /home/jmesnil/Developer/jboss-as/build/target/jboss-as-7.2.0.Alpha1-SNAPSHOT/modules))
>           at
> org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:396)
>           at
> org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:243)
>           at
> org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:73)
>           at org.jboss.modules.Module.loadModuleClass(Module.java:527)
>           at
> org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:182)
>           at
> org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
>           at
> org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
>           at
> org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
>           at
> org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
>           at
> org.jboss.naming.remote.client.InitialContextFactory.<clinit>(InitialContextFactory.java:118)
> [jboss-remote-naming-1.0.3.Final.jar:1.0.3.Final]
>           at java.lang.Class.forName0(Native Method) [rt.jar:1.6.0_24]
>           at java.lang.Class.forName(Class.java:264) [rt.jar:1.6.0_24]
>           at
> org.jboss.as.naming.InitialContextFactoryBuilder.createInitialContextFactory(InitialContextFactoryBuilder.java:61)
> [jboss-as-naming-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]
>           at
> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:681)
> [rt.jar:1.6.0_24]
>           at
> javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:305)
> [rt.jar:1.6.0_24]
>           at javax.naming.InitialContext.init(InitialContext.java:240)
> [rt.jar:1.6.0_24]
>           at javax.naming.InitialContext.<init>(InitialContext.java:214)
> [rt.jar:1.6.0_24]
>           at
> org.hornetq.jms.bridge.impl.JNDIFactorySupport.createObject(JNDIFactorySupport.java:55)
> [hornetq-jms-2.2.16.Final.jar:2.2.16.Final (HQ_2_2_16_FINAL, 122)]
>           at
> org.hornetq.jms.bridge.impl.JNDIDestinationFactory.createDestination(JNDIDestinationFactory.java:40)
> [hornetq-jms-2.2.16.Final.jar:2.2.16.Final (HQ_2_2_16_FINAL, 122)]
>           at
> org.hornetq.jms.bridge.impl.JMSBridgeImpl.setupJMSObjects(JMSBridgeImpl.java:1083)
> [hornetq-jms-2.2.16.Final.jar:2.2.16.Final (HQ_2_2_16_FINAL, 122)]
>           at
> org.hornetq.jms.bridge.impl.JMSBridgeImpl.start(JMSBridgeImpl.java:348)
> [hornetq-jms-2.2.16.Final.jar:2.2.16.Final (HQ_2_2_16_FINAL, 122)]
>           at
> org.jboss.as.messaging.jms.bridge.JMSBridgeService.start(JMSBridgeService.java:57)
> [jboss-as-messaging-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]
>           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.runWorker(ThreadPoolExecutor.java:1110)
> [rt.jar:1.6.0_24]
>           at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
> [rt.jar:1.6.0_24]
>           at java.lang.Thread.run(Thread.java:679) [rt.jar:1.6.0_24]
> Caused by: java.lang.NoClassDefFoundError:
> org/jboss/ejb/client/ContextSelector
>           at java.lang.ClassLoader.defineClass1(Native Method)
> [rt.jar:1.6.0_24]
>           at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
> [rt.jar:1.6.0_24]
>           at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
> [rt.jar:1.6.0_24]
>           at
> org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:327)
>           at
> org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:391)
>           ... 26 more
> Caused by: java.lang.ClassNotFoundException:
> org.jboss.ejb.client.ContextSelector from [Module
> "org.jboss.remote-naming:main" from local module loader @851052d (roots:
> /home/jmesnil/Developer/jboss-as/build/target/jboss-as-7.2.0.Alpha1-SNAPSHOT/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.performLoadClassChecked(ConcurrentClassLoader.java:423)
>           at
> org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
>           at
> org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
>           ... 31 more
>
>
>
>
>


-- 
- DML


More information about the jboss-as7-dev mailing list