Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Remote JNDI Lookup

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have just installed JBoss 3.2.3. It seems to work fine running the default implementation. I have deployed the Remote Entity bean found in the O'Reilly, Enterprise Java Beans (ver. 3) book. If I run the client to this bean on the server machine it runs fine. However, if I run the same client from a remote machine on the same network, changing only the jndi.properties file so that:
java.naming.provider.url=jnp://myserver:1099
I get a stack trace which indicates that the connection is being being refused by the loop-back address (127.0.0.1). I am able to telnet this port on myserver. I am not sure whether my problem is in the client setup or in the server configuration. Here is what the stack trace looks like
run.client_41a:
[java] javax.naming.CommunicationException. Root exception is java.rmi.Con
nectException: Connection refused to host: 127.0.0.1; nested exception is:
[java] java.net.ConnectException: Connection refused: connect
[java] at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:
567)
[java] at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.
java:185)
[java] at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.jav
a:171)
[java] at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:101)
[java] at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
[java] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:52
8)
[java] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:50
7)
[java] at javax.naming.InitialContext.lookup(InitialContext.java:347)
[java] at com.titan.clients.Client_1.main(Client_1.java:17)
[java] Caused by: java.net.ConnectException: Connection refused: connect
[java] at java.net.PlainSocketImpl.socketConnect(Native Method)
[java] at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:295)
[java] at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.jav
a:161)
[java] at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:148)
[java] at java.net.Socket.connect(Socket.java:425)
[java] at java.net.Socket.connect(Socket.java:375)
[java] at java.net.Socket.<init>(Socket.java:290)
[java] at java.net.Socket.<init>(Socket.java:118)
[java] at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(R
MIDirectSocketFactory.java:22)
[java] at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(R
MIMasterSocketFactory.java:122)
[java] at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:
562)
 
Author
Posts: 367
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If this is the stack trace from the REMOTE machine, then it would seem that your jndi.properties isn't getting read/used. Otherwise, why would it by trying to connect to 127.0.0.1? (unless "myserver" resolves to that
IP address, which would be a completely different problem)
Check an make sure jndi.properties is on the client's classpath. You might want to use a Properties object to instantiate your InitialContext just to take the jndi.properties out of the loop temporarily and make sure you can connect.
 
Terry Milan
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for taking the time to reply. I am fairly sure that I am hitting the correct jndi.properties file. I added a loop that printed the entries in the properties object. Also, I took a shot at building the properties object itself, but to no available. And you are correct, the stack trace was copied from the remote machine.
 
Terry Milan
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think I resolved my own problem. I think the problem was on the server side /etc/hosts file. There was no entry for localhost. I corrected the localhost entry so that it pointed to loopback in the server. This seemed to correct some confusion in JBoss.
 
Ranch Hand
Posts: 159
Eclipse IDE C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes, that was also the solution they offered at www.jboss.org , in the faqs.
(if you search on 'connection refused to 127.0.0.1')
grtz
themuppeteer
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I had the same problem until added a line
jboss.bind.address=<remote_ip_addr>
to server's <JBOSS_HOME>/server/all/conf/jacorb.properties
rebooted that jboss as and it worked fine.
By the way, of course, I changed a line
java.naming.provider.url=jnp://<remote_ip_addr>:1099
on client's side.
The code was: one of examples from EJB3-preview.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic