You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Thomas Diesler (JIRA)" <ji...@apache.org> on 2015/05/06 15:43:00 UTC

[jira] [Commented] (CAMEL-8689) camel-dozer: Multiple contexts / bundles - Does not use the correct classloader

    [ https://issues.apache.org/jira/browse/CAMEL-8689?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14530560#comment-14530560 ] 

Thomas Diesler commented on CAMEL-8689:
---------------------------------------

I get 

{code}
15:26:16,518 SEVERE [org.jboss.arquillian.protocol.jmx.JMXTestRunner] (pool-2-thread-1) Failed: org.wildfly.camel.test.csv.CSVIntegrationTest.testMarshal: org.dozer.MappingException: java.lang.InstantiationException: org.apache.camel.converter.dozer.DozerThreadContextClassLoader
	at org.dozer.util.MappingUtils.throwMappingException(MappingUtils.java:82) [dozer-5.5.1.jar:]
	at org.dozer.util.ReflectionUtils.newInstance(ReflectionUtils.java:366) [dozer-5.5.1.jar:]
	at org.dozer.DozerInitializer.registerClassLoader(DozerInitializer.java:118) [dozer-5.5.1.jar:]
	at org.dozer.DozerInitializer.initialize(DozerInitializer.java:98) [dozer-5.5.1.jar:]
	at org.dozer.DozerInitializer.init(DozerInitializer.java:79) [dozer-5.5.1.jar:]
	at org.dozer.DozerInitializer.init(DozerInitializer.java:64) [dozer-5.5.1.jar:]
	at org.dozer.DozerBeanMapper.init(DozerBeanMapper.java:173) [dozer-5.5.1.jar:]
	at org.dozer.DozerBeanMapper.<init>(DozerBeanMapper.java:99) [dozer-5.5.1.jar:]
	at org.apache.camel.converter.dozer.DozerTypeConverterLoader.createDozerBeanMapper(DozerTypeConverterLoader.java:232) [camel-dozer-2.16-SNAPSHOT.jar:2.16-SNAPSHOT]
	at org.apache.camel.converter.dozer.DozerTypeConverterLoader.<init>(DozerTypeConverterLoader.java:118) [camel-dozer-2.16-SNAPSHOT.jar:2.16-SNAPSHOT]
	at org.wildfly.camel.test.csv.CSVIntegrationTest.testMarshal(CSVIntegrationTest.java:68) [csv-dataformat-tests:]
...
Caused by: java.lang.InstantiationException: org.apache.camel.converter.dozer.DozerThreadContextClassLoader
	at java.lang.Class.newInstance(Class.java:423) [rt.jar:1.8.0_31]
	at org.dozer.util.ReflectionUtils.newInstance(ReflectionUtils.java:364) [dozer-5.5.1.jar:]
	... 150 more
Caused by: java.lang.NoSuchMethodException: org.apache.camel.converter.dozer.DozerThreadContextClassLoader.<init>()
	at java.lang.Class.getConstructor0(Class.java:3074) [rt.jar:1.8.0_31]
	at java.lang.Class.newInstance(Class.java:408) [rt.jar:1.8.0_31]
	... 151 more
{code}

with this

> camel-dozer: Multiple contexts / bundles - Does not use the correct classloader
> -------------------------------------------------------------------------------
>
>                 Key: CAMEL-8689
>                 URL: https://issues.apache.org/jira/browse/CAMEL-8689
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-dozer
>    Affects Versions: 2.15.1
>            Reporter: Raúl Kripalani
>            Assignee: Raúl Kripalani
>             Fix For: 2.14.3, 2.16.0, 2.15.3
>
>
> Dozer is a tough library to work with in a multi-module context, because of its use of singletons for configuration. In an OSGi environment, each bundle will have its own classloader but Dozer's architecture makes it impossible to cater for this scenario nicely. Unfortunately, it expects a single container-wide classloader configured in the BeanContainer singleton.
> In Camel we worked around this by providing a custom DozerClassLoader implementation that is aware of the Camel Context, but what happens if we are sharing Dozer across multiple Camel Contexts? The most recently initialized context will override the container-wide classloader.
> We need a solution such that the classloader can dynamically change based on the Camel Context that is using the component.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)