Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » ClassNotFoundException when using bundled spring-context-support(Unable to find a class embedded inside a war)
ClassNotFoundException when using bundled spring-context-support [message #757311] Thu, 17 November 2011 16:15 Go to next message
Balaji  is currently offline Balaji Friend
Messages: 10
Registered: December 2010
Junior Member
My application war works when deployed on virgo server.

I'm trying to make it a shared services war directly.

The war has some libraries in its WEB/INF lib.

I removed spring core,config,bean,context dependencies from WEB-INF/lib and added a library import into the manifest.

I have configured my web xml to use the osgified context class.

The spring-context-support package throws a ClassNotFoundException on one of the classes which is present in a jar inside WEB-INF/lib folder of my war

a clhas on the class shows that my war indeed has the class

I have the tried following
-----------------------------
1. exporting the package from inside the war through export-package header in manifest.

What am I missing?
Re: ClassNotFoundException when using bundled spring-context-support [message #757314 is a reply to message #757311] Thu, 17 November 2011 16:17 Go to previous messageGo to next message
Dmitry Sklyut is currently offline Dmitry SklyutFriend
Messages: 279
Registered: January 2010
Senior Member
Can you post your web.xml and MANIFEST.MF as well as the full stacktrace?

Thanks
Dmitry
Re: ClassNotFoundException when using bundled spring-context-support [message #757315 is a reply to message #757314] Thu, 17 November 2011 16:28 Go to previous messageGo to next message
Balaji  is currently offline Balaji Friend
Messages: 10
Registered: December 2010
Junior Member
I have attached all the three files
  • Attachment: web.xml
    (Size: 3.64KB, Downloaded 338 times)
  • Attachment: MANIFEST.MF
    (Size: 0.49KB, Downloaded 248 times)
  • Attachment: strace
    (Size: 54.01KB, Downloaded 246 times)
Re: ClassNotFoundException when using bundled spring-context-support [message #757323 is a reply to message #757315] Thu, 17 November 2011 17:25 Go to previous messageGo to next message
Dmitry Sklyut is currently offline Dmitry SklyutFriend
Messages: 279
Registered: January 2010
Senior Member
Can you check that you have org/quartz/ObjectAlreadyExistsException in lib folder?

Dmitry
Re: ClassNotFoundException when using bundled spring-context-support [message #757326 is a reply to message #757323] Thu, 17 November 2011 17:56 Go to previous messageGo to next message
Balaji  is currently offline Balaji Friend
Messages: 10
Registered: December 2010
Junior Member
Its inside a jar in my lib folder. Yes
Re: ClassNotFoundException when using bundled spring-context-support [message #757328 is a reply to message #757326] Thu, 17 November 2011 18:07 Go to previous messageGo to next message
Dmitry Sklyut is currently offline Dmitry SklyutFriend
Messages: 279
Registered: January 2010
Senior Member
The only other thing that I can recommend is to try setting web header setting to defaulted if you have not done so.

If that does not work - jack up logging to debug and take a look at the generated manifest. It looks like libraries that are in the WEB-INF/lib are not added to the bundle class path header.

Look in programmer guide for details
Re: ClassNotFoundException when using bundled spring-context-support [message #757332 is a reply to message #757328] Thu, 17 November 2011 18:39 Go to previous messageGo to next message
Balaji  is currently offline Balaji Friend
Messages: 10
Registered: December 2010
Junior Member
Was going through the logs. It might just be the case that the path to the dependency may not be my system at all. springframework.context package exports springframework.scheduling and uses quartz in the directive.Can it have to do with the packaging of context or context support?

[Updated on: Thu, 17 November 2011 18:39]

Report message to a moderator

Re: ClassNotFoundException when using bundled spring-context-support [message #757335 is a reply to message #757332] Thu, 17 November 2011 18:49 Go to previous messageGo to next message
Dmitry Sklyut is currently offline Dmitry SklyutFriend
Messages: 279
Registered: January 2010
Senior Member
I don't think it has anything to do with spring imports/exports. You are doing Import-Library that will make all spring available for use. All classloading "should" be backed by your WAB Bundle.
I would still check that bundle classpath is properly setup and WEB-INF/lib jars are added to the Bundle-ClassPath manifest entry during transformation.

Can you also check what is the value of $VIRGO_HOME/repository/ext/org.eclipse.virgo.web.properties WABHeaders property. If it is "strict" - try to change it to "defaulted"

If that does not help: explicitly configure Bnd to add all of the WEB-INF/lib jar to the Bundle-ClassPath.

Bundle-ClassPath: .,/WEB-INF/lib/jar1.jar,/WEB-INF/lib/quartz.jar, etc

[Updated on: Thu, 17 November 2011 18:49]

Report message to a moderator

Re: ClassNotFoundException when using bundled spring-context-support [message #757384 is a reply to message #757335] Fri, 18 November 2011 07:13 Go to previous messageGo to next message
Balaji  is currently offline Balaji Friend
Messages: 10
Registered: December 2010
Junior Member
I'm using the defaulted mode and my Bundle-Classpath seems okay. Infact my webapp started up without any problems when I was embedding spring dependencies. Also after I have made spring dependencies provided, clhas can resolve the class to my bundle. Which begs the question. context-support imports quartz with optional resolution. I was not able to find a bundle that exports it. In which case, it can fail silently. Can this be a possible explanation?

PS: The class it is trying to autowire in my application does not depend upon quartz
Re: ClassNotFoundException when using bundled spring-context-support [message #757474 is a reply to message #757384] Fri, 18 November 2011 15:12 Go to previous messageGo to next message
Dmitry Sklyut is currently offline Dmitry SklyutFriend
Messages: 279
Registered: January 2010
Senior Member
I am trying to find a word that will express "brain freeze"/"what I was thinking" and can only come up with Dah!!!

Sorry for prior confusion. YES - ClassNotFound makes perfect sense. You have to move quartz from your web-app into shared location so shared spring can bind to it during resolution. If you are using shared spring you have to provide all of the spring framework optional dependencies that you are planning to use as shared dependencies in /repository/usr or similar. You have to do it prior to shared spring instance starting up, that means before virgo is started.

Error creating bean with name 'clinicianSecurityGroup': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.motechproject.tama.repository.AllClinicians org.motechproject.tama.security.profiles.ClinicianSecurityGroup.clinicians; nested exception is java.lang.NoClassDefFoundError: org/quartz/ObjectAlreadyExistsException 


Take a look at ClinicianSecurityGroup and its AllClinicians field to see if it is using Quartz.

Re: ClassNotFoundException when using bundled spring-context-support [message #758198 is a reply to message #757474] Tue, 22 November 2011 10:11 Go to previous message
Balaji  is currently offline Balaji Friend
Messages: 10
Registered: December 2010
Junior Member
Sorry for the late reply. The solution worked. Thank you
Previous Topic:Bundlor 1.1.0.M02 released
Next Topic:Dynamic class loading in fragment
Goto Forum:
  


Current Time: Thu Mar 28 10:39:22 GMT 2024

Powered by FUDForum. Page generated in 0.04723 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top