[
https://issues.apache.org/jira/browse/AXIS2-4520?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
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: https://issues.apache.org/jira/browse/AXIS2-4520
> 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(MultiParentClassLoader.java:182)
> at
> org.apache.axis2.classloader.MultiParentClassLoader.<init>(MultiParentClassLoader.java:105)
> at
> org.apache.axis2.classloader.MultiParentClassLoader.<init>(MultiParentClassLoader.java:76)
> at
> org.apache.axis2.classloader.JarFileClassLoader.<init>(JarFileClassLoader.java:66)
> at org.apache.axis2.deployment.util.Utils$6.run(Utils.java:348)
> at java.security.AccessController.doPrivileged(Native Method)
> at org.apache.axis2.deployment.util.Utils.getClassLoader(Utils.java:344)
> at org.apache.axis2.deployment.util.Utils.getClassLoader(Utils.java:309)
> at
> org.apache.axis2.deployment.DeploymentEngine.setClassLoaders(DeploymentEngine.java:863)
> at
> org.apache.axis2.deployment.DeploymentEngine.loadRepository(DeploymentEngine.java:146)
> at
> org.apache.axis2.deployment.FileSystemConfigurator.getAxisConfiguration(FileSystemConfigurator.java:133)
> at
> org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:64)
> at
> org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContextFromFileSystem(ConfigurationContextFactory.java:206)
> I fixed it by changing lines 863 - 866 in
> modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java
> 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.