jQuery in Action, 2nd edition*
The moose likes JBoss/WildFly and the fly likes JBoss instances cooperating. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "JBoss instances cooperating." Watch "JBoss instances cooperating." New topic
Author

JBoss instances cooperating.

Claudio Gualberto
Ranch Hand

Joined: Oct 13, 2002
Posts: 47
Hi all,
I have the following situation :
Machine 'A' with JBoss where i deployed an Web application with some JSP and Servlets ( a tipical Struts application ).
Machine 'B' with JBoss ( the same network ) where i deployed an EJB module with some Session Beans ( stateless/stateful ) and some Entity Beans.
The Struts application is client of the EJB's on Machine 'B', and it uses a ServiceLocator, where i get an InitialContext using the constructor version that receives no parameters.
InitialContext ctx = new InitialContext();

Thus, the JBoss constructs the InitialContext using the parameters into the file %JBOSS_HOME%/server/default/conf/jndi.properties , so far so good.
The problem is that, if i edit this file to point to the machine 'B' where my EJBs are deployed, and later restart the server on machine 'A' to the changes take efect, the JBoss just can't start, throwing a lot of "Object already bound exceptions".
Thats my jndi.properties file :
---------------------------------------------------------------------
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.naming rg.jnp.interfaces
# Do NOT uncomment this line as it causes in VM calls to go over
# RMI!
java.naming.provider.url=jnp://machinebhost:1099
---------------------------------------------------------------------
What is my mistakes ? How to active this on JBoss, one machine with JBoss serving as an Web Server and other machine with JBoss too, serving as an EJB Container.
Thanks for any help.
Claudio Gualberto
SCJP 1.4
norman richards
Author
Ranch Hand

Joined: Jul 21, 2003
Posts: 367
You don't want to edit jndi.properties. That is the JNDI properties for your local server, and all your local services will try to bind in it, causing conflicts with the services already registered with the JBoss server on that machine.
Instead, what you want to do is use an ejb-ref in your jboss-web.xml. Use a full URL in the jndi-name. For example:
<jndi-name>jnp://machinebhost/the_global_name_your_bean_is_bound_at</jndi-name>
Claudio Gualberto
Ranch Hand

Joined: Oct 13, 2002
Posts: 47
Thanks for your reply, i think you're right.
I will try this and post the result here.
Thanks again.
Claudio Gualberto.
SCJP 1.4
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JBoss instances cooperating.