You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by krishnagjs <kr...@wipro.com> on 2013/06/28 07:07:32 UTC

ClassnotfoundException

I have developed a simple camel route with ActiveMQ endpoint. The pom file
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>ActiveMQExample</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>

	<repositories>
		<repository>
			<id>release.fusesource.org</id>
			<name>FuseSource Release Repository</name>
			<url>http://repo.fusesource.com/nexus/content/repositories/releases</url>
			<snapshots>
				<enabled>false</enabled>
			</snapshots>
			<releases>
				<enabled>true</enabled>
			</releases>
		</repository>
		<repository>
			<id>snapshot.fusesource.org</id>
			<name>FuseSource Snapshot Repository</name>
		
<url>http://repo.fusesource.com/nexus/content/repositories/snapshots</url>
			<snapshots>
				<enabled>true</enabled>
			</snapshots>
			<releases>
				<enabled>false</enabled>
			</releases>
		</repository>
	</repositories>

	<pluginRepositories>
		<pluginRepository>
			<id>release.fusesource.org</id>
			<name>FuseSource Release Repository</name>
			<url>http://repo.fusesource.com/nexus/content/repositories/releases</url>
			<snapshots>
				<enabled>false</enabled>
			</snapshots>
			<releases>
				<enabled>true</enabled>
			</releases>
		</pluginRepository>
		<pluginRepository>
			<id>snapshot.fusesource.org</id>
			<name>FuseSource Snapshot Repository</name>
		
<url>http://repo.fusesource.com/nexus/content/repositories/snapshots</url>
			<snapshots>
				<enabled>true</enabled>
			</snapshots>
			<releases>
				<enabled>false</enabled>
			</releases>
		</pluginRepository>
	</pluginRepositories>

	<dependencies>
		
		<dependency>
			<groupId>org.apache.camel</groupId>
			<artifactId>camel-core</artifactId>
			<version>2.10.0</version>
		</dependency>
		<dependency>
			<groupId>org.apache.camel</groupId>
			<artifactId>camel-spring</artifactId>
			<version>2.10.0</version>
		</dependency>
		<dependency>
			<groupId>org.apache.camel</groupId>
			<artifactId>camel-jms</artifactId>
			<version>2.10.1</version>
		</dependency>
		<dependency>
			<groupId>org.apache.activemq</groupId>
			<artifactId>activemq-camel</artifactId>
			<version>5.7.0</version>
		</dependency>

		
		
		

		
		<dependency>
			<groupId>org.apache.camel</groupId>
			<artifactId>camel-test-spring</artifactId>
			<version>2.10.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>
					<instructions>
						<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
						<Import-Package>org.apache.activemq.xbean,
							org.apache.activemq.spring,
							org.apache.activemq.broker,
							org.apache.activemq.security,
							org.apache.activemq.jaas,
							org.apache.activemq.pool,
							org.apache.activemq.camel.component,
							org.apache.camel.component.jms;version="[2.10,2.9)",
							*</Import-Package>
						
					
<Private-Package>org.apache.servicemix.examples.camel</Private-Package>
					</instructions>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-resources-plugin</artifactId>
				<version>2.4.3</version>
				<configuration>
					<encoding>UTF-8</encoding>
				</configuration>
			</plugin>

			
			<plugin>
				<groupId>org.apache.camel</groupId>
				<artifactId>camel-maven-plugin</artifactId>
				<version>2.10.0.redhat-60024</version>
			</plugin>
			<plugin>
				<groupId>org.apache.felix</groupId>
				<artifactId>maven-bundle-plugin</artifactId>
				<version>2.3.7</version>
				<extensions>true</extensions>
			</plugin>
		</plugins>
	</build>

</project>


camel-context file is:
<?xml version="1.0" encoding="UTF-8"?>


<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="
   http://www.springframework.org/schema/beans 
   http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
   http://camel.apache.org/schema/spring 
   http://camel.apache.org/schema/spring/camel-spring.xsd">

	<camelContext xmlns="http://camel.apache.org/schema/spring">
		
		<route>
			<from uri="file://C:/ActiveMQInuput" />
			<transform>
				<constant>Hello world!</constant>
			</transform>
			<to uri="activemq:queue:KK.test" />
		</route>
	</camelContext>
	<bean id="pooledConnectionFactory"
