Hi There,
I hope this is the right place to post this, I think I've found a bug with the naming
component of JBoss 3.2.4. I've tested with JDK 1.4.2_02 and 1.4.2_04. This problem was
not in the previous version we were using (3.2.3) and was discovered initially upon
upgrade. The problem seems to manifest when I configure the JBoss servers JNDI bound
interface to the loopback (localhost).
Okay, before going further, to confirm I'm not a dummy (not too much anyway) here's
what I'm trying to do and how I've set out to achieve it:
Aim: Make JBoss JNDI bind address set to localhost
Method: Change parameter in jboss-service.xml for JNDI bind address to localhost.
Then change client lookup so that it is using "jnp://localhost:1099" for the provider
URL. If you follow this post further, you will see that I'm getting a connection
refused on my network interface (192.168.X.X) not the loopback (127.0.0.1). The first
thought in your head, and my own, was that I hadn't configured the client correctly.
Well after much checking and debugging, I can confirm that the client is configured
correctly, it is just for some reason "localhost" is not translating to "127.0.0.1".
This problem has been tested on a few machines now, so I'm pretty sure it isn't
something like an awry "hosts" file.
In order to confirm this problem, I would ask someone more knowledgable then myself to
change the configuration parameter for the JNDI address JBoss is listening on to
localhost, and then try the JUnit test below. Please free to change the
"CommandManagerHome" to a home interface on your own machine.
It appears that JBoss itself is working, but the lookup is failing (the client code,
not the server). Every attempt to lookup the home interface results in the following:
javax.naming.CommunicationException [Root exception is java.rmi.ConnectException:
Connection refused to host: 192.168.X.X; nested exception is:
java.net.ConnectException: Connection refused: connect]
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:647)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:507)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at
au.com.distillery.iqore.utilities.ejb.test.JNDILookupTest.testJNDILookup(JNDILookupTest.java:43)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:392)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:276)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:167)
Caused by: java.rmi.ConnectException: Connection refused to host: 192.168.1.26; nested
exception is:
java.net.ConnectException: Connection refused: connect
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:567)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:101)
at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:528)
... 18 more
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
at java.net.Socket.connect(Socket.java:452)
at java.net.Socket.connect(Socket.java:402)
at java.net.Socket.(Socket.java:309)
at java.net.Socket.(Socket.java:124)
at
sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
at
sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:562)
... 23 more
For a long time I tested various scenarios, and everything points to an error on the
client. I've tested this against a fresh jboss installation with only one change to
the configuration (the bind interface for JNDI is localhost). I eventually got annoyed
enough to write a simple testcase which I've included below.
public class JNDILookupTest extends TestCase
{
public void testJNDILookup() {
Context ctx = null;
Hashtable ht = new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
ht.put(Context.PROVIDER_URL, "jnp://localhost:1099");
CommandManagerHome home = null;
try {
ctx = new InitialContext(ht);
String lookupClassName = CommandManagerHome.class.getName();
home = (CommandManagerHome) ctx.lookup(lookupClassName);
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
ctx.close();
} catch (Exception e) { }
}
assertTrue(home != null);
}
}
Please help or confirm the issue, a workaround isn't hard to implement (just don't use
localhost) but I would rather not.
Thanks,
David L
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3839078#3839078
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3839078
-------------------------------------------------------
This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA
REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development