Weird problem in JNDI. JNDI client always try to connect one
txie2000 Sep 20, 2005 2:51 AMMy environment,
JBoss 4.0.2. In the LAN, there is a JBoss 4.0.2 instance running on Linux box - 10.2.3.172 . My machine (WinXP)'s IP address is 10.2.3.195
I used 10.2.3.172 for some testing, but no longer use it. and it is still up & running for other purpose.
I have a simple JNDI client, whatever URL I give, even non-exist ones, it always try to connect to 10.2.3.172. So strange.
I don't have jndi.properties.
Here is the TCP sniffer says,
10.2.7.5 10.2.3.195 TCP 4215 > 3389 [PSH, ACK] Seq=1640 Ack=15567 Win=65535 Len=17
10.2.3.195 10.2.3.255 NBNS Name query NB ASDFA<00>
10.2.3.195 10.2.7.5 TCP 3389 > 4215 [PSH, ACK] Seq=15567 Ack=1657 Win=65309 Len=16
10.2.7.5 10.2.3.195 TCP 4215 > 3389 [PSH, ACK] Seq=1657 Ack=15567 Win=65535 Len=52
10.2.7.5 10.2.3.195 TCP 4215 > 3389 [PSH, ACK] Seq=1709 Ack=15583 Win=65519 Len=59
10.2.3.195 10.2.7.5 TCP 3389 > 4215 [ACK] Seq=15583 Ack=1768 Win=65198 Len=0
10.2.7.5 10.2.3.195 TCP 4215 > 3389 [PSH, ACK] Seq=1768 Ack=15583 Win=65519 Len=94
10.2.7.5 10.2.3.195 TCP 4215 > 3389 [PSH, ACK] Seq=1862 Ack=15583 Win=65519 Len=108
10.2.3.195 10.2.7.5 TCP 3389 > 4215 [ACK] Seq=15583 Ack=1970 Win=64996 Len=0
10.2.7.5 10.2.3.195 TCP 4215 > 3389 [PSH, ACK] Seq=1970 Ack=15583 Win=65519 Len=24
10.2.3.195 10.2.7.5 TCP 3389 > 4215 [PSH, ACK] Seq=15583 Ack=1994 Win=64972 Len=348
10.2.7.5 10.2.3.195 TCP 4215 > 3389 [PSH, ACK] Seq=1994 Ack=15931 Win=65171 Len=94
10.2.3.195 230.0.0.4 IGMP V2 Membership Report
10.2.3.195 230.0.0.4 UDP Source port: 2506 Destination port: 1102
10.2.3.172 Broadcast ARP Who has 10.2.3.195? Tell 10.2.3.172
10.2.3.195 10.2.3.172 ARP 10.2.3.195 is at 00:0c:f1:ea:e0:ec
10.2.3.172 10.2.3.195 UDP Source port: 1102 Destination port: 2506
10.2.3.195 10.2.3.172 TCP 2507 > 1100 [SYN] Seq=0 Ack=0 Win=65535 Len=0 MSS=1460
10.2.3.172 10.2.3.195 TCP 1100 > 2507 [SYN, ACK] Seq=0 Ack=1 Win=5840 Len=0 MSS=1460
10.2.3.195 10.2.3.172 TCP 2507 > 1100 [ACK] Seq=1 Ack=1 Win=65535 Len=0
10.2.3.172 10.2.3.195 TCP 1100 > 2507 [PSH, ACK] Seq=1 Ack=1 Win=5840 Len=4
10.2.3.172 10.2.3.195 TCP 1100 > 2507 [FIN, PSH, ACK] Seq=5 Ack=1 Win=5840 Len=968
10.2.3.195 10.2.3.172 TCP 2507 > 1100 [ACK] Seq=1 Ack=974 Win=64563 Len=0
10.2.7.5 10.2.3.195 TCP 4215 > 3389 [PSH, ACK] Seq=2088 Ack=15931 Win=65171 Len=101
10.2.3.195 10.2.7.5 TCP 3389 > 4215 [ACK] Seq=15931 Ack=2189 Win=64777 Len=0
10.2.3.195 10.2.3.172 TCP 2508 > 44173 [SYN] Seq=0 Ack=0 Win=65535 Len=0 MSS=1460
"ASDFA" is the given non-existant URL by intention.
10.2.3.172 Broadcast ARP Who has 10.2.3.195? Tell 10.2.3.172
Somehow, 10.2.3.172 broadcast a message asking for the MAC address of 10.2.3.195. How is it possible?
After that, they are happliy talk to each other.
My JNDIClient...
package test;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import java.util.Hashtable;
/**
* Test Program to reproduce Bug 6050
*/
public class JNDIClient {
public static void main(String[] args) {
if (args.length < 2) {
usage();
return;
}
String url = args[0];
String objName = args[1];
try {
InitialContext ic = getInitialContext(url);
if (ic != null) {
log("Successfully get Initial Context " + ic.toString() + " from URL " + url);
Object obj = ic.lookup(objName);
if (ic != null) {
log("Sucessfully found object " + obj);
}
}
else {
log("Failed to get Initial Context");
}
} catch (Exception e) {
log("Failure with exception ...");
e.printStackTrace();
}
}
public static InitialContext getInitialContext(String url) throws NamingException {
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
env.put(Context.PROVIDER_URL, "jnp://" + url);
// env.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
InitialContext ctx = new InitialContext(env);
return ctx;
}
public static void usage() {
log("java test.JNDIClient (i.e. thrush:1099) (i.e. ejb/RDSAccessFacade");
log("");
}
public static void log(String s) {
System.out.println(s);
}
}