class="org.apache.activemq.pool.PooledConnectionFactory">
		<property name="maxConnections" value="8" />
		<property name="maximumActive" value="500" />
		<property name="connectionFactory" ref="jmsConnectionFactory" />
	</bean>
	
</beans>

When i deploy and try to start this bundle in servicemix I am getting the
following error:
karaf@root> Exception in thread "SpringOsgiExtenderThread-4"
org.springframework.beans.factory.BeanC
reationException: Error creating bean with name 'camel-4': Invocation of
init method failed; nested
exception is org.springframework.beans.factory.CannotLoadBeanClassException:
Cannot find class [org.
apache.activemq.pool.PooledConnectionFactory] for bean with name
'pooledConnectionFactory' defined i
n URL [bundle://148.27:0/META-INF/spring/camel-context.xml]; nested
exception is java.lang.ClassNotF
oundException: org.apache.activemq.pool.PooledConnectionFactory not found
from bundle [null]
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBe
an(AbstractAutowireCapableBeanFactory.java:1422)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean
(AbstractAutowireCapableBeanFactory.java:518)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(A
bstractAutowireCapableBeanFactory.java:455)
        at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFac
tory.java:293)
        at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(Defau
ltSingletonBeanRegistry.java:222)
        at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFacto
ry.java:290)
        at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory
.java:192)
        at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingle
tons(DefaultListableBeanFactory.java:567)
        at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitializ
ation(AbstractApplicationContext.java:895)
        at
org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.acc
ess$1600(AbstractDelegatedExecutionApplicationContext.java:69)
        at
org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.r
un(AbstractDelegatedExecutionApplicationContext.java:355)
        at
org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUt
ils.java:85)
        at
org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.com
pleteRefresh(AbstractDelegatedExecutionApplicationContext.java:320)
        at
org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicati
onContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)
        at java.lang.Thread.run(Thread.java:722)
Caused by: org.springframework.beans.factory.CannotLoadBeanClassException:
Cannot find class [org.ap
ache.activemq.pool.PooledConnectionFactory] for bean with name
'pooledConnectionFactory' defined in
URL [bundle://148.27:0/META-INF/spring/camel-context.xml]; nested exception
is java.lang.ClassNotFou
ndException: org.apache.activemq.pool.PooledConnectionFactory not found from
bundle [null]
        at
org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBe
anFactory.java:1261)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanT
ype(AbstractAutowireCapableBeanFactory.java:575)
        at
org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanF
actory.java:1330)
        at
org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(
DefaultListableBeanFactory.java:317)
        at
org.springframework.context.support.AbstractApplicationContext.getBeanNamesForType(Abstra
ctApplicationContext.java:1136)
        at
org.apache.camel.spring.CamelContextFactoryBean.getBeanForType(CamelContextFactoryBean.ja
va:177)
        at
org.apache.camel.core.xml.AbstractCamelContextFactoryBean.afterPropertiesSet(AbstractCame
lContextFactoryBean.java:137)
        at
org.apache.camel.osgi.CamelContextFactoryBean.afterPropertiesSet(CamelContextFactoryBean.
java:64)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMe
thods(AbstractAutowireCapableBeanFactory.java:1479)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBe
an(AbstractAutowireCapableBeanFactory.java:1419)
        ... 14 more
Caused by: java.lang.ClassNotFoundException:
org.apache.activemq.pool.PooledConnectionFactory not fo
und from bundle [null]
        at
org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(BundleDelegatingClass
Loader.java:103)
        at
org.springframework.osgi.util.BundleDelegatingClassLoader.loadClass(BundleDelegatingClass
Loader.java:156)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
        at org.springframework.util.ClassUtils.forName(ClassUtils.java:257)
        at
org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(Abstrac
tBeanDefinition.java:408)
        at
org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(Abstract
BeanFactory.java:1282)
        at
org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBe
anFactory.java:1253)
        ... 23 more
Caused by: java.lang.ClassNotFoundException:
org.apache.activemq.pool.PooledConnectionFactory not fo
und by [148]
        at
org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:812
)
        at
org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:72)
        at
org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1807)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
        at
org.apache.felix.framework.ModuleImpl.getClassByDelegation(ModuleImpl.java:670)
        at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1654)
        at
org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:909)
        at
