Hi,

Yes. The packages of com.microsoft.xxx are not imported by this bundle :

mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.ibatis-sqlmap/2.3.4.726_2

Workaround is to modify the MANIFEST file of this bundle and add the missing
packages or add DynamicImport-Package: *

Regards,

Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*****************************
blog : http://cmoulliard.blogspot.com
twitter : http://twitter.com/cmoulliard
Linkedlin : http://www.linkedin.com/in/charlesmoulliard

Apache Camel Group :
http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm


On Thu, Feb 4, 2010 at 3:48 PM, Aleksey Masny <[email protected]> wrote:

>
> When i deploy my camel-project as bundle on Apache Felix Karaf and start
> it,
> in log i see exception java.sql.SQLException: No suitable driver. And my
> bundle not work properly .
>
> My bundle uses camel-ibatis component. camel-ibatis through
> SqlMapConfog.xml
> uses MSSQL jdbc driver for connect to db. All drivers and component
> deployed
> on Karaf. Bundle mssqlserver.jar and other jar for driver deploy in wrapped
> mode and export package com.microsoft.jdbc.sqlserver.
>
> May be, add import com.microsoft.jdbc.sqlserver dependency to camel-ibatis
> component manifest? Or to component "Apache ServiceMix Bundles:
> ibatis-sqlmap-2.3.4.726 (2.3.4.726_2)"?
>
> How manage dependencies for JDBC drivers on OSGI environment?
>
> Camel ver. 2.1.0.
>
> db.properties used by SqlMapConfig.xml
> driver   = com.microsoft.jdbc.sqlserver.SQLServerDriver
> url      =
>
> jdbc:microsoft:sqlserver://localhost:1433;databaseName=SMB_DB;selectMethod=cursor
> username = sa
> password = 123
>
> pom.xml
> <?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";>
>
>        <properties>
>                <camel-version>2.1.0</camel-version>
>                <log4j-version>1.2.14</log4j-version>
>
>  <bundle.symbolicName>important-notifier</bundle.symbolicName>
>                <bundle.namespace>ua.mti.integration</bundle.namespace>
>        </properties>
>
>        <modelVersion>4.0.0</modelVersion>
>        <groupId>ua.mti.integration</groupId>
>        <artifactId>important-notifier</artifactId>
>        <packaging>bundle</packaging>
>        <version>0.1</version>
>
>        <name>${bundle.symbolicName} [${bundle.namespace}]</name>
>        <url>http://mti.ua</url>
>
>        <dependencies>
>                <dependency>
>                        <groupId>org.apache.camel</groupId>
>                        <artifactId>camel-core</artifactId>
>                        <version>${camel-version}</version>
>                </dependency>
>                <dependency>
>                        <groupId>org.apache.camel</groupId>
>                        <artifactId>camel-spring</artifactId>
>                        <version>${camel-version}</version>
>                </dependency>
>                <dependency>
>                        <groupId>org.apache.camel</groupId>
>                        <artifactId>camel-osgi</artifactId>
>                        <version>${camel-version}</version>
>                </dependency>
>                <dependency>
>                      <groupId>org.apache.felix</groupId>
>                      <artifactId>org.osgi.core</artifactId>
>                      <version>1.4.0</version>
>                </dependency>
>                <dependency>
>                        <groupId>org.apache.camel</groupId>
>                        <artifactId>camel-xmpp</artifactId>
>                        <version>${camel-version}</version>
>                </dependency>
>
>                <dependency>
>                        <groupId>org.apache.camel</groupId>
>                        <artifactId>camel-ibatis</artifactId>
>                        <version>${camel-version}</version>
>                </dependency>
>
>                <dependency>
>                        <groupId>com.microsoft.sqlserver</groupId>
>                        <artifactId>mssqlserver</artifactId>
>                        <version>1</version>
>                </dependency>
>
>                <dependency>
>                        <groupId>com.microsoft.sqlserver</groupId>
>                        <artifactId>msbase</artifactId>
>                        <version>1</version>
>                </dependency>
>
>                <dependency>
>                        <groupId>com.microsoft.sqlserver</groupId>
>                        <artifactId>msutil</artifactId>
>                        <version>1</version>
>                </dependency>
>
>                <dependency>
>                        <groupId>log4j</groupId>
>                        <artifactId>log4j</artifactId>
>                        <version>${log4j-version}</version>
>                </dependency>
>        </dependencies>
>
>        <build>
>                <defaultGoal>install</defaultGoal>
>
>                <resources>
>                        <resource>
>                                <directory>src/main/resources</directory>
>                        </resource>
>                </resources>
>
>                <plugins>
>
>                        <plugin>
>                                <groupId>org.ops4j</groupId>
>                                <artifactId>maven-pax-plugin</artifactId>
>                                <version>1.4</version>
>                                <extensions>true</extensions>
>                        </plugin>
>                        <plugin>
>                                <groupId>org.apache.felix</groupId>
>                                <artifactId>maven-bundle-plugin</artifactId>
>                                <version>1.4.3</version>
>                                <configuration>
>                                        <instructions>
>
>  <Bundle-SymbolicName>${bundle.symbolicName}</Bundle-SymbolicName>
>
>  <Bundle-Version>${pom.version}</Bundle-Version>
>                                                <Import-Package>
>
>  org.apache.commons.logging,
>                                                        org.apache.camel,
>
>  org.apache.camel.component,
>
>  org.apache.camel.component.ibatis,
>
>  org.apache.camel.component.xmpp,
>
>  com.microsoft.jdbc.sqlserver,
>
>  ua.mti.integration.important_notifier,
>                                                        *
>                        </Import-Package>
>
> <Export-Package>ua.mti.integration.important_notifier</Export-Package>
>
>
> <Private-Package>ua.mti.integration.important_notifier.iBatisMappedClasses.*</Private-Package>
>
>
>  <Include-Resource>src/main/resources</Include-Resource>
>                                        </instructions>
>                                </configuration>
>                        </plugin>
>
>                        <plugin>
>                                <groupId>org.apache.maven.plugins</groupId>
>
>  <artifactId>maven-compiler-plugin</artifactId>
>                                <configuration>
>                                        <source>1.5</source>
>                                        <target>1.5</target>
>                                </configuration>
>                        </plugin>
>
>                        <!-- allows the route to be ran via 'mvn camel:run'
> -->
>                        <plugin>
>                                <groupId>org.apache.camel</groupId>
>                                <artifactId>camel-maven-plugin</artifactId>
>                                <version>${camel-version}</version>
>                        </plugin>
>
>                        <plugin>
>
>  <artifactId>maven-assembly-plugin</artifactId>
>                                <configuration>
>                                        <descriptors>
>
>  <descriptor>src/main/assembly/src.xml</descriptor>
>                                        </descriptors>
>                                </configuration>
>                        </plugin>
>
>
>                </plugins>
>        </build>
> </project>
>
> Headers for installed JDBC bundle
> ka...@root> osgi:headers 137
>
> wrap_file_c__ms_jdbc_lib_mssqlserver.jar (137)
> ----------------------------------------------
> Bnd-LastModified = 1265207903237
> Bundle-ManifestVersion = 2
> Bundle-Name = wrap_file_c__ms_jdbc_lib_mssqlserver.jar
> Bundle-SymbolicName = wrap_file_c__ms_jdbc_lib_mssqlserver.jar
> Bundle-Version = 0
> Created-By = 1.5.0_17 (Sun Microsystems Inc.)
> Export-Package =
>
> com.microsoft.jdbc.sqlserver;uses:="com.microsoft.jdbc.sqlserver.tds,com.microsoft.util,com.microsoft.j
>
> dbc.base",com.microsoft.jdbc.sqlserver.tds;uses:="com.microsoft.jdbc.base,com.microsoft.util,com.microsoft.jdbc.sqlserve
>
> r",com.microsoft.jdbcx.sqlserver;uses:="javax.naming,com.microsoft.jdbc.base,com.microsoft.jdbcx.base,com.microsoft.jdbc
> .sqlserver,javax.sql,javax.transaction.xa,com.microsoft.jdbc.sqlserver.tds"
> Generated-By-Ops4j-Pax-From = wrap:file:c:/ms/jdbc/lib/mssqlserver.jar
> Import-Package =
>
> com.microsoft.jdbc.base;resolution:=optional,com.microsoft.jdbc.sqlserver;resolution:=optional,com.micr
>
> osoft.jdbc.sqlserver.tds;resolution:=optional,com.microsoft.jdbcx.base;resolution:=optional,com.microsoft.jdbcx.sqlserve
>
> r;resolution:=optional,com.microsoft.util;resolution:=optional,javax.naming;resolution:=optional,javax.sql;resolution:=o
> ptional,javax.transaction.xa;resolution:=optional
> Manifest-Version = 1.0
> Originally-Created-By = 1.2.2 (Sun Microsystems Inc.)
> Tool = Bnd-0.0.313
> ka...@root>
>
> Log in Karaf, where my bundle starting:
> 16:00:52,990 | INFO  | l Console Thread | ultOsgiApplicationContextCreator
> |
> ultOsgiApplicationContextCreator   67 | Discovered configurations
> {osgibundle:/META-INF/spring/*.xml} in bundle [important-notifier
> [ua.mti.integration] (important-notifier)]
> 16:00:52,990 | INFO  | xtenderThread-23 | OsgiBundleXmlApplicationContext
>  |
> pport.AbstractApplicationContext  411 | Refreshing
>
> org.springframework.osgi.context.support.osgibundlexmlapplicationcont...@173a94f
> :
> display name [OsgiBundleXmlApplicationContext(bundle=important-notifier,
> config=osgibundle:/META-INF/spring/*.xml)]; startup date [Thu Feb 04
> 16:00:52 EET 2010]; root of context hierarchy
> 16:00:52,990 | INFO  | xtenderThread-23 | OsgiBundleXmlApplicationContext
>  |
> ractOsgiBundleApplicationContext  359 | Unpublishing application context
> OSGi service for bundle important-notifier [ua.mti.integration]
> (important-notifier)
> 16:00:53,005 | INFO  | xtenderThread-23 | XmlBeanDefinitionReader
>  |
> tory.xml.XmlBeanDefinitionReader  323 | Loading XML bean definitions from
> URL [bundle://134.0:0/META-INF/spring/camel-context.xml]
> 16:00:53,052 | INFO  | xtenderThread-23 | OsgiBundleXmlApplicationContext
>  |
> pport.AbstractApplicationContext  426 | Bean factory for application
> context
>
> [org.springframework.osgi.context.support.osgibundlexmlapplicationcont...@173a94f
> ]:
>
> org.springframework.beans.factory.support.defaultlistablebeanfact...@160297a
> 16:00:53,052 | INFO  | xtenderThread-23 | WaiterApplicationContextExecutor
> |
> WaiterApplicationContextExecutor  252 | No outstanding OSGi service
> dependencies, completing initialization for
> OsgiBundleXmlApplicationContext(bundle=important-notifier,
> config=osgibundle:/META-INF/spring/*.xml)
> 16:00:53,068 | WARN  | xtenderThread-24 | CamelContextFactoryBean
>  |
> l.spring.CamelContextFactoryBean  881 | Using a packages element to specify
> packages to search has been deprecated. Please use a packageScan element
> instead.
> 16:00:53,130 | INFO  | xtenderThread-24 | DefaultListableBeanFactory
> |
> pport.DefaultListableBeanFactory  414 | Pre-instantiating singletons in
>
> org.springframework.beans.factory.support.defaultlistablebeanfact...@160297a
> :
> defining beans [camelContext:beanPostProcessor,camelContext,ibatis,helper];
> root of factory hierarchy
> 16:00:53,130 | INFO  | xtenderThread-24 | DefaultCamelContext
>  |
> e.camel.impl.DefaultCamelContext 1005 | Apache Camel 2.1.0
> (CamelContext:camelContext) is starting
> 16:00:53,130 | INFO  | xtenderThread-24 | DefaultCamelContext
>  |
> e.camel.impl.DefaultCamelContext 1431 | JMX enabled. Using
> DefaultManagedLifecycleStrategy.
> 16:00:53,443 | INFO  | xtenderThread-24 | DefaultCamelContext
>  |
> e.camel.impl.DefaultCamelContext  997 | Apache Camel 2.1.0
> (CamelContext:camelContext) started
> 16:00:53,443 | INFO  | xtenderThread-24 | OsgiBundleXmlApplicationContext
>  |
> ractOsgiBundleApplicationContext  327 | Publishing application context as
> OSGi service with properties
> {org.springframework.context.service.name=important-notifier,
> Bundle-SymbolicName=important-notifier, Bundle-Version=0.1.0}
> 16:00:53,443 | INFO  | xtenderThread-24 | ContextLoaderListener
>  |
> BundleApplicationContextListener   45 | Application context successfully
> refreshed (OsgiBundleXmlApplicationContext(bundle=important-notifier,
> config=osgibundle:/META-INF/spring/*.xml))
> 16:00:54,677 | WARN  |  IBatisComponent | faultPollingConsumerPollStrategy
> |
> faultPollingConsumerPollStrategy   43 | Consumer
> Consumer[ibatis://selectFailureEvent?delay=30000&initialDelay=1000] could
> not poll endpoint:
> ibatis://selectFailureEvent?delay=30000&initialDelay=1000
> caused by: No suitable driver
> java.sql.SQLException: No suitable driver
>        at java.sql.DriverManager.getConnection(DriverManager.java:545)
>        at java.sql.DriverManager.getConnection(DriverManager.java:171)
>        at
>
> com.ibatis.common.jdbc.SimpleDataSource.popConnection(SimpleDataSource.java:580)
>        at
>
> com.ibatis.common.jdbc.SimpleDataSource.getConnection(SimpleDataSource.java:222)
>        at
>
> com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction.init(JdbcTransaction.java:48)
>        at
>
> com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction.getConnection(JdbcTransaction.java:89)
>        at
>
> com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryForList(MappedStatement.java:139)
>        at
>
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:567)
>        at
>
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:541)
>        at
>
> com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118)
>        at
>
> com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:94)
>        at
>
> org.apache.camel.component.ibatis.strategy.DefaultIBatisProcessingStategy.poll(DefaultIBatisProcessingStategy.java:56)
>        at
>
> org.apache.camel.component.ibatis.IBatisPollingConsumer.poll(IBatisPollingConsumer.java:146)
>        at
>
> org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:108)
>        at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
>        at
> java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:280)
>        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:135)
>        at
>
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:65)
>        at
>
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:142)
>        at
>
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:166)
>        at
>
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
>        at
>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
>        at java.lang.Thread.run(Thread.java:595)
>
>
> Thanks a lot for a answer!
>
>
> --
> View this message in context:
> http://old.nabble.com/OSGI-%2B-camel-ibatis%3A-java.sql.SQLException%3A-No-suitable-driver-tp27452216p27452216.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>

Reply via email to