Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

rmi connection refused  RSS feed

 
Chris Montgomery
Ranch Hand
Posts: 141
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have jboss running on one machine and the client (Tomcat) running on a different machine.

I had tomcat and jboss running on the same machine and the code was running perfectly.

I put jboss on a separate machine, updated the client code to point to a different ip and I get the following error:

javax.naming.CommunicationException [Root exception is java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is:
java.net.ConnectException: Connection refused: connect]

this tells me the client is still trying to connect to the localhost vs. the new machine.

here is my code:
try
{
Hashtable props = new Hashtable();
props.put(InitialContext.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
props.put(InitialContext.PROVIDER_URL, "jnp://192.168.1.102:1099");

Context initial = new InitialContext(props);
Object o = initial.lookup("java:comp/env/TestSession");

com.test.TestSessionHome home = (com.test.TestSessionHome)PortableRemoteObject.narrow(o, com.test.TestSessionHome.class);
com.test.TestSession h = home.create();
System.out.println(h.test("TEST"));
}
catch(Exception ex)
{
System.out.println("Exception: " + ex.toString());
ex.printStackTrace();
return mapping.findForward("fail");
}


I looked at all my classpaths and nothing is pointing to the localhost (as far as I can tell)

Just can't figure out why struts is trying to speak locally when I have my ip specified (jnp://192.168.1.102:1099)...
 
Chris Montgomery
Ranch Hand
Posts: 141
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so if I have the machines switch places (what ran tomcat, now runs jboss and what ran jboss now runs tomcat), it works.

must be an environment or router thing...

no need for help.

Chris
 
parthiban subramaniam
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Try pinging the server machine from the client machine if you are able to ping then you should be able to look up your ejb's
and also go through the JBoss docs to make sure that you have initialised the InitialContext properly with all the parameters populated you can use the jndi.properties file to figure the required ones
and place your jboss-client.jar or jbossall-client.jar in the client machine class path

if they are done you will be able to look up your ejb's

if you are not able to ping the server machine using your ip address use the machine name the ip address may be masked by your router with another one

Good luck

cheers,
Parthi
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!