Hi Folks,
I've got a problem submitting a gramjob (using ws-gram) from my
application. I've got an application that uses it's own classloader to
load all the globus jars needed for a GramJob.submit. So, the globus
jars are not in my classpath, but will be loaded using a URLClassLoader
by my application. Using this approach the application fails. If I do
have all the globus jars in my classpath (so that they can be loaded by
the System class loader), everything is working great. Below the stack
trace of the exception using my own class loader:
stack trace of ContainerException:
Container failed to initialize. Caused by
javax.naming.NoInitialContextException: Cannot instantiate class:
org.apache.naming.java.javaURLContextFactory [Root exception is
java.lang.ClassNotFoundException:
org.apache.naming.java.javaURLContextFactory]
at
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)
at
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:197)
at org.globus.wsrf.jndi.JNDIUtils.initJNDI(JNDIUtils.java:113)
at org.globus.wsrf.jndi.JNDIUtils.initializeDir(JNDIUtils.java:256)
at
org.globus.wsrf.container.ServiceManager.start(ServiceManager.java:132)
at
org.globus.wsrf.container.ServiceDispatcher.init(ServiceDispatcher.java:131)
at
org.globus.wsrf.container.ServiceContainer.start(ServiceContainer.java:239)
at
org.globus.wsrf.container.ServiceContainer.<init>(ServiceContainer.java:197)
at
org.globus.wsrf.container.GSIServiceContainer.<init>(GSIServiceContainer.java:45)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at
org.globus.wsrf.container.ServiceContainer.createContainer(ServiceContainer.java:138)
at
org.globus.wsrf.impl.notification.ClientNotificationConsumerManager.startListening(ClientNotificationConsumerManager.java:61)
at
org.globus.exec.client.GramJob.setupNotificationConsumerManager(GramJob.java:1000)
at
org.globus.exec.client.GramJob.createJobEndpoint(GramJob.java:899)
at org.globus.exec.client.GramJob.submit(GramJob.java:460)
[...]
Caused by: java.lang.ClassNotFoundException:
org.apache.naming.java.javaURLContextFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at
com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:46)
at
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:654)
... 28 more
It seems to be the case that the JNDIUtils.initJNDI() method loads the
classes with the system class loader, instead of the class loader that
loaded the JNDIUtils class. Is there anyway that it will be possible to
have initJNDI load the classes with my own classloader?
Cheers,
Roelof Kemp