Problem to get from client
jaleyba Dec 18, 2006 5:11 AM
Hi
I've a war application that bind an object with jndi.
Now I want to get this object from a desktop application that is not running in the same VM than JBoss but it couldn´t see my bound object.
I've been looking in FAQ's and now I know why my app couldn´t get my object but I couldn´t found the solution to the problem.
I've seen in usefull code here this code:
env.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory"); env.put("java.naming.provider.url","jnp://172.31.112.9:2199"); env.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces"); Context ctx = new InitialContext(env); System.out.println("Binds: " + ctx.listBindings("").toString());
When I run it I got:
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] at org.jnp.interfaces.NamingContext.listBindings(NamingContext.java:872) at org.jnp.interfaces.NamingContext.listBindings(NamingContext.java:806) at javax.naming.InitialContext.listBindings(InitialContext.java:396) at CF.main(CF.java:25) Caused by: java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is: java.net.ConnectException: Connection refused: connect at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:567) at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185) at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171) at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:101) at org.jnp.server.NamingServer_Stub.listBindings(Unknown Source) at org.jnp.interfaces.NamingContext.listBindings(NamingContext.java:821) ... 3 more Caused by: java.net.ConnectException: Connection refused: connect at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305) at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158) at java.net.Socket.connect(Socket.java:452) at java.net.Socket.connect(Socket.java:402) at java.net.Socket.<init>(Socket.java:309) at java.net.Socket.<init>(Socket.java:124) 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:562) ... 8 more
Which is the trick to allow my app to get the object ?
Thanks in advance
C