camel-hdfs2没有用于scheme的文件系统:hdfs

时间:2016-07-07 08:16:09

标签: java hadoop apache-camel apache-karaf

我在OSGI项目中使用camel-hdfs2时遇到了一些错误(基于karaf)

我的环境:

Apache Karaf v4.0.4

Apache Camel v2.15.2

Apache Camel hdfs2 v2.15.2

错误是:

No FileSystem for scheme: hdfs

错误明细:

2016-07-07 15:59:52,141 | ERROR | pool-14-thread-1 | BlueprintCamelContext            | 36 - org.apache.camel.camel-blueprint - 2.15.2 | Error occurred during starting Camel: CamelContext(intelligenceCollectorWorkCamelContext) due Failed to create Producer for endpoint: Endpoint[hdfs2://server01:9000/test-camel-byte?fileType=SEQUENCE_FILE&valueType=BYTE]. Reason: java.io.IOException: No FileSystem for scheme: hdfs
org.apache.camel.FailedToCreateProducerException: Failed to create Producer for endpoint: Endpoint[hdfs2://server01:9000/test-camel-byte?fileType=SEQUENCE_FILE&valueType=BYTE]. Reason: java.io.IOException: No FileSystem for scheme: hdfs
    at org.apache.camel.impl.ProducerCache.doGetProducer(ProducerCache.java:407)
    at org.apache.camel.impl.ProducerCache.acquireProducer(ProducerCache.java:123)
    at org.apache.camel.processor.SendProcessor.doStart(SendProcessor.java:219)
    at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
    at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:74)
    at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:59)
    at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:103)
    at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:89)
    at org.apache.camel.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:79)
    at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
    at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:74)
    at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:59)
    at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:103)
    at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:89)
    at org.apache.camel.processor.RedeliveryErrorHandler.doStart(RedeliveryErrorHandler.java:1272)
    at org.apache.camel.support.ChildServiceSupport.start(ChildServiceSupport.java:44)
    at org.apache.camel.support.ChildServiceSupport.start(ChildServiceSupport.java:31)
    at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:74)
    at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:59)
    at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:103)
    at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:89)
    at org.apache.camel.processor.interceptor.DefaultChannel.doStart(DefaultChannel.java:155)
    at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
    at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:74)
    at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:59)
    at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:103)
    at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:89)
    at org.apache.camel.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:79)
    at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
    at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:74)
    at org.apache.camel.impl.RouteService.startChildService(RouteService.java:340)
    at org.apache.camel.impl.RouteService.warmUp(RouteService.java:182)
    at org.apache.camel.impl.DefaultCamelContext.doWarmUpRoutes(DefaultCamelContext.java:3090)
    at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:3020)
    at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:2797)
    at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:2653)
    at org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:167)
    at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2467)
    at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2463)
    at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:2486)
    at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:2463)
    at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
    at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:2432)
    at org.apache.camel.blueprint.BlueprintCamelContext.start(BlueprintCamelContext.java:180)
    at org.apache.camel.blueprint.BlueprintCamelContext.maybeStart(BlueprintCamelContext.java:212)
    at org.apache.camel.blueprint.BlueprintCamelContext.serviceChanged(BlueprintCamelContext.java:150)
    at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:991)[org.apache.felix.framework-5.4.0.jar:]
    at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:839)[org.apache.felix.framework-5.4.0.jar:]
    at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:546)[org.apache.felix.framework-5.4.0.jar:]
    at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4557)[org.apache.felix.framework-5.4.0.jar:]
    at org.apache.felix.framework.Felix.registerService(Felix.java:3549)[org.apache.felix.framework-5.4.0.jar:]
    at org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:348)
    at org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:355)
    at org.apache.camel.blueprint.BlueprintCamelContext.init(BlueprintCamelContext.java:100)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.8.0_74]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[:1.8.0_74]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_74]
    at java.lang.reflect.Method.invoke(Method.java:498)[:1.8.0_74]
    at org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:299)[28:org.apache.aries.blueprint.core:1.5.0]
    at org.apache.aries.blueprint.container.BeanRecipe.invoke(BeanRecipe.java:980)[28:org.apache.aries.blueprint.core:1.5.0]
    at org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:736)[28:org.apache.aries.blueprint.core:1.5.0]
    at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:848)[28:org.apache.aries.blueprint.core:1.5.0]
    at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:811)[28:org.apache.aries.blueprint.core:1.5.0]
    at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)[28:org.apache.aries.blueprint.core:1.5.0]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_74]
    at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)[28:org.apache.aries.blueprint.core:1.5.0]
    at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:255)[28:org.apache.aries.blueprint.core:1.5.0]
    at org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:186)[28:org.apache.aries.blueprint.core:1.5.0]
    at org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:712)[28:org.apache.aries.blueprint.core:1.5.0]
    at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:399)[28:org.apache.aries.blueprint.core:1.5.0]
    at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:273)[28:org.apache.aries.blueprint.core:1.5.0]
    at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:294)[28:org.apache.aries.blueprint.core:1.5.0]
    at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:263)[28:org.apache.aries.blueprint.core:1.5.0]
    at org.apache.aries.blueprint.container.BlueprintExtender.modifiedBundle(BlueprintExtender.java:253)[28:org.apache.aries.blueprint.core:1.5.0]
    at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500)[35:org.apache.aries.util:1.1.1]
    at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433)[35:org.apache.aries.util:1.1.1]
    at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725)[35:org.apache.aries.util:1.1.1]
    at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463)[35:org.apache.aries.util:1.1.1]
    at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422)[35:org.apache.aries.util:1.1.1]
    at org.apache.felix.framework.util.SecureAction.invokeBundleEventHook(SecureAction.java:1179)[org.apache.felix.framework-5.4.0.jar:]
    at org.apache.felix.framework.util.EventDispatcher.createWhitelistFromHooks(EventDispatcher.java:731)[org.apache.felix.framework-5.4.0.jar:]
    at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:486)[org.apache.felix.framework-5.4.0.jar:]
    at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4541)[org.apache.felix.framework-5.4.0.jar:]
    at org.apache.felix.framework.Felix.startBundle(Felix.java:2172)[org.apache.felix.framework-5.4.0.jar:]
    at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998)[org.apache.felix.framework-5.4.0.jar:]
    at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:984)[org.apache.felix.framework-5.4.0.jar:]
    at org.apache.karaf.features.internal.service.FeaturesServiceImpl.startBundle(FeaturesServiceImpl.java:1199)[10:org.apache.karaf.features.core:4.0.4]
    at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:840)[10:org.apache.karaf.features.core:4.0.4]
    at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1089)[10:org.apache.karaf.features.core:4.0.4]
    at org.apache.karaf.features.internal.service.FeaturesServiceImpl$1.call(FeaturesServiceImpl.java:985)[10:org.apache.karaf.features.core:4.0.4]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_74]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_74]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_74]
    at java.lang.Thread.run(Thread.java:745)[:1.8.0_74]
