The IBatisComponent is using DefaultResourceLoader to load the resource, it will try to use the thread context classloader to load the resource. It's looks like the blueprint doesn't set the thread context classloader with your bundle classloader.
Can you try to define the Spring.xml to try again, if I remember right Spring DM will set the thread context classloader with the bundle classloader when it create the application context.
Willem On 3/23/11 10:24 PM, Michael Dewitte wrote:
Hello, I've got some hard time trying to use a route using ibatis component and deployed on karaf (in fact, servicemix). I made a bundle, using blueprint, in which I placed my blueprint and the config files for ibatis. Deploy is just fine, but soon as the route is activated (dropping a file into the "input" directory), I got an exception : java.io.FileNotFoundException: class path resource [SqlMapConfig.xml] cannot be opened because it does not exist at org.springframework.core.io..getInputStream(ClassPathResource.java:158)[56:org.springframework.core:3.0.5.RELEASE] at org.apache.camel.component.ibatis.IBatisComponent.createSqlMapClient(IBatisComponent.java:88)[225:org.apache.camel.camel-ibatis:2.6.0] at org.apache.camel.component.ibatis.IBatisComponent.getSqlMapClient(IBatisComponent.java:104)[225:org.apache.camel.camel-ibatis:2.6.0] at org.apache.camel.component.ibatis.IBatisEndpoint.getSqlMapClient(IBatisEndpoint.java:77)[225:org.apache.camel.camel-ibatis:2.6.0] The structure of the jar is as follow : |-SqlMapConfig.xml |-Users.xml (the maps definitions) |-OSGI-INF |-blueprint |-blueprint.xml |-META-INF |MANIFEST.MF Here is my SqlMapConfig.xml : ----------------------------------------------- <sqlMapConfig> <transactionManager type="JDBC" commitRequired="false"> <dataSource type="SIMPLE"> <property name="JDBC.Driver" value="com.mysql.jdbc.Driver"/> <property name="JDBC.ConnectionURL" value="jdbc:mysql://localhost:3306/forem_1"/> <property name="JDBC.Username" value="root"/> <property name="JDBC.Password" value="mysql"/> </dataSource> </transactionManager> <sqlMap resource="User.xml"/> </sqlMapConfig> Here is my Users.xml : ---------------------------------------------- <sqlMap> <delete id="deleteUser"> delete from transfert_outbound where correlationId = 2 </delete> </sqlMap> Here is my blueprint.xml : ---------------------------------------------- <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd"> <camelContext xmlns="http://camel.apache.org/schema/blueprint"> <route> <from uri="file:activemq/input"/> <to uri="file:activemq/output"/> <setBody> <simple> NEW FileMovedEvent(file: ${file:name}, timestamp: ${date:now:hh:MM:ss.SSS}) </simple> </setBody> <to uri="log:events"/> <to uri="ibatis:deleteUser?statementType=Delete"/> </route> </camelContext> </blueprint> and here is my pom.xml ------------------------------------ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.apache.servicemix.features</groupId> <artifactId>features</artifactId> <version>4.3.0</version> </parent> <groupId>testing.servicemix.example</groupId> <artifactId>ibatistest</artifactId> <packaging>bundle</packaging> <version>1.0-SNAPSHOT</version> <name>iBatis test</name> <properties> <!-- Camel --> <camel-version>2.6.0</camel-version> </properties> <dependencies> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-core</artifactId> <version>${camel-version}</version> </dependency> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-spring</artifactId> <version>${camel-version}</version> </dependency> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-ibatis</artifactId> <version>${camel-version}</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> <configuration> <instructions> <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName> <Import-Package>*,org.apache.camel.osgi</Import-Package> <Private-Package>org.apache.servicemix.examples.camel</Private-Package> </instructions> </configuration> </plugin> </plugins> </build> </project> Any clue ??? Thx in advance, Mike
-- Willem ---------------------------------- FuseSource Web: http://www.fusesource.com Blog: http://willemjiang.blogspot.com (English) http://jnn.javaeye.com (Chinese) Twitter: willemjiang