Remote EJB lookup from application within JBoss
cirou May 27, 2013 4:21 PMHi guys,
at work we started using JBoss EAP 6.0.0 (Jboss AS 7.1.2 Final) but i'm pretty new to this and now i'm having some troubles to invoke a remote EJB from my application deployed on my JBoss EAP server.
I'll try to be as clear as possible explaining my troubles.
Thanks in advance to who will be so patient to read it all
As first step to figure out how to make it work i created a little standalone app in my eclipse workspace.
After some little troubles I've created a simple project containing the following files "RemoteEJBClient.java", a "jndi.properties" and a "jboss-ejb-client.properties" i've included a jboss-client.jar
In the java class i make a lookup to a remote ejb starting with the "ejb:" prefix
Without getting too much into the details: it works. I can lookup the ejb and i can also invoke its methods.
Then i tried to apply what i learned in my application.
First of all i have to explain you that:
- My application is composed by an ear calling some common methods in my app's custom module.
- The class in the module already lookup for remote ejbs deployed on the same server.
- Now i'm trying to lookup for the remote ejb from the same class, but this ejb is deployed on another server.
Ok, that's the troubles i had:
First Try:
same "jndi.properties" and a "jboss-ejb-client.properties" used for the little test client deployed in the module dir:
Result:
the lookup for the ejbs deployed on my server didn't work anymore cause it points to the remote server
Second Try:
only "jboss-ejb-client.properties" in the module dir, and the properties contained in the jndi file applied in my class java code
Result:
properties are loaded well, context is initialized and pointing to my remote server, but when i try to lookup the ejb (the one with the "ejb:" prefix) i get a NameNotFoundException but... the lookup string is the same working in my test app
I don't know why the second try isn't working.
All the properties seems correct (if i close my vpn client i get a connection error on the context initialization, too)
Actually, I don't even know if this is the right way to do this.
Please, if you can give me some tips to let it work...
Thanks again