Hi, In your pom.xml, you need configure maven-bundle-plugin to add Import-Package "org.apache.camel" ------------- Freeman(Yue) Fang
Red Hat, Inc. FuseSource is now part of Red Hat Web: http://fusesource.com | http://www.redhat.com/ Twitter: freemanfang Blog: http://freemanfang.blogspot.com http://blog.sina.com.cn/u/1473905042 weibo: @Freeman小屋 On 2013-6-12, at 下午2:19, krishnagjs wrote: > My camel-context.xml file is: > > <?xml version="1.0" encoding="UTF-8"?> > > > <beans xmlns="http://www.springframework.org/schema/beans" > xmlns:beans="http://www.springframework.org/schema/beans" > xmlns:camel="http://camel.apache.org/schema/spring" > xmlns:osgi="http://www.springframework.org/schema/osgi" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xmlns:osgix="http://www.springframework.org/schema/osgi-compendium" > xmlns:ctx="http://www.springframework.org/schema/context" > xsi:schemaLocation="http://www.springframework.org/schema/beans > http://www.springframework.org/schema/beans/spring-beans.xsd > http://www.springframework.org/schema/osgi > http://www.springframework.org/schema/osgi/spring-osgi.xsd > http://camel.apache.org/schema/spring > http://camel.apache.org/schema/spring/camel-spring.xsd > http://www.springframework.org/schema/osgi-compendium > > http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd > http://www.springframework.org/schema/context > > http://www.springframework.org/schema/context/spring-context.xsd"> > > > > > <camel:camelContext xmlns="http://camel.apache.org/schema/spring"> > > <camel:route> > <camel:from uri="file:C:/KKInput" /> > <camel:to uri="bean:myBean?method=readFile"></camel:to> > <camel:to uri="file:C:/KKoutput" /> > </camel:route> > </camel:camelContext> > <bean id="myBean" class="com.wipro.filereader.FileReader"></bean> > </beans> > > My pom.xml is: > <?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> > > <groupId>com.wipro.example</groupId> > <artifactId>Example</artifactId> > <packaging>jar</packaging> > <version>0.0.1</version> > > <name>A Camel Spring Route</name> > <url>http://www.myorganization.org</url> > > <properties> > > <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> > > <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> > </properties> > > <dependencies> > <dependency> > <groupId>org.apache.camel</groupId> > <artifactId>camel-core</artifactId> > <version>2.11.0</version> > </dependency> > <dependency> > <groupId>org.apache.camel</groupId> > <artifactId>camel-spring</artifactId> > <version>2.11.0</version> > </dependency> > > > <dependency> > <groupId>org.slf4j</groupId> > <artifactId>slf4j-api</artifactId> > <version>1.7.5</version> > </dependency> > <dependency> > <groupId>org.slf4j</groupId> > <artifactId>slf4j-log4j12</artifactId> > <version>1.7.5</version> > </dependency> > <dependency> > <groupId>log4j</groupId> > <artifactId>log4j</artifactId> > <version>1.2.17</version> > </dependency> > > > <dependency> > <groupId>org.apache.camel</groupId> > <artifactId>camel-test-spring</artifactId> > <version>2.11.0</version> > <scope>test</scope> > </dependency> > > </dependencies> > > <build> > <defaultGoal>install</defaultGoal> > > <plugins> > <plugin> > <groupId>org.apache.maven.plugins</groupId> > <artifactId>maven-compiler-plugin</artifactId> > <version>2.5.1</version> > <configuration> > <source>1.6</source> > <target>1.6</target> > </configuration> > </plugin> > <plugin> > <groupId>org.apache.maven.plugins</groupId> > <artifactId>maven-resources-plugin</artifactId> > <version>2.6</version> > <configuration> > <encoding>UTF-8</encoding> > </configuration> > </plugin> > > > <plugin> > <groupId>org.apache.camel</groupId> > <artifactId>camel-maven-plugin</artifactId> > <version>2.11.0</version> > </plugin> > > </plugins> > </build> > > </project> > > I am trying to read the content of the file and try to print it in the > console. So the following is my java class: > package com.wipro.filereader; > > import org.apache.camel.Exchange; > > public class FileReader { > public void readFile(Exchange exchange) { > System.out.println(exchange.getIn().getBody()); > } > } > When I try to start in Servicemix 4.5.0 I am getting the following error > Exception in thread "SpringOsgiExtenderThread-6" > org.springframework.beans.factory.BeanCreationException: Error creating bean > with name 'myBean' defined in URL > [bundle://84.6:0/META-INF/spring/camel-context.xml]: Initialization of bean > failed; nested exception is java.lang.NoClassDefFoundError: > org/apache/camel/Exchange > > I ve also added camel-core.jar and restarted the bundle but nothing worked. > I could not identify what is the problem. > > > > > > > -- > View this message in context: > http://servicemix.396122.n5.nabble.com/Getting-NoClassDefFoundError-while-starting-the-bundle-tp5716990.html > Sent from the ServiceMix - Dev mailing list archive at Nabble.com.
