You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by maaruks <ma...@gmail.com> on 2012/05/04 13:07:32 UTC

classpath resources in generated bundle

I generated bundle from a jar file.

There is some some spring code that needs to access classpath resources from
*conf* directory.
Of course it doesn't work:

Caused by: java.io.FileNotFoundException: class path resource
[conf/core-defaults.properties] cannot be opened because it does not exist
	at
org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:158)

How can I grant access to *conf* ?

--
View this message in context: http://karaf.922171.n3.nabble.com/classpath-resources-in-generated-bundle-tp3961913.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: classpath resources in generated bundle

Posted by asookazian2 <as...@gmail.com>.
Well wierd thing is that I could not see those packages in two text editors
and exploding the WAR.  But apparently it was there otherwise I would not
see this exception in karaf after update:

2014-04-25 15:27:29,217 | ERROR | Local user karaf | ShellUtil                       
| 48 - org.apache.karaf.shell.console - 3.0.0 | Exception caught while
executing command
org.osgi.framework.BundleException: Unresolved constraint in bundle
workflow-ws-server [258]: Unable to resolve 258.4: missing requirement
[258.4] osgi.wiring.package; (osgi.wiring.package=com.nextgate.mm.mappers)




--
View this message in context: http://karaf.922171.n3.nabble.com/classpath-resources-in-generated-bundle-tp3961913p4032980.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: classpath resources in generated bundle

Posted by asookazian2 <as...@gmail.com>.
Those packages exists in JARs in WEB-INF/lib dir in the WAB.



--
View this message in context: http://karaf.922171.n3.nabble.com/classpath-resources-in-generated-bundle-tp3961913p4032979.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: classpath resources in generated bundle

Posted by asookazian2 <as...@gmail.com>.
I tried the following:

<Import-Package>
com.nextgate.mm.mappers
,org.activiti.db.mapping.entity
</Import-Package>

<Export-Package>com.nextgate.mm.mappers.*
                          ,org.activiti.db.mapping.entity.*
</Export-Package>

And maven-bundle-plugin is not adding those in the manifest.mf.  Same if I
only export.





--
View this message in context: http://karaf.922171.n3.nabble.com/classpath-resources-in-generated-bundle-tp3961913p4032978.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: classpath resources in generated bundle

Posted by asookazian2 <as...@gmail.com>.
I just tried the following:

<Export-Package>
	WEB-INF.lib
</Export-Package>

and it does not show up in the maven-bundle-plugin generated MANIFEST.MF...



--
View this message in context: http://karaf.922171.n3.nabble.com/classpath-resources-in-generated-bundle-tp3961913p4032977.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: classpath resources in generated bundle

Posted by Achim Nierbeck <bc...@googlemail.com>.
You need to export it as a Package, therefore the Export-Package
definition in the manifest has to contain your conf directory.

regards, Achim

2012/5/4 maaruks <ma...@gmail.com>:
>
> I generated bundle from a jar file.
>
> There is some some spring code that needs to access classpath resources from
> *conf* directory.
> Of course it doesn't work:
>
> Caused by: java.io.FileNotFoundException: class path resource
> [conf/core-defaults.properties] cannot be opened because it does not exist
>        at
> org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:158)
>
> How can I grant access to *conf* ?
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/classpath-resources-in-generated-bundle-tp3961913.html
> Sent from the Karaf - User mailing list archive at Nabble.com.



-- 

Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/>
Committer & Project Lead
OPS4J Pax for Vaadin
<http://team.ops4j.org/wiki/display/PAXVAADIN/Home> Commiter & Project
Lead
blog <http://notizblog.nierbeck.de/>