I can't get the mysql driver to work with my jdbc bean.  

Here's the XML:

<beans xmlns="http://www.springframework.org/schema/beans";
       xmlns:mail="http://servicemix.apache.org/mail/1.0";
       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-3.0.xsd       
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd";>

  <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring";>
    <route>
      <from uri="timer://kickoff?period=10000"/>
      <setBody>
        <constant>select * from Temperatures</constant>
      </setBody>
      <to uri="jdbc:Temp"/>
      <to uri="mock:result"/>
    </route>
  </camelContext>

  <bean id="Temp"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
    <property name="url" value="jdbc:mysql://localhost:3306/temperature" />
    <property name="username" value="temperature" />
    <property name="password" value="Celsius" />
  </bean>       
</beans>


Here's the error:

org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'Temp' defined in URL
[bundle://232.0:0/META-INF/spring/select.xml]: Error setting property
values; nested exception is
org.springframework.beans.PropertyBatchUpdateException; nested
PropertyAccessExceptions (1) are:
PropertyAccessException 1:
org.springframework.beans.MethodInvocationException: Property
'driverClassName' threw exception; nested exception is
java.lang.IllegalStateException: Could not load JDBC driver class
[com.mysql.jdbc.Driver]

I think these are the interesting items from a servicemix list:

[ 216] [Active     ] [            ] [       ] [   60] camel-jdbc (2.6.0)
[ 219] [Active     ] [            ] [       ] [   60]
camel-spring-integration (2.6.0)
[ 223] [Active     ] [            ] [       ] [   60]
mvn:mysql/mysql-connector-java
[ 229] [Active     ] [            ] [       ] [   60] Spring JDBC
(3.0.5.RELEASE)
[ 231] [Active     ] [            ] [       ] [   60] Spring Integration
Core (1.0.4.RELEASE)

You might have seen a prior posting where I wanted to format my SQL in a
java bean.  That works perfectly now, I just needed a hint I was on the
right track and some time to get it right.  This time I think the class
loader where the mysql driver is loaded is different from the camel context
in which I'm running my query.  But I'm new at this, so I'm not sure.  I've
seen suggestions to import mysql into an OSGI package, but I think I'd
rather not add it (to say cpdb - what do I do for updates?  I'd have to
build the bundle again?  Being forgetful, I'd rather not build a dependency
into this, if that is what would happen.

Please help me getting this snippet going.  I'm using version 4.3 of
servicemix.

Kind regards,
RC



--
View this message in context: 
http://servicemix.396122.n5.nabble.com/jdbc-camel-bean-mysql-in-servicemix-tp4758622p4758622.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Reply via email to