Caused by: java.io.IOException: No FileSystem for scheme: hdfs

Blueprint.xml

<cm:property-placeholder id="intelligence.collector.work" persistent-id="wbg.space.intelligence.collector.work">
    <cm:default-properties>
        <!--default properties-->
    </cm:default-properties>
</cm:property-placeholder>


<bean id="hdfsWriter" class="wbg.space.intelligence.collector.work.HdfsWriteProcessor"/>

<bean id="hdfsOsgiHelper" class="org.apache.camel.component.hdfs2.HdfsOsgiHelper">
    <argument>
        <map>
            <entry key="hdfs://server01:9000" value="org.apache.hadoop.hdfs.DistributedFileSystem"/>
            <entry key="file://" value="org.apache.hadoop.fs.LocalFileSystem"/>
        </map>
    </argument>
</bean>

<bean id="hdfs2" class="org.apache.camel.component.hdfs2.HdfsComponent" depends-on="hdfsOsgiHelper"/>

<camelContext id="intelligenceCollectorWorkCamelContext" xmlns="http://camel.apache.org/schema/blueprint">
    <package>wbg.space.intelligence.collector.work</package>
</camelContext>

RoutBuild.java

@Override
public void configure() throws Exception {

    from("direct:write_byte").to("hdfs2://server01:9000/test-camel-byte?valueType=BYTE&fileType=SEQUENCE_FILE");

    from("quartz2://myGroup/myTimerName?trigger.repeatInterval=2000&trigger.repeatCount=10").processRef("hdfsWriter");

}

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题。 这就是生成正确罐子的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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>example</groupId>
    <artifactId`enter code here`>XXXXXX</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>

        <org.apache.camel>2.12.1</org.apache.camel>
    </properties>
    <dependencies>
        <!-- Hadoop main client artifact -->
        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-client</artifactId>
            <version>2.6.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.hive</groupId>
            <artifactId>hive-jdbc</artifactId>
            <version>1.1.0</version>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.apache.camel/camel-core -->
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-core</artifactId>
            <version>2.20.2</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.apache.camel/camel-hdfs2 -->
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-hdfs2</artifactId>
            <version>2.20.2</version>
        </dependency>

    </dependencies>
    <distributionManagement>
        <repository>
            <id>artifactory-utn</id>
            <url>http://artifactory.incubator.com.ar/artifactory/utn</url>
        </repository>
    </distributionManagement>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>main.Main</mainClass>
                        </manifest>
                    </archive>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>8</source>
                    <target>8</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>2.4.2</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <filters>
                                <filter>
                                    <artifact>*:*</artifact>
                                    <excludes>
                                        <exclude>META-INF/*.SF</exclude>
                                        <exclude>META-INF/*.DSA</exclude>
                                        <exclude>META-INF/*.RSA</exclude>
                                    </excludes>
                                </filter>
                            </filters>
                            <transformers>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
                                <transformer
                                        implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <manifestEntries>
                                        <Main-Class>reload.transform.ReloadCamelProcessMain</Main-Class>
                                        <Build-Number>123</Build-Number>
                                    </manifestEntries>
                                </transformer>
                            </transformers>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.19.1</version>
                <configuration>
                    <includes>
                        <include>**/*Test.java</include>
                    </includes>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>