mavenapache-camelmaven-2apache-servicemixfuseesb

relative path of resource files?


when i deploy a project to servicemix i do a "mvn install" then inside servicemix i simply do: "osgi:install -s mvn:my.package.x/proj". now when i want to reference a file inside the package i get a "file not found exception" in my .m2 directory the package structure inside the jar looks like this (if i unpack to look):

servicemixTest-0.0.1-SNAPSHOT
--my
----package
------processingFile.class
--resources
------xsl
---------fileForTransformation.xsl

now in the processing Class i need to reference the xsl file with camel like this:

.from(url) .to("xslt:file:./data/xsl/transformation.xsl") .process()

i already tried:

my question is now: "how do I find resource files inside a deployed container?"


Solution

  • If your XSL file is packaged in the JAR file, you don't need the file: part in the URI. You can just refer to the location inside the JAR directly, like this:

    from("direct:start").to("xsl:resources/xsl/fileForTransformation.xsl").process()