Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

javax.naming.CommunicationException

 
Sisti Dey
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 Dey
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:

 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!