When using EJB: rmi.UnknownHostException
chengwen Aug 17, 2011 5:52 AMHello.
I deploy my project in jboss6, the computer IP is 10.26.12.99. The project contains both web and ejb3 functions.
The starting paramters and the result is as follows:
Parameters \ Usage Way | run.bat | run.bat -b 0.0.0.0 | run.bat -b 10.26.12.99 | ? |
---|---|---|---|---|
【any computer】http://10.26.12.99:8080 | × | √ | √ | √ |
【in localhost】http://127.0.0.1:8080 | √ | √ | × | √ |
【in 10.26.12.100】 ejb with url: 10.26.12.99:1099 (another computer in 10.26.12.*) | × | √ | √ | √ |
【in 10.26.13.100】 ejb with url: 10.26.12.99:1099 (another computer in a different subnet, for example, 10.26.12.*) | √ | × | √ | √ |
【in localhost】ejb with url: 127.0.0.1:1099 | √ | √ | × | √ |
Firstly, I found that I can only acess jboss in the computer which the Jboss is installed.
Then I change to "run.bat -b 0.0.0.0"。 The parameter "-b 0.0.0.0" made the access in another computer possible.But soon we found that the ejb access was refused if the client computer is not in the same subnet. In another word, If I access the server In 10.26.12.100 by ejb, it works, but if I access the server in 10.26.13.100, it fails. By the way ,I can access http://10.26.12.99:8080 in 10.26.13.100.
The error log is :
[javax.naming.CommunicationException [Root exception is java.rmi.UnknownHostException: Unknown host: WINP1299; nested exception is: java.net.UnknownHostException: WINP1299]] at com.css.waterbox.server.api.consoleapi.SessionDriver.createSessionEJB(Unknown Source) at com.css.waterbox.server.api.consoleapi.SessionDriver.createRemoteSession(Unknown Source) at com.css.waterbox.server.api.consoleapi.SessionDriver.createSession(Unknown Source) at com.css.waterbox.server.api.consoleapi.SessionDriver.getSession(Unknown Source) at com.css.waterbox.server.api.consoleapi.SessionFactory.constructSession(Unknown Source) at com.css.waterbox.console.frame.dialog.LoadDialog.loadServer(Unknown Source) at com.css.waterbox.console.frame.dialog.LoadDialog$LoadThread.run(Unknown Source) Caused by: javax.naming.CommunicationException [Root exception is java.rmi.UnknownHostException: Unknown host: WINP1299; nested exception is: java.net.UnknownHostException: WINP1299] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:841) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:688) at javax.naming.InitialContext.lookup(InitialContext.java:392) ... 7 more Caused by: java.rmi.UnknownHostException: Unknown host: WINP1299; nested exception is: java.net.UnknownHostException: WINP1299 at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:598) at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:198) at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:184) at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:110) at org.jnp.server.NamingServer_Stub.lookup(Unknown Source) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:728) ... 9 more Caused by: java.net.UnknownHostException: WINP1299 at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) at java.net.Socket.connect(Socket.java:529) at java.net.Socket.connect(Socket.java:478) at java.net.Socket.<init>(Socket.java:375) at java.net.Socket.<init>(Socket.java:189) at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22) at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128) at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:595) ... 14 more
In order to solve the "cross-subnet problem", I changed the parameter to "-b 10.26.12.99". Then I can use ejb in 10.26.12.100. But the "localhost" or the "127.0.0.1" way to access become unsuccessful.
Now , how can I make every way to access jboss successful?