Can you use "mvn depdency:tree" to check if there is any other version
of spring jars ?
If So , you need to specify the right version of spring dependency in
your pom.
On Mon Nov 28 09:23:27 2011, newbiee wrote:
Babak:
Thank you for the reply.
I have added the mysql jdbc-driver (found from the site given below [1])
dependency in the pom i.e.
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.9</version>
</dependency>
[1]
http://www.mkyong.com/spring/maven-spring-hibernate-annotation-mysql-example/
Now I am not getting that error.
I have created a simple table "clients" which has following contents:
mysql> select * from clients;
+------------+
| ClientName |
+------------+
| Steve |
| Bill |
| Mike |
| Matt |
+------------+
4 rows in set (0.00 sec)
This table is in "digidevice" database
I have defined the following in my camel-context.xml:
<bean id="myDS"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost/digidevice"/>
<property name="username" value="root" />
<property name="password" value="root" />
</bean>
<camel:camelContext xmlns="http://camel.apache.org/schema/spring">
<camel:route>
<from uri="timer://myTimer?fixedRate=true&period=2000" />
<setBody>
<constant>SELECT * FROM clients</constant>
</setBody>
<to uri="jdbc:myDS"/>
<split>
<simple>${body}</simple>
<log message="*** Select all : ${body}"/>
</split>
</camel:route>
</camel:camelContext>
</beans>
When I run this program, I am getting following error:
Error occurred while running main from: org.apache.camel.spring.Main
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.camel.maven.RunMojo$1.run(RunMojo.java:415)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.NoSuchMethodError:
org.springframework.context.support.AbstractApplicationContext.getId()Ljava/lang/String;
at org.apache.camel.spring.Main.doStart(Main.java:141)
at
org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:65)
at
org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:52)
at org.apache.camel.impl.MainSupport.run(MainSupport.java:136)
at org.apache.camel.impl.MainSupport.run(MainSupport.java:322)
at org.apache.camel.spring.Main.main(Main.java:72)
I'll appeciate if you could tell me why this error is being thrown.
--
View this message in context:
http://camel.465427.n5.nabble.com/org-apache-camel-spring-Main-class-not-found-exception-tp5025882p5027552.html
Sent from the Camel - Users mailing list archive at Nabble.com.
--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang