This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills: The software developer's life manual and have John Sonmez on-line!
See this thread for details.
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem running example in mikalai notes

 
Steve Jerome
Greenhorn
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm new to EJB and i'm trying learn from mikalai notes.when I try to run the calculatorclient java class it's showing following error.Can anyone tell me what the problem is.


javax.naming.CommunicationException: Could not obtain connection to any of these urls: localhost:1099 and discovery failed with error: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out] [Root exception is javax.naming.CommunicationException: Failed to connect to server localhost:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused: connect]]]
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1414)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:594)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
at javax.naming.InitialContext.lookup(Unknown Source)
at by.iba.client.CalculatorClient.main(CalculatorClient.java:22)
Caused by: javax.naming.CommunicationException: Failed to connect to server localhost:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused: connect]]
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:269)
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1385)
... 4 more
Caused by: javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused: connect]
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:243)
... 5 more
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:84)
at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:77)
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:239)
... 5 more
 
Andor Nemeth
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Steve Jerome:
I'm new to EJB and i'm trying learn from mikalai notes.when I try to run the calculatorclient java class it's showing following error.Can anyone tell me what the problem is.


javax.naming.CommunicationException: Could not obtain connection to any of these urls: localhost:1099 and discovery failed with error: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out] [Root exception is javax.naming.CommunicationException: Failed to connect to server localhost:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused: connect]]]
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1414)
...



Look at this thread:
http://www.coderanch.com/t/90078/JBoss/JBoss-error-Could-not-obtain
[ July 12, 2007: Message edited by: Andor Nemeth ]
 
Shivani Chandna
Ranch Hand
Posts: 380
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Failed to connect to server localhost:1099


Is your server up and running on localhost:1099 port? Check that?

-Shivani
 
Steve Jerome
Greenhorn
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks shivani,
i've started the server now i'm getting different exception

javax.naming.NameNotFoundException: StatelessCalculatorBean not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
at sun.reflect.GeneratedMethodAccessor43.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
at javax.naming.InitialContext.lookup(Unknown Source)
at by.iba.client.CalculatorClient.main(CalculatorClient.java:20)
 
Narendra Dhande
Ranch Hand
Posts: 951
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

At the time of starting the JBoss Server , check if there is any exception thrown while staring the naming service.

Check the 1099 port is not already used by another service. In case you have change the port other than 1099 for Naming service. Change the port in jndi.properties in the Calculator project under src folder, then repackage and re-deploy the jar file.

I found the 1099 port is use by Microsoft outlook on my machine.

'Connection refused' problem may be due to your firewall setting.

Thanks
[ July 21, 2007: Message edited by: Narendra Dhande ]
 
Shivani Chandna
Ranch Hand
Posts: 380
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Steve,
Could you please post the code of lookup?. I would like to see how you are getting the reference to the interface?


Regards.
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you mapped the JNDI name specified in the ejb-ref-name element in the ejb-jar.xml file to the real JNDI name?
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic