Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » ClassNotFoundException inside PAR(ClassNotFoundException inside PAR)
ClassNotFoundException inside PAR [message #546653] Tue, 13 July 2010 12:30 Go to next message
No real name is currently offline No real name
Messages: 15
Registered: June 2010
Junior Member
We are trying to use Dozer in an OSGi application and are experiencing class path visibility issues. The objects are exported in one of our manifests; however, Dozer bundle does not import the object types being mapped (via it's manifest). According to some other threads on the Spring dm Server forum this should be addressed by using a PAR. We checked and the types are imported through the PAR's synthetic context; however, we still get a runtime exception:

org.dozer.MappingException: java.lang.ClassNotFoundException: ca.company.object.

What is the suggested way to address this?

Thanks in advance.

- Paul
Re: ClassNotFoundException inside PAR [message #546661 is a reply to message #546653] Tue, 13 July 2010 12:53 Go to previous messageGo to next message
Dmitry Sklyut is currently offline Dmitry Sklyut
Messages: 271
Registered: January 2010
Senior Member
You might need to import dozer classes in your bundle similar to hibernate set-up

http://www.eclipse.org/virgo/documentation/virgo-documentati on-2.1.0.M02-incubation/docs/virgo-programmer-guide/html/ch0 8.html#common-libraries-hibernate

i.e. import-scope:=application should do the trick for you.

Re: ClassNotFoundException inside PAR [message #546667 is a reply to message #546661] Tue, 13 July 2010 13:21 Go to previous messageGo to next message
No real name is currently offline No real name
Messages: 15
Registered: June 2010
Junior Member
I did try that before and no change. I've done it again to make sure. Here are the configs from the service component's manifest which is contained inside the PAR along with the other modules and the dozer-osgi dependency:

org.dozer;import-scope:=application,
org.dozer.util;import-scope:=application,
ca.company.types;import-scope:=application,


and here is the output:

org.dozer.MappingException: java.lang.ClassNotFoundException: ca.company.types.objType
	org.dozer.util.MappingUtils.throwMappingException(MappingUtils.java:88)
	org.dozer.util.DefaultClassLoader.loadClass(DefaultClassLoader.java:33)
	org.dozer.util.MappingUtils.loadClass(MappingUtils.java:228)
	org.dozer.loader.DozerBuilder$MappingBuilder.classA(DozerBuilder.java:140)
	org.dozer.loader.xml.XMLParser.parseMapping(XMLParser.java:197)
...


Still stuck.
FIXED - Re: ClassNotFoundException inside PAR [message #546702 is a reply to message #546653] Tue, 13 July 2010 16:15 Go to previous messageGo to next message
No real name is currently offline No real name
Messages: 15
Registered: June 2010
Junior Member
K, I resolved my issue.

While debugging the issue I noticed that the BundleClassLoader that was being used to instantiate the object type inside the dozer bundle had visibility of only the webapp imported components even though it was located inside a PAR where the synthetic context should have caused all included bundle's exports to be imported. Further, the webapp was calling a service (inside a service bundle) that was using dozer and hence this should have been abstracted from the webapp. I'm not sure why this is the case, but adding the dozer (application scope) imports explicitly to the webapp manifest satisfied the classloader.

For reference, this is what I added to both the service and webapp bundle to resolve my issue:
org.dozer;import-scope:=application,
org.dozer.util;import-scope:=application,
ca.company.types;import-scope:=application


Thanks,
- Paul
Re: FIXED - Re: ClassNotFoundException inside PAR [message #546786 is a reply to message #546702] Wed, 14 July 2010 04:32 Go to previous message
Glyn Normington is currently offline Glyn Normington
Messages: 1222
Registered: July 2009
Senior Member
I would be surprised if there was a bug in the synthetic context bundle. If you are interested, please examine the wiring in the failing case and see if the synthetic context bundle really is in error and raise a bug with details if so.

However glad to see you are in business now!
Re: ClassNotFoundException inside PAR [message #590406 is a reply to message #546661] Tue, 13 July 2010 13:21 Go to previous message
No real name is currently offline No real name
Messages: 15
Registered: June 2010
Junior Member
I did try that before and no change. I've done it again to make sure. Here are the configs from the service component's manifest which is contained inside the PAR along with the other modules and the dozer-osgi dependency:


org.dozer;import-scope:=application,
org.dozer.util;import-scope:=application,
ca.company.types;import-scope:=application,


and here is the output:

org.dozer.MappingException: java.lang.ClassNotFoundException: ca.company.types.objType
org.dozer.util.MappingUtils.throwMappingException(MappingUti ls.java:88)
org.dozer.util.DefaultClassLoader.loadClass(DefaultClassLoad er.java:33)
org.dozer.util.MappingUtils.loadClass(MappingUtils.java:228)
org.dozer.loader.DozerBuilder$MappingBuilder.classA(DozerBui lder.java:140)
org.dozer.loader.xml.XMLParser.parseMapping(XMLParser.java:1 97)
...

Still stuck.
Previous Topic:Problems deploying war file
Next Topic:ClassNotFoundException inside PAR
Goto Forum:
  


Current Time: Thu Aug 21 10:13:51 EDT 2014

Powered by FUDForum. Page generated in 0.02807 seconds