Hi Aube,

I think that using bundle fragments should solve your issue.

Regards
JB

On 10/19/2010 11:53 AM, Auke wrote:

Hello,

I'm using inside servicemix (4.3.0-fuse-02-00) the following two routes:


<cs:route id="odsAdapterRoute">
   <cs:from uri="jetty:http://0.0.0.0:9004/odsadapter?matchOnUriPrefix=true";
/>
   <cs:bean ref="odsAdapter" method="convertParameterToIbatisParameter" />
   <cs:to
uri="ibatis:item.selectItemByName?statementType=QueryForList&amp;consumer.routeEmptyResultSet=true"
/>
   <cs:process ref="resultListToItemListProcessor" />
   <cs:marshal ref="myJaxb" />
</cs:route>

<cs:route id="searchOdsRoute2" trace="true">
   <cs:from uri="cxfrs:bean:odsService"/>
   <cs:process ref="queryToIbatisParameterProcessor" />
   <cs:to
uri="ibatis:item.selectItemByName?statementType=QueryForList&amp;consumer.routeEmptyResultSet=true"
/>
   <cs:process ref="resultListToItemListProcessor" />
   <cs:marshal ref="myJaxb" />
</cs:route>


Both use the same query defined in my sqlMapConfig.xml file:


<sqlMapConfig>
        ...
        <sqlMap resource="sqlmap/Item.xml" />
</sqlMapConfig>


Now the top route works, but the bottom one doesn't and fail with an
IOException: : Could not find resource sqlmap/Item.xml. I dug into it and
found that the one that works eventually ends up (deep in iBATIS) in
Resource.getResourceAsStream() with the classloader of the current bundle:
BundleDelegatingClassLoader for [ODS Adapter (ods-adapter)] whereas the
second route ends up in the exact same method with the following
classloader: BundleDelegatingClassLoader for [Apache CXF Bundle Jar
(org.apache.cxf.bundle)].

I can understand why it doesn't find the resource (sqlmap/Item.xml) in the
second case, but I don't understand why my classloader is different in the
second route. Is that something basic that I don't understand about
OSGi/bundle classloading? I've tried to export the file by saying
<Export-Package>sqlMap, ...</Export-Package>  but that doesn't seem to work.

Kind regards,

Auke

Reply via email to