You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by PAC Kieffer Guillaume <Gu...@panalpina.com> on 2012/07/02 15:12:21 UTC

RE: Dozer with Servicemix 4

Issue solved.

I had to create a helper class that initiates the DozerBeanMapper programmatically (also tried with blueprint declarations but it did not work..)
1) Set the thread context class loader with the current class loader.
2) Load the DozerBeanMapper with the Mapping file.
3) Create DozerTypeConverterLoader (which also register the TypeConverter within the camelContext)

... Combined with a Dynamic-ImportPackage *

It may not be the right way, but it works.

Note that after the first deployment, removing the Dynamic-ImportPackage and redeploying seems also to work... But as soon as the Karaf  instance is restarted, the same problem occurs again, the Dynamic-ImportPackage has to remain in the manifest file.

Regards,
Guillaume.

-----Original Message-----
From: PAC Kieffer Guillaume [mailto:Guillaume.Kieffer@panalpina.com] 
Sent: Friday, June 29, 2012 09:57
To: users@servicemix.apache.org
Subject: RE: Dozer with Servicemix 4

Hi,

The import-package is in the Manifest file. I also tried the magic DynamicImport-Package * but it does not change.

In the blueprint file I declare the following Mapper bean for dozer:
  <bean id="mapper" class="org.dozer.DozerBeanMapper">
	  <property name="mappingFiles">
	    <list>
	      <value>mappings/myMapping-1.0.xml</value>
	    </list>
	  </property>
  </bean>

The exception raises as the "mapper" bean gets initialized.
(-> java.lang.ClassNotFoundException: org.dozer.util.DefaultClassLoader)

But when I comment this bean and add 
<bean id="myDummyOne" class="org.dozer.util.DefaultClassLoader"/>

No exception.. When I keep both bean declarations: the exception occurs...
Typically a class loading issue I am not able to figure out .. :O

Any workaround ?

Thanks again :)

Regards,
Guillaume.

-----Original Message-----
From: Freeman Fang [mailto:freeman.fang@gmail.com] 
Sent: Friday, June 29, 2012 01:47
To: users@servicemix.apache.org
Subject: Re: Dozer with Servicemix 4

Hi,

net.sf.dozer/dozer-osgi/5.3.2 is already a OSGi bundle, so it should  
play the same role as org.apache.servicemix.bundles.dozer

Please ensure your customer bundle Import-Package org.dozer.util

Freeman
On 2012-6-28, at 下午11:25, PAC Kieffer Guillaume wrote:

> Hi All,
>
> I am currently trying to use camel-dozer (2.9.2) component on  
> ServiceMix 4.4.1:
>
> When I try to start the bundle, I get the following exception:
> org.osgi.service.blueprint.container.ComponentDefinitionException:  
> Error when instanciating bean mapper of class class  
> org.dozer.DozerBeanMapper
> 	at  
> org 
> .apache 
> .aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java: 
> 269)[10:org.apache.aries.blueprint:0.3.1]
> 	at  
> org 
> .apache 
> .aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java: 
> 706)[10:org.apache.aries.blueprint:0.3.1]
> .....
> Caused by: org.dozer.MappingException:  
> java.lang.ClassNotFoundException: org.dozer.util.DefaultClassLoader
> 	at  
> org.dozer.util.MappingUtils.throwMappingException(MappingUtils.java: 
> 82)
> 	at  
> org.dozer.util.DefaultClassLoader.loadClass(DefaultClassLoader.java: 
> 38)
> 	at org.dozer.DozerInitializer.loadBeanType(DozerInitializer.java:115)
> 	at org.dozer.DozerInitializer.initialize(DozerInitializer.java:97)
>
> I do not thing this is a camel specific issue.. thus this mailing  
> list.
> When I get headers info on the camel-dozer feature, I get the  
> following bundles included:
> mvn:net.sf.dozer/dozer-osgi/5.3.2
> ....
>
> Is that the right library dozer-osgi to be used within smx?
>
> I saw a Servicemix bundle:
> <dependency>
> 	<groupId>org.apache.servicemix.bundles</groupId>
> 	<artifactId>org.apache.servicemix.bundles.dozer</artifactId>
> 	<version>5.3.2_1</version>
> </dependency>
>
> Is it be used somehow ?
>
> Thanks for your help :)
>
> Regards,
> Guillaume.

---------------------------------------------
Freeman Fang

FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: http://weibo.com/u/1473905042