Apache camel 驼峰sql组件

Apache camel 驼峰sql组件,apache-camel,fuseesb,Apache Camel,Fuseesb,我正在尝试构建camel-sql应用程序,但我已经完成了堆栈 我在http://camel.apache.org/sql-component.html第页 我已经创建了xml配置,如示例所示,在FUSE ESB中我发现了异常: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'camel-21': Invocation of init method fa

我正在尝试构建camel-sql应用程序,但我已经完成了堆栈

我在
http://camel.apache.org/sql-component.html
第页

我已经创建了xml配置,如示例所示,在FUSE ESB中我发现了异常:

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name
     'camel-21': Invocation of init method failed; nested exception is 
    org.springframework.beans.factory.CannotLoadBeanClassException: 
Cannot find class [org.springframework.jdbc.datasource.DriverManagerDataSource] 
for bean with name 'esb' defined in URL [bundle://249.2:0/META-INF/spring/camel-context.xml]; nested exception is java.lang.ClassNotFoundException: 
org.springframework.jdbc.datasource.DriverManagerDataSource not found from bundle [camel]
但在我的fuse控制台中,我有spring jdbc:

karaf@root> osgi:list | grep Spring
ID状态蓝图Spring级别名称 [73][Active][[60]SpringBeans(3.0.5.版本)

[74][Active][[60]Spring上下文支持(3.0.5.版本)

[75][Active][[60]Spring上下文(3.0.5.版本)

[76][Active][[60]Spring表达式语言(3.0.5.发行版)

[77][Active][[60]Spring ASM(3.0.5.版本)

[78][Active][[60]弹簧芯(3.0.5.版本)

[79][Active][[60]Spring AOP(3.0.5.版本)

[87][Active][[60]Apache XBean::Spring(3.8)

[92][Active][[50]Spring事务(3.0.5.版本)

[94][Active][[50]Spring JMS(3.0.5.版本)

[169][Active][[50]ApacheXbean::Spring(3.7)

[223][Active][[60]Spring Web(3.0.5.版本)

[224][Active][[60]SpringWebservlet(3.0.5.版本)

[252][Active][[50]Spring JDBC(3.0.5.版本)

我该怎么办

更新:

我的POM是:

    <?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">

  <modelVersion>4.0.0</modelVersion>

  <groupId>camelWs</groupId>
  <artifactId>camel</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>

  <name>A Camel Route</name>
  <url>http://www.myorganization.org</url>

  <dependencies>
    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-core</artifactId>
      <version>2.9.0</version>
    </dependency>
    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-spring</artifactId>
      <version>2.9.0</version>
    </dependency>

    <!-- logging -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>1.6.1</version>
    </dependency> 
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-log4j12</artifactId>
      <version>1.6.1</version>
    </dependency>
    <dependency>
      <groupId>log4j</groupId> 
      <artifactId>log4j</artifactId> 
      <version>1.2.16</version> 
    </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>3.0.5.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>3.0.5.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>3.0.5.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>3.0.5.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-sql</artifactId>
            <version>2.8.0</version>
            <!-- use the same version as your Camel core version -->
        </dependency>
  </dependencies>

  <build>
    <defaultGoal>install</defaultGoal>

    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.3.2</version>
        <configuration>
          <source>1.6</source>
          <target>1.6</target>


        </configuration>
      </plugin>
      <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>2.1.0</version>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
                        <Import-Package>
                            org.springframework.jdbc.datasource
                        </Import-Package>

                    </instructions>
                </configuration>
            </plugin>

      <!-- allows the route to be ran via 'mvn camel:run' -->
      <plugin>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-maven-plugin</artifactId>
        <version>2.9.0</version>
        <configuration>

          <instructions>

                        <Import-Package>
                            *,
                            org.springframework.jdbc,
                            org.springframework.jdbc.datasource

                        </Import-Package>

                           <DynamicImport-Package>camel.*</DynamicImport-Package>

                    </instructions>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

你应该确保你的路线在org.springframework.jdbc.datasource上有一个导入包。您可以使用karaf中的header命令来验证它。

OSGi对于轻松安装和使用JDBC驱动程序来说可能有点麻烦。一个经验证的解决方案是将JDBC驱动程序作为片段包安装到包中

在FuseSource论坛上讨论过这个问题,那里有如何解决这个问题的说明。一个起点是这个链接:,然后按照其他讨论的参考文献了解更多细节以及如何解决它。

好的,我找到了解决方案

这很容易-我只需要安装mysql连接器


谢谢大家。

我找到了
org.springframework.jdbc.datasource
-我在上面添加了更新对不起,我看错了包-你能看一下我上面的更新吗?你确定你的包是正确的吗?我看到您使用了wrap util来部署路由JAR,它不应该是一个直接使用Maven bundle插件构建的bundle吗?据我所知,wrap util扫描java的导入以构建清单,而不是spring上下文,这可能是问题所在。Oliver的意思是,您需要确保您的osgi头导入包包含org.springframework.jdbc.datasourceI Understand,但如果我的pom.xml配置如上所述,该怎么办,并且这些类没有被导入?我应该向pom.xml添加什么?
camel (271)
-----------
Manifest-Version = 1.0
Bnd-LastModified = 1332154265299
Archiver-Version = Plexus Archiver
Tool = Bnd-0.0.357
Originally-Created-By = Apache Maven
Generated-By-Ops4j-Pax-From = wrap:file:/.../$Bundle-SymbolicName=camel&Bundle-Version=1.0.0.SNAPSHOT
Build-Jdk = 1.6.0_29
Created-By = 1.6.0_29 (Apple Inc.)

Bundle-Name = camel
Bundle-SymbolicName = camel
Bundle-Version = 1.0.0.SNAPSHOT
Bundle-ManifestVersion = 2

Private-Package = 
    .
Import-Package = 
    camel;resolution:=optional,
    org.apache.camel.builder;resolution:=optional,
    org.apache.camel.model;resolution:=optional,
    org.apache.camel.spring;resolution:=optional
Export-Package = 
    camel;uses:="org.apache.camel.builder,org.apache.camel.model,org.apache.camel.spring"