[
https://issues.apache.org/jira/browse/CAMEL-5722?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Raul Kripalani updated CAMEL-5722:
----------------------------------
Description:
Happens in an OSGi environment; but it is also applicable in modular servers
that build dynamic classloaders (e.g. JBoss AS) per deployed artifacts (WAR,
module, EAR, etc.).
If bundles A and B are both creating camel-jetty consumers on the same TCP
port, the consumers will share the underlying Jetty connector. Moreover, the
Jetty connector is indeed created by the first consumer that initialises on
that TCP port.
Since the Camel route executes on the Jetty Connector thread, all class
resolutions will happen against the classloader of the bundle that initialises
first.
This makes class resolution absolutely undeterministic and erratic. Quite a
nasty bug IMHO.
Perhaps this can be fixed by adding a call to
{{Thread.setContextClassLoader()}} passing the classloader of the
JettyHttpEndpoint, as soon as a request comes in?
was:
Happens in an OSGi environment; but it is also applicable in modular servers
which builds dynamic classloaders (e.g. JBoss AS) for each deployed artifact
(WAR, module, EAR, etc.).
If bundles A and B are both creating camel-jetty consumers on the same TCP
port, the consumers will share the underlying Jetty connector. Moreover, the
Jetty connector is indeed created by the first consumer that initialises on
that TCP port.
Since the Camel route executes on the Jetty Connector thread, all class
resolutions will happen against the classloader of the bundle that initialises
first.
This makes class resolution absolutely undeterministic and erratic. Quite a
nasty bug IMHO.
Perhaps this can be fixed by adding a call to
{{Thread.setContextClassLoader()}} passing the classloader of the
JettyHttpEndpoint, as soon as a request comes in?
> Classloader mixup when consumers across bundles share the same camel-jetty
> port
> -------------------------------------------------------------------------------
>
> Key: CAMEL-5722
> URL: https://issues.apache.org/jira/browse/CAMEL-5722
> Project: Camel
> Issue Type: Bug
> Components: camel-jetty
> Affects Versions: 2.8.0
> Environment: OSGi environment, Karaf 2.2.2.
> Reporter: Raul Kripalani
> Assignee: Raul Kripalani
> Priority: Critical
>
> Happens in an OSGi environment; but it is also applicable in modular servers
> that build dynamic classloaders (e.g. JBoss AS) per deployed artifacts (WAR,
> module, EAR, etc.).
> If bundles A and B are both creating camel-jetty consumers on the same TCP
> port, the consumers will share the underlying Jetty connector. Moreover, the
> Jetty connector is indeed created by the first consumer that initialises on
> that TCP port.
> Since the Camel route executes on the Jetty Connector thread, all class
> resolutions will happen against the classloader of the bundle that
> initialises first.
> This makes class resolution absolutely undeterministic and erratic. Quite a
> nasty bug IMHO.
> Perhaps this can be fixed by adding a call to
> {{Thread.setContextClassLoader()}} passing the classloader of the
> JettyHttpEndpoint, as soon as a request comes in?
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira