axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andreas Veithen (JIRA)" <>
Subject [jira] Updated: (AXIS2-4520) org.apache.axis2.deployment.DeploymentEngine cannot run under JNI
Date Wed, 07 Oct 2009 20:23:31 GMT


Andreas Veithen updated AXIS2-4520:

    Priority: Minor  (was: Blocker)

The Javadoc of the Thread class says this about the getContextClassLoader:

"Returns the context ClassLoader for this Thread. The context ClassLoader is provided by the
creator of the thread for use by code running in this thread when loading classes and resources.
If not set, the default is the ClassLoader context of the parent Thread. The context ClassLoader
of the primordial thread is typically set to the class loader used to load the application."

It is true that this method may return null. On the other hand, in all usual runtime environments
(simple Java app, J2EE, etc.) the context classloader is always set. The probability that
you will be able to run any larger application (that uses some existing frameworks to do its
job) in an environment where the context classloader is not set is close to zero. Even if
we add the null check in DeploymentEngine, you will probably get the issue somewhere else.
Therefore I would stronlgy recommend that you set up the context classloader as expected by
most frameworks.

I decreased the priority of this issue because:
- it only appears in highly unusual application setups;
- there is an easy workaround, which is to set up the context classloader before giving control
to Axis2.

> org.apache.axis2.deployment.DeploymentEngine cannot run under JNI
> -----------------------------------------------------------------
>                 Key: AXIS2-4520
>                 URL:
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 1.5
>         Environment: Windows Server 2003, Java 1.5_14
>            Reporter: Per Agerbæk
>            Priority: Minor
> When running in a thread created by JNI the Thread.currentThread().getContextClassLoader()
return null, which in turn gives this
> Caused by: java.lang.RuntimeException: parent[0] is null
> 	at org.apache.axis2.classloader.MultiParentClassLoader.copyParents(
> 	at org.apache.axis2.classloader.MultiParentClassLoader.<init>(
> 	at org.apache.axis2.classloader.MultiParentClassLoader.<init>(
> 	at org.apache.axis2.classloader.JarFileClassLoader.<init>(
> 	at org.apache.axis2.deployment.util.Utils$
> 	at Method)
> 	at org.apache.axis2.deployment.util.Utils.getClassLoader(
> 	at org.apache.axis2.deployment.util.Utils.getClassLoader(
> 	at org.apache.axis2.deployment.DeploymentEngine.setClassLoaders(
> 	at org.apache.axis2.deployment.DeploymentEngine.loadRepository(
> 	at org.apache.axis2.deployment.FileSystemConfigurator.getAxisConfiguration(
> 	at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(
> 	at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContextFromFileSystem(
> I fixed it by changing lines 863 - 866 in modules/kernel/src/org/apache/axis2/deployment/
>         ClassLoader sysClassLoader =
>                 Utils.getClassLoader(Thread.currentThread().getContextClassLoader(),
axis2repoURI, false);
>         axisConfig.setSystemClassLoader(sysClassLoader);
> by
>         ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
>         if (classLoader == null)
>             classLoader = ClassLoader.getSystemClassLoader();
>         ClassLoader sysClassLoader = Utils.getClassLoader(classLoader, axis2repoURI);

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message