2012-03-19 5 views
1

낙타 sql 응용 프로그램을 만들려고하지만 스택을했습니다.낙타 sql 구성 요소

나는 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] 

을하지만 내 퓨즈 콘솔에서 나는 스프링 JDBC 있습니다

[email protected]> osgi:list | grep Spring 

ID 상태 계획서 스프링 레벨 이름 [활성] [] [] [60] 스프링 콩 (3.0.5.RELEASE)

[74] [활성] [] [] [60] 스프링 컨텍스트 지원 . 0.5.RELEASE)

[75] [유효] [] [] [60] Spring 컨텍스트 (3.0.5.RELEASE)

[76] [유효] [] [] [60] 스프링 표현 언어 (3.0.5.RELEASE)

[77] [유효] [] [] [60] 봄 ASM (3.0.5.RELEASE)

[78] [유효] [] [] [60] 스프링 코어 (3.0.5.RELEASE)

[79] [유효] [] [] [60] 스프링 AOP (3.0.5.RELEASE)

[87] [유효] [] [] [60] 아파치 XBean :: 스프링 (380)

[92] [유효] [] [] [50] Spring 트랜잭션 (3.0.5.RELEASE)

[94] [유효] [] [] [50] 스프링 JMS (3.0.5.RELEASE)

[169] [유효] [] [] [50] 아파치 XBean :: 스프링 (3.7)

[223] [유효] [] [] [60] 스프링 웹 (3.0.5.RELEASE)

012] Spring Web Servlet (3.0.5.RELEASE)

[활성] [] [50] Spring JDBC (3.0.5.RELEASE)

나는 무엇을해야합니까?

UPDATE :

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

하지만 난 OSGI을 사용하고 때 :

내 POM은 헤더를 내가 가져 클래스를 참조하지 않는, 잘못된 메신저 내 pom.xml 파일 무엇입니까?

OSGI : 헤더 :

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" 

답변

3

OSGi는 JDBC 드라이버를 쉽게 설치하고 사용할 때 약간 번거로운 작업이 될 수 있습니다. 검증 된 솔루션은 JDBC 드라이버를 번들의 조각 번들로 설치하는 것입니다.

이 문제를 해결하는 방법에 대한 지침이있는 FuseSource 포럼에서 논의되었습니다. 출발점은 http://fusesource.com/forums/thread.jspa?messageID=13043&#13043 링크이며 자세한 내용과 해결 방법은 다른 토론에 대한 참조를 따르십시오.

0

당신은 당신의 경로가 org.springframework.jdbc.datasource수입 패키지이 있는지 확인해야한다.karaf에서 헤더 명령을 사용하여 확인할 수 있습니다.

+0

org.springframework.jdbc.datasource' 발견 - – Ilkar

+0

위의 업데이트를 추가했습니다. 죄송합니다. 잘못된 패키지를 보았습니다. 위의 업데이트를 볼 수 있습니까? – Ilkar

+0

포장이 정확한가요? ** route ** util을 사용하여 경로 JAR을 배포하는 것을 보았습니다. Maven 번들 플러그인으로 직접 빌드하지 않아도됩니까? 내가 알기로는 랩 (wrapping) 유틸리티가 자바의 임포트를 검사하여 매니페스트를 만들고 스프링 컨텍스트가 아니라 문제가 될 수 있습니다. –

0

그래, 해결책을 찾았습니다.

꽤 쉬웠습니다. mysql 커넥터를 설치하기 만하면됩니다.

감사합니다.

관련 문제