Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Gemini » issues reading classpath resources using Spring and Karaf
issues reading classpath resources using Spring and Karaf [message #1322451] Tue, 29 April 2014 21:39 Go to next message
Arbi Sookazian is currently offline Arbi SookazianFriend
Messages: 4
Registered: March 2010
Junior Member
Using Karaf 3.0.0 to port J2EE WAR apps to OSGi. Having issues with finding classpath resources in applicationContext.xml, for example. Please view this thread in karaf forum (not getting much help: 'Does not exist in file system' is the topic). thx.

I have tried to simplify the trouble-shooting of this problem by cloning the Eclipse project and breaking down to bare bones classes, xml, etc.

Now the problem I'm having is that the Spring beans config xml does not seem to be being found and/or parsed b/c I have an invalid bean config in there (for testing purposes) with a reference to a non-existing bean (which should cause an exception during parsing/resolution by Spring). No exception is thrown in the karaf log.

I have the following export-package config in pom.xml:

<Export-Package>
'=WEB-INF.lib',
'=WEB-INF',
'=WEB-INF.lib.classes',
</Export-Package>

The Spring config file is in WEB-INF/classes directory in the WAB.

I have also tried exploding the WAR and moving the Spring config xml to WEB-INF (this is how it works in another successfully deployed WAB) and copying exploded directory to deploy dir in karaf. Same behavior, no exception on startup of karaf.

Here is the partial web.xml:

<servlet>
<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/workflow-ws-context.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>

Finding resources with Spring/karaf seems like such a nightmare....

Please advise. thx.
Re: issues reading classpath resources using Spring and Karaf [message #1322468 is a reply to message #1322451] Tue, 29 April 2014 21:48 Go to previous message
Dmitry Sklyut is currently offline Dmitry SklyutFriend
Messages: 279
Registered: January 2010
Senior Member
Hello Arbi,

Quote:

<Export-Package>
'=WEB-INF.lib',
'=WEB-INF',
'=WEB-INF.lib.classes',
</Export-Package>


Your export package looks incorrect. Those are not packages but locations within an archive that contain resources/classes. Those things should go under http://wiki.osgi.org/wiki/Bundle-ClassPath header.

What are you using as servlet container? What tool are you using for manifest generation? Why would you be exporting packages from a web application? You might want to take a look at how web application bundles are structures by looking in Virgo (http://www.eclipse.org/virgo/) and Gemini Web (https://www.eclipse.org/gemini/web/) repos and in here (http://www.eclipse.org/virgo/documentation/virgo-documentation-3.6.2.RELEASE/docs/virgo-programmer-guide/html/ch05.html#migrating-to-osgi-web).

Kind Regards,
Dmitry
Previous Topic:Old XSD for compendium in Blueprint 2.0.0.M02
Next Topic:Can't find NamespaceHandler
Goto Forum:
  


Current Time: Fri Apr 26 07:26:08 GMT 2024

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

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

Back to the top