Hi,

AFAIR correctly with the postgres driver it somehow needs to register
itself in the classloader
cause it's actually loaded by reflection, if I remember correctly.
To get this working you need to load the Driver into the classloader,
this can be done either
by custom logic or AFAIR you can do something the like:

<bean class="org.postgresql.Driver" onStart="newInstance"/>

Sorry I couldn't actually remember the correct syntax and I don't have
the sources I used before at hand :(

you might also take a look at this:
http://stackoverflow.com/questions/2502308/osgi-apache-commons-dbcp-classloading-issue

Regards, Achim


Am 15.11.2011 17:40, schrieb bmccabe:
> Greetings all,
>
> I'm new to servicemix, coming from the apache/mod_perl world, and am trying
> to get up to speed. I've been through a lot of the tutorial material, and am
> now trying to set a really basic route using blueprint and camel-jdbc which
> makes a simple call to a postgres DB. I feel like I'm almost there but can't
> quite get it. It builds fine if I include an
> <Import-Package>org.postgresql.jdbc</Import-Package>, but when I try to
> osgi:start it fails because it can't find "org.postgresql.Driver, though
> it's there in the driver jar. Can anyone tip me off to what I'm missing? 
>
> Here's my blueprint statement, which is just a modified version of the
> camel-blueprint example, (I've change the db server hostname though):
> <blueprint
>     xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";
>     xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/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";>
>
>     <cm:property-placeholder persistent-id="org.apache.servicemix.examples">
>         <cm:default-properties>
>             <cm:property name="prefix" value="Blueprint-Example"/>
>         </cm:default-properties>
>     </cm:property-placeholder>
>
>     <camelContext xmlns="http://camel.apache.org/schema/blueprint";>
>         <route>
>             <from uri="timer://myTimer?fixedRate=true&amp;period=5000" />
>        <setBody>
>       <constant>select current_timestamp</constant>
>       </setBody>
>            <to uri="jdbc:pgdb" />
>             
>             <to uri="log:ExampleRouterBlueprint" />
>         </route>
>     </camelContext>
>       <bean id="pgdb"
> class="org.springframework.jdbc.datasource.DriverManagerDataSource">
>        <property name="driverClassName" value="org.postgresql.Driver"/>
>        <property name="url"
> value="jdbc:postgresql://myhost.mycompany.com/smx_test01"/>
>        <property name="username" value="smx"/>
>        <property name="password" value="smx"/>
>       </bean>
>     <bean id="myTransform"
> class="org.apache.servicemix.examples.camel.MyTransform">
>         <property name="prefix" value="${prefix}" />
>     </bean>
>
> </blueprint>
>
> and I've added the this to the pom.xml:
> <dependency>
>  <groupId>postgresql</groupId>
>  <artifactId>postgresql</artifactId>
>  <version>8.2-504.jdbc3</version>
> </dependency>
>
>
>
> --
> View this message in context: 
> http://servicemix.396122.n5.nabble.com/Blueprint-postgresql-camel-jdbc-newbie-question-tp4994862p4994862.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.


-- 
-----

Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/>  Committer & 
Project Lead

Reply via email to