Meaningless Drivel is fun!
The moose likes EJB and other Java EE Technologies and the fly likes Getting remote EJB when asking for local Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Getting remote EJB when asking for local" Watch "Getting remote EJB when asking for local" New topic

Getting remote EJB when asking for local

Etienne Labuschagne

Joined: Oct 18, 2007
Posts: 7

First, this post has nothing to do with remote INTERFACE vs local. It's about a local JBoss speaking to a remote JBoss (non-clustered setup).

The local JBoss has a JMX Bean that acts as a client and a stateless session bean, let's call it WorkerBean. The second JBoss also has WorkerBean deployed on it.

Code in the JMX decides if it need to use the local WorkerBean or the one deployed on the remote server. This code creates a context object with the provider url pointing either to localhost, or the remote JBoss' address.

My problem is, I always get the local WorkerBean, even if I explicitly ask for the remote one. If I undeploy WorkerBean from the local server, I get the remote one. So it's NOT a communication problem to the remote server as it works, as long as the bean is not deployed locally.

I am probably missing something fundamental regarding using JNDI to get hold of my beans. I do not think this is JBoss specific (though I haven't tested on another server), but rather me doing something wrong - probably JNDI wise.

I have set up a test project that I can provide, replicating this problem.

Code in JMX bean that creates the context and looks up the bean:

Father of many
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33124

Welcome to JavaRanch!

I don't currently use JBoss, but I think this might be app server specific. The host portions of JNDI names tend to vary by app server. I'm going to move this to JBoss. The moderators there can move it back to EJB if I am wrong.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
subject: Getting remote EJB when asking for local
It's not a secret anymore!