Hi ,

I sorted out this issue after hours of scratching my brain cell. First, I
used "SimpleDriverDataSource" class instead of "DriverManagerDataSource".
Property name "driverClassName" will be now "driveClass". So the bean would
look like as below

    *<bean id="pgdb"
class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
         <property name="driverClass" 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>*


Now, in the pom.xml I added two dependency as below

        *<dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-jdbc</artifactId>
                <version>4.1.6.RELEASE</version>
        </dependency>
        
        <dependency>
                <groupId>org.postgresql</groupId>
                <artifactId>postgresql</artifactId>
                <version>9.3-1100-jdbc41</version>
        </dependency>*


again in the same file, under the plugins, the plugin with groupId
org.apache.felix should have the required import-package as below

           <plugin>
              <groupId>org.apache.felix</groupId>
              <artifactId>maven-bundle-plugin</artifactId>
              <version>1.4.0</version>
              <extensions>true</extensions>
              <configuration>
                  <instructions>
                     
<Bundle-SymbolicName>${pom.groupId}.${pom.artifactId}</Bundle-SymbolicName>
                      <Bundle-Name>${pom.artifactId}</Bundle-Name>
                      <Bundle-Version>1.0.0</Bundle-Version>
                      *<Import-Package>
                          
                          org.springframework.jdbc,
                          org.springframework.jdbc.datasource,
                          org.postgresql, 
                          
                          org.apache.camel.builder, 
                          org.apache.camel.main,
                          org.apache.camel.model,
                          org.apache.log4j
                      </Import-Package>*
                      
                  </instructions>
              </configuration>
          </plugin>


Also, at the top of your pom.xml, mention the packaging as bundle

  <groupId>your.groupId</groupId>
  <artifactId>your.artifaceId</artifactId>
  *<packaging>bundle</packaging>*
  <version>0.0.1-SNAPSHOT</version>


Now we are done with pom.xml file. Go ahead and build the project using "Run
as" --> maven clean install.


Next part is to install the bundle in servicemix. Before doing this, I
installed spring-jdbc and postgresql by running the below commands one by
one in servicemix

*osgi:install wrap:mvn:org.springframework/spring-jdbc/4.1.6.RELEASE

osgi:start 224 (give the ID which got generated)

osgi:install wrap:mvn:org.postgresql/postgresql/9.3-1100-jdbc41

osgi:start 225 (give the ID which got generated)*


Now I installed my bundle as below

*osgi:install wrap:mvn:your.groupId/your.artifaceId/0.0.1-SNAPSHOT

osgi:start 226 (give the ID which got generated)*


This is it. This fixed the error. The OSGi bundle started successfully and
it was able to find "org.postgresql.Driver". So no error like "Could not
load JDBC driver class [org.postgresql.Driver]" occured this time.

Hope this helps. Thanks for bearing in the long solution.



--
View this message in context: 
http://servicemix.396122.n5.nabble.com/Blueprint-postgresql-camel-jdbc-newbie-question-tp4994862p5722661.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Reply via email to