maven - 如何在Karaf中安装Apache Hadoop客户端

标签 maven hadoop osgi apache-karaf osgi-bundle

我尝试使用Apache Karaf Cookbook中提到的功能xml方法安装apache hadoop客户端。但我无法使用功能xml安装。可以在karaf中添加功能库,但无法安装功能xml中描述的 bundle 包。

 Error executing command: Can't install feature hdfs2/0.0.0:
Could not start bundle mvn:org.apache.cxf/cxf-core/3.0.0 in feature(s) cxf-core-3.0.0: Uses constraint violation. Unable to r
esolve bundle revision org.apache.cxf.cxf-core [86.0] because it is exposed to package 'org.codehaus.stax2' from bundle revis
ions stax2-api [79.0] and stax2-api [67.0] via two dependency chains.

Chain 1:
  org.apache.cxf.cxf-core [86.0]
    import: (&(osgi.wiring.package=org.codehaus.stax2)(version>=3.1.0)(!(version>=4.0.0)))
     |
    export: osgi.wiring.package=org.codehaus.stax2
  stax2-api [79.0]

Chain 2:
  org.apache.cxf.cxf-core [86.0]
    import: (&(osgi.wiring.package=com.ctc.wstx.stax)(version>=4.3.0)(!(version>=5.0.0)))
     |
    export: osgi.wiring.package=com.ctc.wstx.stax; uses:=org.codehaus.stax2
  woodstox-core-asl [80.0]
    import: (&(osgi.wiring.package=org.codehaus.stax2)(version>=3.1.4))
     |
    export: osgi.wiring.package=org.codehaus.stax2
  stax2-api [67.0]

feature.xml是
<!DOCTYPE features>
<features name="sample-${project.version}">
    <repository>mvn:org.apache.cxf.karaf/apache-cxf/3.0.0/xml/features</repository>
    <feature name='xml-specs-api' version='${project.version}'
        resolver='(obr)' start-level='10'>
        <bundle dependency='true'>mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.activation-api-1.1/</bundle>
        <bundle dependency='true'>mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.stax-api-1.0/</bundle>
        <bundle dependency='true'>mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.jaxb-api-2.2/</bundle>
        <bundle>mvn:org.codehaus.woodstox/stax2-api/</bundle>
        <bundle>mvn:org.codehaus.woodstox/woodstox-core-asl/</bundle>
        <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxb-impl/</bundle>
    </feature>
    <feature name='hdfs2' version='${project.version}' resolver='(obr)'
        start-level='50'>
        <feature>xml-specs-api</feature>
        <feature>cxf-jaxrs</feature>
        <bundle dependency='true'>mvn:commons-lang/commons-lang/2.6</bundle>
        <bundle dependency='true'>mvn:com.google.guava/guava/16.0.1</bundle>
        <bundle dependency='true'>mvn:com.google.protobuf/protobuf-java/</bundle>
        <bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.guice/</bundle>
        <bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jsch/</bundle>
        <bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.paranamer/</bundle>
        <bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.avro/1.7.3_1</bundle>
        <bundle dependency='true'>mvn:org.apache.commons/commons-compress/</bundle>
            <bundle dependency='true'>mvn:org.apache.commons/commons-math3/3.1.1</bundle>
            <bundle dependency='true'>mvn:commons-cli/commons-cli/1.2</bundle>
            <bundle dependency='true'>mvn:commons-configuration/commons-configuration/</bundle>
                <bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-httpclient/</bundle>
                <bundle dependency='true'>mvn:io.netty/netty/3.9.2.Final</bundle>
                <bundle dependency='true'>mvn:org.codehaus.jackson/jackson-core-asl/1.9.12</bundle>
                <bundle dependency='true'>mvn:org.codehaus.jackson/jackson-mapper-asl/1.9.12</bundle>
                <bundle dependency="true">mvn:org.codehaus.jackson/jackson-jaxrs/1.9.12</bundle>
                <bundle dependency="true">mvn:org.codehaus.jackson/jackson-xc/1.9.12</bundle>
                <bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.snappy-java</bundle>
                <bundle dependency='true'>mvn:commons-codec/commons-codec/</bundle>
                <bundle dependency='true'>mvn:commons-collections/commons-collections/3.2.1</bundle>
                <bundle dependency='true'>mvn:commons-io/commons-io/</bundle>
                <bundle dependency='true'>mvn:commons-net/commons-net</bundle>
                <bundle dependency='true'>mvn:org.apache.zookeeper/zookeeper/3.4.8</bundle>
                <bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.xmlenc/0.52_1</bundle>
                <bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.xerces/</bundle>
                <bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.xmlresolver/</bundle>
                <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.hadoop-client/</bundle>
    </feature>
</features>

Pom.xm(一部分)
<packaging>pom</packaging>
  <properties>
        <cxf.version>2.7.11</cxf.version>
        <camel.version>2.15.2</camel.version>
        <jms.version>3.0.4</jms.version>
        <cellar.version>3.0.3</cellar.version>
        <activemq.version>5.12.0</activemq.version>
        <http.version>3.0.4</http.version>
        <pax-http.version>3.2.3</pax-http.version>
        <pax-jetty.version>8.1.17.v20150415</pax-jetty.version>
        <spring.version>3.2.11.RELEASE_1</spring.version>
    </properties>
    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <id>filter</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>resources</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-artifacts</id>
                        <phase>package</phase>
                        <goals>
                            <goal>attach-artifact</goal>
                        </goals>
                        <configuration>
                            <artifacts>
                                <artifact>
                                    <file>target/classes/features.xml</file>
                                    <type>xml</type>
                                    <classifier>features</classifier>
                                </artifact>
                            </artifacts>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>validate</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.karaf.tooling</groupId>
                        <artifactId>features-maven-plugin</artifactId>
                        <version>${cxf.karaf.version}</version>
                        <configuration>
                            <file>${project.build.directory}/classes/features.xml</file>
                            <karafConfig>${project.build.directory}/classes/bundles.properties</karafConfig>
                            <jreVersion>jre-1.6</jreVersion>
                        </configuration>
                        <executions>
                            <execution>
                                <id>validate</id>
                                <phase>process-resources</phase>
                                <goals>
                                    <goal>validate</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

最佳答案

您需要按以下方式更改features.xml文件。

mvn:org.codehaus.woodstox / stax2-api / 3.1.4

关于maven - 如何在Karaf中安装Apache Hadoop客户端,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37460164/

相关文章:

java - 如何使用 com.sun 的包

maven - 没有为此构建指定目标。

java - 在类路径中找不到 jaxws21 前端

java - Maven:Hibernate 版本错误?

hadoop - MapReduce主流程如何决定将哪个任务分配给单个工作流程?

OSGi 中 Java 类加载器的使用

java - Maven/Java,IllegalStateException指的是什么?

hadoop - 为什么hadoop集群运行在安全模式下?

java - Hadoop Eclipse 配置

java - 如何在 Glassfish 服务器上运行的 OSGi 环境中的 Tapestry 应用程序中通过 JNDI 检索 EJB