Community
Participate
Working Groups
The new testcase SyntheticContextTCCLIntegrationTests since Virgo carefully sets up the TCCL for a bundle in one of Virgo's "scopes" before issuing Bundle.start and we have a special executor configured into Spring DM to make sure the TCCL gets propagated to Spring DM's worker threads, but then Spring DM overrides the TCCL with the bean class loader, as described in the Spring DM reference ([1]). It may be possible to fix avoid this in one of the following ways: 1. create and set a ContextClassLoaderProvider that uses only the TCCL. 2. set as null the BeanClassLoader of the DefaultContextClassLoaderProvider so that it will fall back to the TCCL. [1] http://static.springsource.org/osgi/docs/1.2.x/reference/html-single/#app-deploy:ext-libs
(In reply to comment #0) Aha! Moment! I would vote for a special OsgiApplicationContextCreator in addition to ContextClassLoaderProvider. This way virgo will be in full control of the ApplicationContext creation. There is also few spring 3.x missing features in spring dm that can be implemented if OsgiApplicationContextCreator is managed by Virgo. Namely BeanDefinitionRegistryPostProcessor that was added in spring 3.x.
(In reply to comment #1) Sounds good. A patch, or even a suggestion of where to start, would be gratefully received. Although I work for SpringSource, my brain is far too small to fit in Spring and its best practices. ;-)
Kernel commit 7c7c26987a56cbd812eaa098a513d0be211636a6 introduces an OsgiApplicationContextCreator for the user region. Currently, this simply extends DefaultOsgiApplicationContextCreator and delegates createApplicationContext to super.
Kernel commit 1f4aaf837ba7431b54d958fc89920787494b70c7 sets a ContextClassLoaderProvider which preserves existing TCCLs. SyntheticContextTCCLIntegrationTests now passes and is enabled.
Documentation commit ed5a500af21c94d4caf1de04bc36444aeeb26ddf removes the corresponding known issue.
Note that this fix affects certain applications that rely on the bug. See bug 368781 for an example. I added a migration note ([1]) to alert users to this. [1] http://wiki.eclipse.org/Virgo/Community/Migrating_from_3.0.x_to_3.5.0#Thread_Context_Class_Loading_with_PARs_and_Scoped_Plans