Hi,
there are three bundles where bundle A and B define and export package.
Bundle C contains the dozer mapping file and maps a class from A to a class
from B. Budle C throws a ClassNotFoundException.
I was able to work around the problem by setting
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
package C;
public B transform(
A a) throws Exception {
//workaround
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
List<String> myMappingFiles = new ArrayList<String>();
myMappingFiles.add(MAPPING_FILE);
DozerBeanMapper mapper = new DozerBeanMapper(myMappingFiles);
B b = new B();
mapper.map(a, b);//throws Exception
return b;
}
Regards,
Lee
On Fri, Sep 18, 2009 at 5:43 PM, Richard S. Hall <[email protected]>wrote:
> The information given is not enough to know what is going on. What is
> packaged inside of which bundles? Who imports, exports, etc?
>
> -> richard
>
>
> On 9/18/09 16:03, Leen Toelen wrote:
>
>> Hi,
>> I am trying to use Dozer mapping inside felix. My mapping xml files run
>> without a problem in my unit tests, but when run inside OSGI I get
>> a ClassNotFoundException.
>>
>> 2009/09/18 13:53:19 | INFO | jvm 1 | Caused by:
>> java.lang.ClassNotFoundException:
>> com.meucci.tpaprocessors.sybase.result.SybaseSmsSendTestPartyResult
>> ...
>> 2009/09/18 13:53:19 | INFO | jvm 1 | at
>> java.lang.ClassLoader.loadClass(ClassLoader.java:252)
>> 2009/09/18 13:53:19 | INFO | jvm 1 | at
>> java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
>> 2009/09/18 13:53:19 | INFO | jvm 1 | at
>> java.lang.Class.forName0(Native Method)
>> 2009/09/18 13:53:19 | INFO | jvm 1 | at
>> java.lang.Class.forName(Class.java:247)
>> 2009/09/18 13:53:19 | INFO | jvm 1 | at
>> org.apache.commons.lang.*
>> ClassUtils.getClass*(ClassUtils.java:629)
>> 2009/09/18 13:53:19 | INFO | jvm 1 | at
>> org.apache.commons.lang.ClassUtils.getClass(ClassUtils.java:677)
>> 2009/09/18 13:53:19 | INFO | jvm 1 | at
>> org.apache.commons.lang.ClassUtils.getClass(ClassUtils.java:660)
>> 2009/09/18 13:53:19 | INFO | jvm 1 | at org.dozer.util.*
>> MappingUtils.loadClass*(MappingUtils.java:229)
>>
>> Does anyone know how to solve this problem in felix?
>>
>> Regards,
>> Leen
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>