Effective October 27, 2012, online and email support for FuseSource products will move to Red Hat support channels. For more information, please see the JIRA Migration to Red Hat FAQ.
As of October 27th, please open all new issues in the Red Hat Customer Portal .
Issue Details (XML | Word | Printable)

Key: SF-348
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Willem Jiang
Reporter: Jonathan Anstey
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
FUSE Services Framework

CXF should set the TCCL to the one of the service being invoked prior any invocation

Created: 05/May/11 03:00 PM   Updated: 12/May/11 03:55 PM
Component/s: None
Affects Version/s: 2.3.2-fuse-00-00
Fix Version/s: 2.3.4-fuse-00-xx, 2.4.0-fuse-00-27

External Issue URL: https://issues.apache.org/jira/browse/CXF-3497


 Description  « Hide
So a user has 2 bundles, each with a CXF webservice on the same port:

bundle A - http://0.0.0.0:8080/A
bundle B - http://0.0.0.0:8080/B

Problem is that since they are using the same port, a single Jetty engine will be shared and each Jetty thread's class loader will be set to the classloader of whichever bundle started first. So, say bundle A started first, now the classloaders would be assigned as follows:

bundle A - BundleDelegatingClassLoader for [bundle A]
bundle B - BundleDelegatingClassLoader for [bundle A]

Any incoming requests to the service in bundle B will use the classloader from bundle A, which is obviously not good

So far I have three workarounds, none of which are a real fix:

1. use a unique port for each bundle's web service so they get their own Jetty engine

2. turn on dynamic imports for each bundle

3. manually override the classloader before doing any work in a bundle
ClassLoader oldCL = currentThread().getContextClassLoader();
currentThread().setContextClassLoader(this.getClass().getClassLoader());
try { // do some classloading } finally { Thread.currentThread().setContextClassLoader(oldCL); }

So we should set the thread ContextClassLoader to the classloader of the service object before actually calling the service



 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Willem Jiang added a comment - 12/May/11 07:28 AM
These two bundle CXF services share the same port, which means they are the same thread pool.
so if there is one request for the BundleA services, the TCCL will be set to bundle A, and the if the thread server for other request for the BundleB, the TCCL will not be changed.

CXF-3497 will make sure the application Classloader will be set as a bus extension and CXF will use the Classloader when it send the request to the server or handle the request from the transport.