File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes javax.naming.CommunicationException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "javax.naming.CommunicationException" Watch "javax.naming.CommunicationException" New topic
Author

javax.naming.CommunicationException

Sisti Deb
Greenhorn

Joined: Aug 01, 2007
Posts: 28
Hi,

Can anybody help me to solve this error:-

While trying to do this sample example with jboss 4.2 , ejb 3 ,jdk1.5 that
I found at site
:- http://javahowto.blogspot.com/2007/11/simple-ejb-3-on-jboss-application.html

I am getting the following error when I run the client class
---------------------------------------------------------------------------------------------------

Exception in thread "main" 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 excepti
on is javax.naming.ServiceUnavailableException: Failed to connect to server loca
lhost:1099 [Root exception is java.net.ConnectException: Connection refused: con
nect]]]
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1562)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:634)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
at javax.naming.InitialContext.lookup(Unknown Source)
at foo.Client.main(Client.java:16)
Caused by: javax.naming.CommunicationException: Failed to connect to server loca
lhost:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed t
o connect to server localhost:1099 [Root exception is java.net.ConnectException:
Connection refused: connect]]
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:274)
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1533)
... 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:248)
... 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:244)
... 5 more
-----------------------------------------------------------------------------------------------------------------------
When I tried to do the first example of ejb3 in action with Myeclipse,jboss 4.2, ejb 3, jdk1.5
I am getting this same error.

I am not understanding What I am missing.
I will be very thankful if anybody can help me to solve this error...

Thanks in advance.
sisti
Sisti Deb
Greenhorn

Joined: Aug 01, 2007
Posts: 28
Hi Again,
I found in many of the posts that this error is due to the jar file "jbossall-client.jar "
but I have set the classpath %JBOSS_HOME%\client\jbossall-client.jar
for the client class
still getting this error

Please advice me how to to solve it..
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10102
    
165

How did you start the server? Is the client and the server on the same machine? Is the server up when the client is running? What does the following command from the client machine return:



[My Blog] [JavaRanch Journal]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: javax.naming.CommunicationException