IllegalMonitorStateException in URLClassLoader

Juerg Lehni lehni@gmx.net
Thu May 25 20:03:00 GMT 2006


I am still trying to solve the deadlock problem.

Instead of linking to the natively compiled java code, I tried to  
load it from jar files now.

But now the code URLClassLoader that I use as the main thread's  
ContextClassLoader to load all jar files from a folder throws this  
strange error. When using other JVMs on both Mac and Windows, this  
works fine.

java.lang.IllegalMonitorStateException: current thread not owner
    at gnu.java.net.protocol.jar.Connection.getJarFile (libgcj.7.dylib)
    at java.net.URLClassLoader$JarURLLoader.<init> (libgcj.7.dylib)
    at java.net.URLClassLoader.addURLImpl (libgcj.7.dylib)
    at java.net.URLClassLoader.addURLImpl (libgcj.7.dylib)
    at java.net.URLClassLoader.addURLs (libgcj.7.dylib)

It seems to be a problem with GCJ but I could not figure out why this  
happens. Any thougts?

I am invoking GCJ's virtual machine through JNI_CreateJavaVM. The  
only changes in the project that works with Apple's JVM are: linking  
to libgcj.7.dylib instead of JavaVM.framework and using GCJ's jni.h  
instead of Apple's.

I hope someone can point me to possible solutions, as I am pretty  
stuck now.

Jürg


More information about the Java mailing list