2012-02-15 234 views
1

我想在OSGI包中使用org.springframework.jdbc.core.JdbcTemplate連接oracle數據庫。當部署在ServiceMix的包,它會顯示錯誤OSGI Bundle中缺少需求包

org.osgi.framework.BundleException:在束未解決的約束我的第二個服務[376]:無法解析376.0:缺少需求[376.0]包; (包= org.springframework.jdbc.core)

這裏是我的POM文件

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

<parent> 
    <groupId>com.my.service</groupId> 
    <artifactId>my-service</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <relativePath>../my-service/pom.xml</relativePath> 
</parent> 

<groupId>com.brodos.osgi</groupId> 
<artifactId>my-second-service</artifactId> 
<packaging>bundle</packaging> 
<version>0.0.1-SNAPSHOT</version> 

<name>My Second Service</name> 
<url>http://example.net</url> 

<dependencies> 
    <dependency> 
     <groupId>com.oracle</groupId> 
     <artifactId>ojdbc14</artifactId> 
     <version>10.2.0.3.0</version> 
    </dependency> 
    <dependency> 
     <groupId>org.slf4j</groupId> 
     <artifactId>slf4j-api</artifactId> 
     <version>1.6.4</version> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.camel</groupId> 
     <artifactId>camel-spring</artifactId> 
     <version>2.8.0-fuse-01-13</version> 
    </dependency> 
    <dependency> 
     <groupId>springframework</groupId> 
     <artifactId>spring-jdbc</artifactId> 
     <version>1.2.1</version> 
    </dependency> 
</dependencies> 

<build> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.felix</groupId> 
      <artifactId>maven-bundle-plugin</artifactId> 
      <extensions>true</extensions> 
      <version>1.4.3</version> 
      <configuration> 
       <instructions> 
        <Bundle-SymbolicName>My Second Service</Bundle-SymbolicName> 
        <Bundle-Description>My Second Service</Bundle-Description> 
        <Import-Package> 
         org.apache.servicemix.camel.nmr, 
         org.apache.servicemix.nmr.api, 
         org.apache.servicemix.nmr.api.event, 
         org.apache.servicemix.nmr.api.internal, 
         * 
        </Import-Package> 
        <Private-Package>com.test.osgi.*</Private-Package> 
        <Include-Resource>src/main/resources</Include-Resource> 
        <DynamicImport-Package>*</DynamicImport-Package> 
       </instructions> 
      </configuration> 
     </plugin> 
    </plugins> 
</build> 

回答

1

您需要安裝導出org.springframework.jdbc.core包捆。

1

Jignesh,這可能是值得考慮的:

下載這個罐子從ebr.springsource.com

既然你是在OSGi環境中,您還需要其他的包像org.springframework.osgi.coreorg.springframework.osgi.ioorg.springframework.osgi.extender。這些還需要一些額外的捆綁包,如org.apache.commons。你可能不得不用MANIFEST.MF來調整一下版本來使它運行。

看看this tutorial得到一個想法:我能夠導入和運行這個。

注意*截至目前,我正在手動進行此集成...我希望使用maven,因爲事情變得清晰。

相關問題