wood burning stoves 2.0*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes problem running example in mikalai notes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "problem running example in mikalai notes" Watch "problem running example in mikalai notes" New topic
Author

problem running example in mikalai notes

Steve Jerome
Greenhorn

Joined: Mar 03, 2007
Posts: 22
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

Joined: Jul 06, 2007
Posts: 16
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 ]

SCJP 5<br />SCBCD 5 (next target)
Shivani Chandna
Ranch Hand

Joined: Sep 18, 2004
Posts: 380
Failed to connect to server localhost:1099


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

-Shivani


/** Code speaks louder than words */
Steve Jerome
Greenhorn

Joined: Mar 03, 2007
Posts: 22
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

Joined: Dec 04, 2004
Posts: 950
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 ]

Narendra Dhande
SCJP 1.4,SCWCD 1.4, SCBCD 5.0, SCDJWS 5.0, SCEA 5.0
Shivani Chandna
Ranch Hand

Joined: Sep 18, 2004
Posts: 380
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

Joined: Sep 29, 2002
Posts: 1683
Have you mapped the JNDI name specified in the ejb-ref-name element in the ejb-jar.xml file to the real JNDI name?


SCJP 1.4, SCWCD 1.3, SCBCD 1.3
 
 
subject: problem running example in mikalai notes
 
Similar Threads
Eclipse 3 with Jboss3.2.3 using Lomboz 3.0 -> CommunicationException
Null Pointer Exception
please help ..... error while running program using eclipse
SocketTimeoutException when doing JNDI lookup
javax.naming.CommunicationException