org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(BundleDelegatingClass
Loader.java:99)
        ... 29 more
I have added all the required jars in classpath but I could not find the
solution.
Please Help me. Thanks in advance




--
View this message in context: http://camel.465427.n5.nabble.com/ClassnotfoundException-tp5734946.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: ClassnotfoundException

Posted by Christian Müller <ch...@gmail.com>.
This is not a valid version range:
org.apache.camel.component.jms;version="[2.10,2.9)"
Do you mean: org.apache.camel.component.jms;version="[2.10,2.11)"?

Best,
Christian
-----------------

Software Integration Specialist

Apache Camel committer: https://camel.apache.org/team
V.P. Apache Camel: https://www.apache.org/foundation/
Apache Member: https://www.apache.org/foundation/members.html

https://www.linkedin.com/pub/christian-mueller/11/551/642


On Fri, Jun 28, 2013 at 7:07 AM, krishnagjs <
krishnakumar.parthasathy@wipro.com> wrote:

> I have developed a simple camel route with ActiveMQ endpoint. The pom file
> 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>ActiveMQExample</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>
>
>         <repositories>
>                 <repository>
>                         <id>release.fusesource.org</id>
>                         <name>FuseSource Release Repository</name>
>                         <url>
> http://repo.fusesource.com/nexus/content/repositories/releases</url>
>                         <snapshots>
>                                 <enabled>false</enabled>
>                         </snapshots>
>                         <releases>
>                                 <enabled>true</enabled>
>                         </releases>
>                 </repository>
>                 <repository>
>                         <id>snapshot.fusesource.org</id>
>                         <name>FuseSource Snapshot Repository</name>
>
> <url>http://repo.fusesource.com/nexus/content/repositories/snapshots</url>
>                         <snapshots>
>                                 <enabled>true</enabled>
>                         </snapshots>
>                         <releases>
>                                 <enabled>false</enabled>
>                         </releases>
>                 </repository>
>         </repositories>
>
>         <pluginRepositories>
>                 <pluginRepository>
>                         <id>release.fusesource.org</id>
>                         <name>FuseSource Release Repository</name>
>                         <url>
> http://repo.fusesource.com/nexus/content/repositories/releases</url>
>                         <snapshots>
>                                 <enabled>false</enabled>
>                         </snapshots>
>                         <releases>
>                                 <enabled>true</enabled>
>                         </releases>
>                 </pluginRepository>
>                 <pluginRepository>
>                         <id>snapshot.fusesource.org</id>
>                         <name>FuseSource Snapshot Repository</name>
>
> <url>http://repo.fusesource.com/nexus/content/repositories/snapshots</url>
>                         <snapshots>
>                                 <enabled>true</enabled>
>                         </snapshots>
>                         <releases>
>                                 <enabled>false</enabled>
>                         </releases>
>                 </pluginRepository>
>         </pluginRepositories>
>
>         <dependencies>
>
>                 <dependency>
>                         <groupId>org.apache.camel</groupId>
>                         <artifactId>camel-core</artifactId>
>                         <version>2.10.0</version>
>                 </dependency>
>                 <dependency>
>                         <groupId>org.apache.camel</groupId>
>                         <artifactId>camel-spring</artifactId>
>                         <version>2.10.0</version>
>                 </dependency>
>                 <dependency>
>                         <groupId>org.apache.camel</groupId>
>                         <artifactId>camel-jms</artifactId>
>                         <version>2.10.1</version>
>                 </dependency>
>                 <dependency>
>                         <groupId>org.apache.activemq</groupId>
>                         <artifactId>activemq-camel</artifactId>
>                         <version>5.7.0</version>
>                 </dependency>
>
>
>
>
>
>
>                 <dependency>
>                         <groupId>org.apache.camel</groupId>
>                         <artifactId>camel-test-spring</artifactId>
>                         <version>2.10.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>
>                                         <instructions>
>
> <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
>
> <Import-Package>org.apache.activemq.xbean,
>
> org.apache.activemq.spring,
>
> org.apache.activemq.broker,
>
> org.apache.activemq.security,
>
> org.apache.activemq.jaas,
>
> org.apache.activemq.pool,
>
> org.apache.activemq.camel.component,
>
> org.apache.camel.component.jms;version="[2.10,2.9)",
>                                                         *</Import-Package>
>
>
> <Private-Package>org.apache.servicemix.examples.camel</Private-Package>
>                                         </instructions>
>                                 </configuration>
>                         </plugin>
>                         <plugin>
>                                 <groupId>org.apache.maven.plugins</groupId>
>
> <artifactId>maven-resources-plugin</artifactId>
>                                 <version>2.4.3</version>
>                                 <configuration>
>                                         <encoding>UTF-8</encoding>
>                                 </configuration>
>                         </plugin>
>
>
>                         <plugin>
>                                 <groupId>org.apache.camel</groupId>
>                                 <artifactId>camel-maven-plugin</artifactId>
>                                 <version>2.10.0.redhat-60024</version>
>                         </plugin>
>                         <plugin>
>                                 <groupId>org.apache.felix</groupId>
>
> <artifactId>maven-bundle-plugin</artifactId>
>                                 <version>2.3.7</version>
>                                 <extensions>true</extensions>
>                         </plugin>
>                 </plugins>
>         </build>
>
> </project>
>
>
> camel-context file is:
> <?xml version="1.0" encoding="UTF-8"?>
>
>
> <beans xmlns="http://www.springframework.org/schema/beans"
>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>         xsi:schemaLocation="
>    http://www.springframework.org/schema/beans
>    http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>    http://camel.apache.org/schema/spring
>    http://camel.apache.org/schema/spring/camel-spring.xsd">
>
>         <camelContext xmlns="http://camel.apache.org/schema/spring">
>
>                 <route>
>                         <from uri="file://C:/ActiveMQInuput" />
>                         <transform>
>                                 <constant>Hello world!</constant>
>                         </transform>
>                         <to uri="activemq:queue:KK.test" />
>                 </route>
>         </camelContext>
>         <bean id="pooledConnectionFactory"
> class="org.apache.activemq.pool.PooledConnectionFactory">
>                 <property name="maxConnections" value="8" />
>                 <property name="maximumActive" value="500" />
>                 <property name="connectionFactory"
> ref="jmsConnectionFactory" />
>         </bean>
>
> </beans>
>
> When i deploy and try to start this bundle in servicemix I am getting the
> following error:
> karaf@root> Exception in thread "SpringOsgiExtenderThread-4"
> org.springframework.beans.factory.BeanC
> reationException: Error creating bean with name 'camel-4': Invocation of
> init method failed; nested
> exception is
> org.springframework.beans.factory.CannotLoadBeanClassException:
> Cannot find class [org.
> apache.activemq.pool.PooledConnectionFactory] for bean with name
> 'pooledConnectionFactory' defined i
> n URL [bundle://148.27:0/META-INF/spring/camel-context.xml]; nested
> exception is java.lang.ClassNotF
> oundException: org.apache.activemq.pool.PooledConnectionFactory not found
> from bundle [null]
>         at
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBe
> an(AbstractAutowireCapableBeanFactory.java:1422)
>         at
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean
> (AbstractAutowireCapableBeanFactory.java:518)
>         at
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(A
> bstractAutowireCapableBeanFactory.java:455)
>         at
>
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFac
> tory.java:293)
>         at
>
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(Defau
> ltSingletonBeanRegistry.java:222)
>         at
>
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFacto
> ry.java:290)
>         at
>
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory
> .java:192)
>         at
>
> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingle
> tons(DefaultListableBeanFactory.java:567)
>         at
>
> org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitializ
> ation(AbstractApplicationContext.java:895)
>         at
>
> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.acc
> ess$1600(AbstractDelegatedExecutionApplicationContext.java:69)
>         at
>
> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.r
> un(AbstractDelegatedExecutionApplicationContext.java:355)
>         at
>
> org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUt
> ils.java:85)
>         at
>
> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.com
> pleteRefresh(AbstractDelegatedExecutionApplicationContext.java:320)
>         at
>
> org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicati
>
> onContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)
>         at java.lang.Thread.run(Thread.java:722)
> Caused by: org.springframework.beans.factory.CannotLoadBeanClassException:
> Cannot find class [org.ap
> ache.activemq.pool.PooledConnectionFactory] for bean with name
> 'pooledConnectionFactory' defined in
> URL [bundle://148.27:0/META-INF/spring/camel-context.xml]; nested exception
> is java.lang.ClassNotFou
> ndException: org.apache.activemq.pool.PooledConnectionFactory not found
> from
> bundle [null]
>         at
>
> org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBe
> anFactory.java:1261)
>         at
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanT
> ype(AbstractAutowireCapableBeanFactory.java:575)
>         at
>
> org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanF
> actory.java:1330)
>         at
>
> org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(
> DefaultListableBeanFactory.java:317)
>         at
>
> org.springframework.context.support.AbstractApplicationContext.getBeanNamesForType(Abstra
> ctApplicationContext.java:1136)
>         at
>
> org.apache.camel.spring.CamelContextFactoryBean.getBeanForType(CamelContextFactoryBean.ja
> va:177)
>         at
>
> org.apache.camel.core.xml.AbstractCamelContextFactoryBean.afterPropertiesSet(AbstractCame
> lContextFactoryBean.java:137)
>         at
>
> org.apache.camel.osgi.CamelContextFactoryBean.afterPropertiesSet(CamelContextFactoryBean.
> java:64)
>         at
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMe
> thods(AbstractAutowireCapableBeanFactory.java:1479)
>         at
>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBe
> an(AbstractAutowireCapableBeanFactory.java:1419)
>         ... 14 more
> Caused by: java.lang.ClassNotFoundException:
> org.apache.activemq.pool.PooledConnectionFactory not fo
> und from bundle [null]
>         at
>
> org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(BundleDelegatingClass
> Loader.java:103)
>         at
>
> org.springframework.osgi.util.BundleDelegatingClassLoader.loadClass(BundleDelegatingClass
> Loader.java:156)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
>         at org.springframework.util.ClassUtils.forName(ClassUtils.java:257)
>         at
>
> org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(Abstrac
> tBeanDefinition.java:408)
>         at
>
> org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(Abstract
> BeanFactory.java:1282)
>         at
>
> org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBe
> anFactory.java:1253)
>         ... 23 more
> Caused by: java.lang.ClassNotFoundException:
> org.apache.activemq.pool.PooledConnectionFactory not fo
> und by [148]
>         at
>
> org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:812
> )
>         at
> org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:72)
>         at
>
> org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1807)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
>         at
>
> org.apache.felix.framework.ModuleImpl.getClassByDelegation(ModuleImpl.java:670)
>         at
> org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1654)
>         at
> org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:909)
>         at
>
> org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(BundleDelegatingClass
> Loader.java:99)
>         ... 29 more
> I have added all the required jars in classpath but I could not find the
> solution.
> Please Help me. Thanks in advance
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/ClassnotfoundException-tp5734946.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: ClassnotfoundException

