2010-11-23 12 views
0

ServiceMix 4を使用していて、cxf-jaxrsのデモを変更しようとしています。以下は私のpom.xmlあるpom.xmlサードパーティのインポートに関する問題

http://maven.apache.org/maven-v4_0_0.xsd ">

<!-- 

    Licensed to the Apache Software Foundation (ASF) under one or more 
    contributor license agreements. See the NOTICE file distributed with 
    this work for additional information regarding copyright ownership. 
    The ASF licenses this file to You under the Apache License, Version 2.0 
    (the "License"); you may not use this file except in compliance with 
    the License. You may obtain a copy of the License at 

     http://www.apache.org/licenses/LICENSE-2.0 

    Unless required by applicable law or agreed to in writing, software 
    distributed under the License is distributed on an "AS IS" BASIS, 
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
    See the License for the specific language governing permissions and 
    limitations under the License. 
--> 

<modelVersion>4.0.0</modelVersion> 
<parent> 
    <groupId>org.apache.servicemix.examples</groupId> 
    <artifactId>examples</artifactId> 
    <version>4.2.0</version> 
</parent> 
<groupId>com.demo</groupId> 
<artifactId>calendar-service</artifactId> 
<packaging>bundle</packaging> 
<name>Calendar Api Demo :: CXF JAX-RS OSGI</name> 
<repositories> 
<repository> 
    <id>mandubian-mvn</id> 
    <url>http://mandubian-mvn.googlecode.com/svn/trunk/mandubian-mvn/repository</url> 
</repository> 
</repositories> 
<dependencies> 
    <dependency> 
     <groupId>com.google.collections</groupId> 
     <artifactId>google-collections</artifactId> 
     <version>1.0-rc5</version> 
    </dependency> 
    <dependency> 
     <groupId>net.sourceforge.findbugs</groupId> 
     <artifactId>jsr305</artifactId> 
     <version>1.3.2</version> 
    </dependency> 
    <dependency> 
     <groupId>com.google.gdata</groupId> 
     <artifactId>gdata-client-1.0</artifactId> 
     <version>1.41.5</version> 
    </dependency> 
    <dependency> 
     <groupId>com.google.gdata</groupId> 
     <artifactId>gdata-calendar-2.0</artifactId> 
     <version>1.41.5</version> 
    </dependency> 
    <dependency> 
     <groupId>com.google.gdata</groupId> 
     <artifactId>gdata-core-1.0</artifactId> 
     <version>1.41.5</version> 
    </dependency> 
    <dependency> 
     <groupId>com.google.gdata</groupId> 
     <artifactId>gdata-base-1.0</artifactId> 
     <version>1.41.5</version> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.servicemix.specs</groupId> 
     <artifactId>org.apache.servicemix.specs.jsr311-api-1.0</artifactId> 
     <version>1.3.0</version> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.servicemix.specs</groupId> 
     <artifactId>org.apache.servicemix.specs.jaxb-api-${jaxb.api.version}</artifactId> 
     <version>${servicemix.specs.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.servicemix.bundles</groupId> 
     <artifactId>org.apache.servicemix.bundles.commons-httpclient</artifactId> 
     <version>${commons-httpclient.version}</version> 
    </dependency> 
</dependencies> 

<build> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.felix</groupId> 
      <artifactId>maven-bundle-plugin</artifactId> 
      <extensions>true</extensions> 
      <configuration> 
       <instructions> 
        <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName> 
        <Import-Package> 
          javax.wsdl, 
          javax.xml.bind, 
          javax.xml.bind.annotation, 
          javax.ws.rs, 
          META-INF.cxf, 
          META-INF.cxf.osgi, 
          org.apache.cxf.bus, 
          org.apache.cxf.bus.spring, 
          org.apache.cxf.bus.resource, 
          org.apache.cxf.resource, 
          org.apache.cxf.configuration.spring, 
          org.apache.cxf.binding, 
          org.apache.cxf.jaxrs.utils, 
          org.apache.cxf.transport.http_osgi, 
          org.springframework.beans.factory.config, 
          org.apache.commons.httpclient, 
          org.apache.commons.httpclient.methods, 
          com.google.gdata.client.calendar;resolution:=optional, 
          com.google.gdata.data;resolution:=optional, 
          com.google.gdata.data.calendar;resolution:=optional, 
          com.google.gdata.data.extensions;resolution:=optional, 
          com.google.gdata.util;resolution:=optional 
        </Import-Package> 
        <Require-Bundle>org.apache.cxf.bundle</Require-Bundle> 
        <Export-Package>com.demo.*;</Export-Package> 
        <DynamicImport-Package>javax.ws.rs.*</DynamicImport-Package> 
       </instructions> 
      </configuration> 
     </plugin> 
     <plugin> 
      <groupId>org.codehaus.mojo</groupId> 
      <artifactId>exec-maven-plugin</artifactId> 
      <configuration> 
       <mainClass>edu.berkeley.api.client.Client</mainClass> 
       <includePluginDependencies>false</includePluginDependencies> 
      </configuration> 
     </plugin> 
    </plugins> 
</build> 

Mavenは正常にビルドが、私は展開しようとすると、それはServiceMixの上で、私が取得:

によって引き起こさ:java.lang.ClassNotFoundExceptionが:org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegationでcom.google.gdata.data.calendar.CalendarEntry (ModuleImpl.java:814 ) at org.apache.felix.framework.ModuleImpl.access $ 100(ModuleImpl.java:61) at org.apache.felework.ModuleImpl $ ModuleClassLoader.loadClass(ModuleImpl.java:1733) at java.lang.ClassLoader .loadClass(ClassLoader.java:248) ... 42 more

ステップがありませんか?どんな洞察にも感謝します。

答えて

0

"; resolution:= optional"を "com.google.gdata.data.calendar"から削除して、必要なインポートが不足していることをOSGiが通知できるようにしてください。

私はJAR "gdata-calendar-2.0-1.41.5.jar"のマニフェストを見ましたが、OSGiデータがありません。つまり、OSGiバンドルとしてJARをラップする必要があります。あなたはwrapコマンドでKarafコンソールでこれを行うことができます: osgi:install -s wrap:mvn:com.google.gdata/gdata-calendar-2.0/1.41.5

関連する問題