Machine Name Change Broke URLClassLoader

I have a Java app that uses URLClassLoader to load classes outside of the classpath. This was working just fine for months, but then the machine name and IP address were changed. Ever since, URLCLassLoader throws a ClassNotFoundException when trying to load the non-classpath classes. The exception is thrown when URLClassLoader.loadClass(className) is called.

I have thrown plenty of system outs into the method which calls loadClass in order to glean some more information on what is going on. Here are the steps I have taken to test what is and isn't working:

1. File file = new File(pathToFile);

2. file.isFile() returns true.

3. file.canRead() returns true.

4. URL url = file.toURL();

5. URL[] urls = new URL[] {url};

6. URLClassLoader loader = new URLClassLoader(urls);

7. Class cls = loader.loadClass(className); -> exception is thrown

In the exception handling, I print out pathToFile, all loader.getURLs(), and className. All of the printed Strings are correct. I have viewed the contents of the jar file at pathToFile, and it does indeed contain className.

The fact that this broke when the machine name and ip were changed leads me to believe that somewhere on the machine something is configured incorrectly. Typing "env" in bash as the user that runs this app, as well as super user, shows no environmentals that seem suspect, although I could be missing something.

Machine Info

Machine: Suse 9.1

Java: 1.4.2_05

I am completely stumped by this. What makes it even worse is the fact that this problem is specific to that machine; I cannot reproduce it on my development machine, meaning I cannot run it through a debugger to take a coser look at what is going on.

[1770 byte] By [Confusatron] at [2007-9-30 22:03:54]
# 1

It occured to me that a stack trace might come in handy.

ClassNotFoundException while loading a TaskEngine!

Plugin JAR path: plugins/taskserverplugins.jar

Plugin JAR found: true

Plugin JAR readable: true

Plugins: file:/srv/www/htdocs/taskserver/plugins/taskserverplugins.jar

Name: com.enthusiasm.lemur.taskserver.plugins.ParkingMeter.ParkingMeter

URLClassLoader Path:

file:/srv/www/htdocs/taskserver/plugins/taskserverplugins.jar

java.net.URLClassLoader$1.run(URLClassLoader.java:199)

java.security.AccessController.doPrivileged(Native Method)

java.net.URLClassLoader.findClass(URLClassLoader.java:187)

java.lang.ClassLoader.loadClass(ClassLoader.java:289)

java.lang.ClassLoader.loadClass(ClassLoader.java:235)

com.enthusiasm.lemur.taskserver.util.DynamicLoader.loadObject(DynamicLoader.java:50)

com.enthusiasm.lemur.taskserver.util.DynamicLoader.loadObject(DynamicLoader.java:29)

com.enthusiasm.lemur.taskserver.engine.TaskLoader.loadTaskEngine(TaskLoader.java:195)

com.enthusiasm.lemur.taskserver.engine.TaskLoader.submit(TaskLoader.java:69)

com.enthusiasm.lemur.taskserver.controller.TaskManager.submit(TaskManager.java:70)

com.enthusiasm.lemur.taskserver.server.TaskServerImpl.submit(TaskServerImpl.java:56)

sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

java.lang.reflect.Method.invoke(Method.java:324)

sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)

sun.rmi.transport.Transport$1.run(Transport.java:148)

java.security.AccessController.doPrivileged(Native Method)

sun.rmi.transport.Transport.serviceCall(Transport.java:144)

sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)

sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)

java.lang.Thread.run(Thread.java:534)

Confusatron at 2007-7-7 11:16:57 > top of Java-index,Administration Tools,Sun Connection...