Steven Reich [
http://community.jboss.org/people/tauman%40yahoo.com] created the
discussion
"Upgrade from 4.0.3 to 5.1.0"
To view the discussion, visit:
http://community.jboss.org/message/555707#555707
--------------------------------------------------------------
I am upgrading an application from JBoss 4.0.3 to 5.1.0 and have run into a problem when
attempting to get an InitialContext object to connect to JNDI from another machine (or
even the same machine when referred to by its name or IP rather than just localhost). Here
is a test class which reproduces the problem:
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
public class ContextTest {
public static void main(String[] args) {
String url = "localhost:1099";
// String url = "AHRC00WKG2208:1099";
Properties p = new Properties();
p.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
p.setProperty(Context.URL_PKG_PREFIXES,
"org.jboss.naming:org.jnp.interfaces");
p.setProperty(Context.PROVIDER_URL, url);
try {
InitialContext context = new InitialContext(p);
Object queue = context.lookup("queue/ImageUploadQueue");
System.out.println(queue);
}
catch (NamingException e) {
e.printStackTrace();
}
}
}
When I run this against JBoss 4.0.3, either url will work, but against 5.1.0, running
against the non-localhost value causes the following exception:
javax.naming.CommunicationException: Could not obtain connection to any of these urls:
AHRC00WKG2208: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
AHRC00WKG2208/143.134.34.36:1099 [Root exception is
javax.naming.ServiceUnavailableException: Failed to connect to server
AHRC00WKG2208/143.134.34.36:1099 [Root exception is java.net.ConnectException: Connection
refused: connect]]]
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1763)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:693)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at com.tauman.test.ContextTest.main(ContextTest.java:24)
Caused by: javax.naming.CommunicationException: Failed to connect to server
AHRC00WKG2208/143.134.34.36:1099 [Root exception is
javax.naming.ServiceUnavailableException: Failed to connect to server
AHRC00WKG2208/143.134.34.36:1099 [Root exception is java.net.ConnectException: Connection
refused: connect]]
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:335)
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1734)
... 4 more
Caused by: javax.naming.ServiceUnavailableException: Failed to connect to server
AHRC00WKG2208/143.134.34.36:1099 [Root exception is java.net.ConnectException: Connection
refused: connect]
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:305)
... 5 more
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:519)
at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:97)
at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:82)
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:301)
... 5 more
I'm sure that there is something simple I am missing, but for the life of me, I
can't figure it out. Any help would be greatly appreciated.
Steve
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/555707#555707]
Start a new discussion in JNDI and Naming at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]