Posted by Sean Beck <se...@gmail.com>.
Just include every possible jar file that comes with ActiveMQ. Some of the ones you include may depend on others that you dont include

krishnagjs <kr...@wipro.com> wrote:
>I have developed a simple camel route with ActiveMQ endpoint. The pom
>file
>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>ActiveMQExample</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>
>
>	<repositories>
>		<repository>
>			<id>release.fusesource.org</id>
>			<name>FuseSource Release Repository</name>
>			<url>http://repo.fusesource.com/nexus/content/repositories/releases</url>
>			<snapshots>
>				<enabled>false</enabled>
>			</snapshots>
>			<releases>
>				<enabled>true</enabled>
>			</releases>
>		</repository>
>		<repository>
>			<id>snapshot.fusesource.org</id>
>			<name>FuseSource Snapshot Repository</name>
>		
><url>http://repo.fusesource.com/nexus/content/repositories/snapshots</url>
>			<snapshots>
>				<enabled>true</enabled>
>			</snapshots>
>			<releases>
>				<enabled>false</enabled>
>			</releases>
>		</repository>
>	</repositories>
>
>	<pluginRepositories>
>		<pluginRepository>
>			<id>release.fusesource.org</id>
>			<name>FuseSource Release Repository</name>
>			<url>http://repo.fusesource.com/nexus/content/repositories/releases</url>
>			<snapshots>
>				<enabled>false</enabled>
>			</snapshots>
>			<releases>
>				<enabled>true</enabled>
>			</releases>
>		</pluginRepository>
>		<pluginRepository>
>			<id>snapshot.fusesource.org</id>
>			<name>FuseSource Snapshot Repository</name>
>		
><url>http://repo.fusesource.com/nexus/content/repositories/snapshots</url>
>			<snapshots>
>				<enabled>true</enabled>
>			</snapshots>
>			<releases>
>				<enabled>false</enabled>
>			</releases>
>		</pluginRepository>
>	</pluginRepositories>
>
>	<dependencies>
>		
>		<dependency>
>			<groupId>org.apache.camel</groupId>
>			<artifactId>camel-core</artifactId>
>			<version>2.10.0</version>
>		</dependency>
>		<dependency>
>			<groupId>org.apache.camel</groupId>
>			<artifactId>camel-spring</artifactId>
>			<version>2.10.0</version>
>		</dependency>
>		<dependency>
>			<groupId>org.apache.camel</groupId>
>			<artifactId>camel-jms</artifactId>
>			<version>2.10.1</version>
>		</dependency>
>		<dependency>
>			<groupId>org.apache.activemq</groupId>
>			<artifactId>activemq-camel</artifactId>
>			<version>5.7.0</version>
>		</dependency>
>
>		
>		
>		
>
>		
>		<dependency>
>			<groupId>org.apache.camel</groupId>
>			<artifactId>camel-test-spring</artifactId>
>			<version>2.10.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>
>					<instructions>
>						<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
>						<Import-Package>org.apache.activemq.xbean,
>							org.apache.activemq.spring,
>							org.apache.activemq.broker,
>							org.apache.activemq.security,
>							org.apache.activemq.jaas,
>							org.apache.activemq.pool,
>							org.apache.activemq.camel.component,
>							org.apache.camel.component.jms;version="[2.10,2.9)",
>							*</Import-Package>
>						
>					
><Private-Package>org.apache.servicemix.examples.camel</Private-Package>
>					</instructions>
>				</configuration>
>			</plugin>
>			<plugin>
>				<groupId>org.apache.maven.plugins</groupId>
>				<artifactId>maven-resources-plugin</artifactId>
>				<version>2.4.3</version>
>				<configuration>
>					<encoding>UTF-8</encoding>
>				</configuration>
>			</plugin>
>
>			
>			<plugin>
>				<groupId>org.apache.camel</groupId>
>				<artifactId>camel-maven-plugin</artifactId>
>				<version>2.10.0.redhat-60024</version>
>			</plugin>
>			<plugin>
>				<groupId>org.apache.felix</groupId>
>				<artifactId>maven-bundle-plugin</artifactId>
>				<version>2.3.7</version>
>				<extensions>true</extensions>
>			</plugin>
>		</plugins>
>	</build>
>
></project>
>
>
>camel-context file is:
><?xml version="1.0" encoding="UTF-8"?>
>
>
><beans xmlns="http://www.springframework.org/schema/beans"
>	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>	xsi:schemaLocation="
>   http://www.springframework.org/schema/beans 
>   http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>   http://camel.apache.org/schema/spring 
>   http://camel.apache.org/schema/spring/camel-spring.xsd">
>
>	<camelContext xmlns="http://camel.apache.org/schema/spring">
>		
>		<route>
>			<from uri="file://C:/ActiveMQInuput" />
>			<transform>
>				<constant>Hello world!</constant>
>			</transform>
>			<to uri="activemq:queue:KK.test" />
>		</route>
>	</camelContext>
>	<bean id="pooledConnectionFactory"
>class="org.apache.activemq.pool.PooledConnectionFactory">
>		<property name="maxConnections" value="8" />
>		<property name="maximumActive" value="500" />
>		<property name="connectionFactory" ref="jmsConnectionFactory" />
>	</bean>
>	
></beans>
>
>When i deploy and try to start this bundle in servicemix I am getting
>the
>following error:
>karaf@root> Exception in thread "SpringOsgiExtenderThread-4"
>org.springframework.beans.factory.BeanC
>reationException: Error creating bean with name 'camel-4': Invocation
>of
>init method failed; nested
>exception is
>org.springframework.beans.factory.CannotLoadBeanClassException:
>Cannot find class [org.
>apache.activemq.pool.PooledConnectionFactory] for bean with name
>'pooledConnectionFactory' defined i
>n URL [bundle://148.27:0/META-INF/spring/camel-context.xml]; nested
>exception is java.lang.ClassNotF
>oundException: org.apache.activemq.pool.PooledConnectionFactory not
>found
>from bundle [null]
>        at
>org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBe
>an(AbstractAutowireCapableBeanFactory.java:1422)
>        at
>org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean
>(AbstractAutowireCapableBeanFactory.java:518)
>        at
>org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(A
>bstractAutowireCapableBeanFactory.java:455)
>        at
>org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFac
>tory.java:293)
>        at
>org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(Defau
>ltSingletonBeanRegistry.java:222)
>        at
>org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFacto
>ry.java:290)
>        at
>org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory
>.java:192)
>        at
>org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingle
>tons(DefaultListableBeanFactory.java:567)
>        at
>org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitializ
>ation(AbstractApplicationContext.java:895)
>        at
>org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.acc
>ess$1600(AbstractDelegatedExecutionApplicationContext.java:69)
>        at
>org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.r
>un(AbstractDelegatedExecutionApplicationContext.java:355)
>        at
>org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUt
>ils.java:85)
>        at
>org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.com
>pleteRefresh(AbstractDelegatedExecutionApplicationContext.java:320)
>        at
>org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicati
>onContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)
>        at java.lang.Thread.run(Thread.java:722)
>Caused by:
>org.springframework.beans.factory.CannotLoadBeanClassException:
>Cannot find class [org.ap
>ache.activemq.pool.PooledConnectionFactory] for bean with name
>'pooledConnectionFactory' defined in
>URL [bundle://148.27:0/META-INF/spring/camel-context.xml]; nested
>exception
>is java.lang.ClassNotFou
>ndException: org.apache.activemq.pool.PooledConnectionFactory not found
>from
>bundle [null]
>        at
>org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBe
>anFactory.java:1261)
>        at
>org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanT
>ype(AbstractAutowireCapableBeanFactory.java:575)
>        at
>org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanF
>actory.java:1330)
>        at
>org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(
>DefaultListableBeanFactory.java:317)
>        at
>org.springframework.context.support.AbstractApplicationContext.getBeanNamesForType(Abstra
>ctApplicationContext.java:1136)
>        at
>org.apache.camel.spring.CamelContextFactoryBean.getBeanForType(CamelContextFactoryBean.ja
>va:177)
>        at
>org.apache.camel.core.xml.AbstractCamelContextFactoryBean.afterPropertiesSet(AbstractCame
>lContextFactoryBean.java:137)
>        at
>org.apache.camel.osgi.CamelContextFactoryBean.afterPropertiesSet(CamelContextFactoryBean.
>java:64)
>        at
>org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMe
>thods(AbstractAutowireCapableBeanFactory.java:1479)
>        at
>org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBe
>an(AbstractAutowireCapableBeanFactory.java:1419)
>        ... 14 more
>Caused by: java.lang.ClassNotFoundException:
>org.apache.activemq.pool.PooledConnectionFactory not fo
>und from bundle [null]
>        at
>org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(BundleDelegatingClass
>Loader.java:103)
>        at
>org.springframework.osgi.util.BundleDelegatingClassLoader.loadClass(BundleDelegatingClass
>Loader.java:156)
>        at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
>    at org.springframework.util.ClassUtils.forName(ClassUtils.java:257)
>        at
>org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(Abstrac
>tBeanDefinition.java:408)
>        at
>org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(Abstract
>BeanFactory.java:1282)
>        at
>org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBe
>anFactory.java:1253)
>        ... 23 more
>Caused by: java.lang.ClassNotFoundException:
>org.apache.activemq.pool.PooledConnectionFactory not fo
>und by [148]
>        at
>org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:812
>)
>        at
>org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:72)
>        at
>org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1807)
>        at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
>        at
>org.apache.felix.framework.ModuleImpl.getClassByDelegation(ModuleImpl.java:670)
>   at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1654)
>        at
>org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:909)
>        at
>org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(BundleDelegatingClass
>Loader.java:99)
>        ... 29 more
>I have added all the required jars in classpath but I could not find
>the
>solution.
>Please Help me. Thanks in advance
>
>
>
>
>--
>View this message in context:
>http://camel.465427.n5.nabble.com/ClassnotfoundException-tp5734946.html
>Sent from the Camel - Users mailing list archive at Nabble.com.

-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.