[
https://issues.jboss.org/browse/AS7-2165?page=com.atlassian.jira.plugin.s...
]
Tim Pesce edited comment on AS7-2165 at 10/20/11 10:36 AM:
-----------------------------------------------------------
My apologies, I don't think I described the issue clearly.
Here's the behavior I expect (from 7.0.1 - note the first line):
{code}
08:26:11,670 INFO [stdout] (MSC service thread 1-4) no thread context classloader
08:26:11,670 INFO [stdout] (MSC service thread 1-4) class classloader:
HostBundleClassLoader for Module "deployment.jboss.osgi.bug:1.0.0" from Service
Module Loader
08:26:11,671 INFO [stdout] (MSC service thread 1-4) resource URL:
bundle://jboss.osgi.bug-20-0-0/document.txt
{code}
And here's the behavior that changed in 7.0.2:
{code}
08:27:26,202 INFO [stdout] (MSC service thread 1-4) thread context classloader:
ModuleClassLoader for Module "org.jboss.as.osgi:main" from local module loader
@45e67e6a (roots: /Users/tpesce/Developer/jboss-as-7.0.2.Final/modules)
08:27:26,206 INFO [stdout] (MSC service thread 1-4) resource URL: null
08:27:26,207 INFO [stdout] (MSC service thread 1-4) class classloader:
HostBundleClassLoader for Module "deployment.jboss.osgi.bug:1.0.0" from Service
Module Loader
08:27:26,207 INFO [stdout] (MSC service thread 1-4) resource URL:
bundle://jboss.osgi.bug-21-0-0/document.txt
{code}
In 7.0.1 there was no thread context ClassLoader, so the library code would instead use
the class ClassLoader and correctly finds my resource.
In 7.0.2 there is a thread context ClassLoader, so the library code uses it, but my
resource is not found via the thread context ClassLoader.
was (Author: tpesce):
My apologies, I don't think I described the issue clearly.
Here's the behavior I expect (from 7.0.1 - note the first line):
{code}
08:26:11,670 INFO [stdout] (MSC service thread 1-4) no thread context classloader
08:26:11,670 INFO [stdout] (MSC service thread 1-4) class classloader:
HostBundleClassLoader for Module "deployment.jboss.osgi.bug:1.0.0" from Service
Module Loader
08:26:11,671 INFO [stdout] (MSC service thread 1-4) resource URL:
bundle://jboss.osgi.bug-20-0-0/document.txt
{code}
And here's the behavior that I changed in 7.0.2:
{code}
08:27:26,202 INFO [stdout] (MSC service thread 1-4) thread context classloader:
ModuleClassLoader for Module "org.jboss.as.osgi:main" from local module loader
@45e67e6a (roots: /Users/tpesce/Developer/jboss-as-7.0.2.Final/modules)
08:27:26,206 INFO [stdout] (MSC service thread 1-4) resource URL: null
08:27:26,207 INFO [stdout] (MSC service thread 1-4) class classloader:
HostBundleClassLoader for Module "deployment.jboss.osgi.bug:1.0.0" from Service
Module Loader
08:27:26,207 INFO [stdout] (MSC service thread 1-4) resource URL:
bundle://jboss.osgi.bug-21-0-0/document.txt
{code}
In 7.0.1 there was no thread context ClassLoader, so the library code would instead use
the class ClassLoader and correctly finds my resource.
In 7.0.2 there is a thread context ClassLoader, so the library code uses it, but my
resource is not found via the thread context ClassLoader.
Thread context ClassLoader set to unexpected value
--------------------------------------------------
Key: AS7-2165
URL:
https://issues.jboss.org/browse/AS7-2165
Project: Application Server 7
Issue Type: Bug
Components: OSGi
Affects Versions: 7.0.2.Final
Environment: Java 1.6.0_26, Mac OS 10.6.8
Reporter: Tim Pesce
Assignee: Thomas Diesler
Labels: classloader
Attachments: jboss-osgi-bug.zip
I am using library code in a BundleActivator that tries to load resources via
ClassLoader. The logic in the library looks something like this:
# if thread context ClassLoader exists use it
# else use ClassLoader for this class
The thread context ClassLoader differs from the class ClassLoader. The resources packaged
in my bundle are not available to the thread context ClassLoader, but they are available
to the class ClassLoader. In 7.0.1 there was no thread context ClassLoader, so the library
code used the class ClassLoader and correctly loaded the resources.
Here's what toString on the thread context ClassLoader shows:
{quote}
ModuleClassLoader for Module "org.jboss.as.osgi:main" from local module loader
@67d225a7 (roots: /Users/tpesce/Developer/jboss-as-7.0.2.Final/modules)
{quote}
Here's the toString on the class ClassLoader:
{quote}
HostBundleClassLoader for Module "deployment.jboss.osgi.bug:1.0.0" from Service
Module Loader
{quote}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see:
http://www.atlassian.com/software/jira