GeeCON Prague 2014*
The moose likes JBoss/WildFly and the fly likes EJB romte call Exception, Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "EJB romte call Exception,"Connection refused to host: win2003..."" Watch "EJB romte call Exception,"Connection refused to host: win2003..."" New topic
Author

EJB romte call Exception,"Connection refused to host: win2003..."

kong song
Greenhorn

Joined: May 12, 2009
Posts: 13
My develop environment:

client: winXP/JDK6/IP:192.168.1.74 [real machine]
host: windows2003 /JDK6 /JBoss5.0 /hostname:win2003/IP:192.168.1.82 [host is run in VMware6 at client's real machine] bridge

both of them are work well independently,
Host:

Client:


All the code is easy, I make host code to jar named 'test.jar' deploye jboss5-->default--->deploye, copy test.jar to client machine

set classPath to reference .
then running host jboss AS,and Client 'main' method remote call EJB.

All above I have try many times in my studio,There is no problem,and got the right result successfully.
(-b 0.0.0.0 has set to jboss)

Today , In order to run demo for client, I help my boss to build the distributed environment as the same as above in his

machine,but I meet the accident,
when running the client programe the exception shows:

javax.naming.CommunicationException [Root exception is java.rmi.ConnectException: Connection refused to host: win2003;

nested exception is:
java.net.ConnectException: Connection refused: win2003]


IP can ping pass, At Client I can browse http://192.168.1.82:8080 to view the Remote Jboss console.
and The Exception can be solved if running client and host in the same machine.

what happend? windows2003 server config problem?JBoss config? but the same env config can run success in my studio.
Help!
Thanks!
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5836
    
    7

It could be that a firewall is blocking the port. It could also be that there is a bad setting in the hosts file, or that the DNS for VMWare is messing things up.

JNDI uses port 1099. You can see if that port is accessible by running this from a command prompt:

telnet 192.168.1.82 1099

There should be a hostname embedded in the response and that host name should be in the hosts file. If this doesn't help you, post the reply to the above command.


JBoss In Action
kong song
Greenhorn

Joined: May 12, 2009
Posts: 13
Thanks Peter,
I have start Jboss server at Host (192.168.1.82)
and run command "telnet 192.168.1.82 1099 " at Client.
then the client command line shows the following message:


Yes,There is some unrecognizable code...,may be rmi error?but I really do not know how to solve.

I have try to re-install windows2003,but the problem still exist!
I use the command " telnet ...." in the other machine,but the result message is as the same as above!
What should I do next?

Thanks


kong song
Greenhorn

Joined: May 12, 2009
Posts: 13
All excetipn is shown below:
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5836
    
    7

Based in the telnet response, host 192.168.1.82 does have port 1099 open and it is accessible. And the response looks like what is expected (this is a JNDI port, after all, so the response will be in binary). The important part is the hostname that appears on the next-to-the-last last line:



Now the question is, does the hostname 'win2003' map to the IP address 192.168.1.82? If not, you need to edit the hosts file and add that mapping. I recommend adding it to both 192.168.1.82 and to the client machine.
kong song
Greenhorn

Joined: May 12, 2009
Posts: 13
Thanks Peter,I have tried to map hostname with IP both in host and client in 'host file'.
The problem is solved as soon as I re-start service ,and I can call remote ejb successful!!
subsequently,I tried to modify the 'host file', I found it must be mapped "192.168.1.84 win2003" in client machine,but the Host side is not necessary !

Then I checked my studio machines 's 'host file' there is not 'IP hostname' mapping for host either in client or host, but it still can call remote ejb successfully?
Is it related Router config?

Thanks lot !
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5836
    
    7

Somebody somewhere has to map the host name to the IP address. For example, at my work, all hostnames are registered and in the corporate DNS, so there I never have an issue and I never have to update my hosts file (unless I want to communicate with a Linux machine - they never end up in the DNS). At home, however, my router does not always manage host names properly so there I have to put all of the host names and IP addresses into the hosts files. You are probably experiencing similar things.
 
GeeCON Prague 2014
 
subject: EJB romte call Exception,"Connection refused to host: win2003..."