[jboss-user] [JNDI and Naming] - How to call an remote interface in ear from stand-alone sar (MBean)

busters do-not-reply at jboss.com
Tue Nov 15 04:57:49 EST 2011


busters [http://community.jboss.org/people/busters] created the discussion

"How to call an remote interface in ear from stand-alone sar (MBean)"

To view the discussion, visit: http://community.jboss.org/message/636569#636569

--------------------------------------------------------------
Hi,

hello everyone, I am new here and already have a question to this annoying circumstance. I thought it's a simple task, but it already took me days by now.

I have a complete and fine working ear (including jar, war, all you need for this).
On the other hand I made a very simple SAR (implementing an interface ending to "MBean", start(), stop(), etc.) The jboss-service.xml is located in the META-INF Folder.
Both files are deployed without any errors, when I put them into the deploy folder, and I can find my MBean (from SAR) in JMX Console.

The MBean contains a test method for calling a remote interface provided by the ear (in the including jar).
I tried to use a JNDI lookup to get access to the interface, the way i found in several postings and turorials. I copied the string for the lookup from the global JNDI namespace, and tried variations of this but it never ever worked.
 Always get something like this:
<javax.naming.NamingException: Could not dereference object [Root exception is java.lang.RuntimeException: Can not find interface declared by Proxy in our CL + BaseClassLoader...>

A problem I see, I am not sure about the correct <depends> tag in the jboss-service.mxl. At the moment it looks like this: "<depends>jboss.j2ee:ear=PGN_AS_ear.ear,jar=PGN_AS.jar,name=ApplicationBean,service=EJB3</depends>" That's the String I can find via the JMX Console.
For the JDNI lookup I use "PGN_AS_ear/ApplicationBean/remote-....pgn.as.business.application.facade.ApplicationRI" (global JNDI namespace).

Note: When I do this lookup from a simple "main" class it is all working fine. I even just need a more simple way for this:
ApplicationRI appBeanRI = (ApplicationRI) ctx.lookup("ApplicationBean");

I don't know what to try else. Is this even the right way to create such a connection ?

Things I am not sure about:
- classpath codebase tag for jboss-service.xml
- really correct string for the lookup
- correct <depends> tag in jboss-service.xml

Thank in advance
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/636569#636569]

Start a new discussion in JNDI and Naming at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2083]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20111115/7b6d97f6/attachment-0001.html 


More information about the jboss-user mailing list