Maven NoClassDefFoundError与OpenNLP

时间:2018-08-01 10:24:16

标签: java maven hadoop amazon-ec2

我正在使用Amazon Webservice ElasticMapReduce运行Hadoop。我已经在EMR群集上安装了Maven,并且似乎安装正确。当我尝试使用命令hadoop jar target/SANCTUM-1.0-SNAPSHOT HadoopMain config.cfg在Hadoop上运行jar文件时,该程序启动,但随后遇到此错误:

Exception in thread "Thread-5" java.lang.NoClassDefFoundError: opennlp/tools/postag/POSTaggerME
    at com.sanctum.ir.PartialTweetLoader.readTweets(PartialTweetLoader.java:65)
    at com.sanctum.ir.TweetLoaderThread.run(TweetLoaderThread.java:52)

我认为也许OpenNLP并未作为项目的依赖项下载。

我的pom.xml文件如下所示:

<?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>com.sanctum</groupId>
    <artifactId>SANCTUM</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>
    <dependencies>
        <dependency>
            <groupId>org.apache.opennlp</groupId>
            <artifactId>opennlp-tools</artifactId>
            <version>1.8.4</version>
        </dependency>
        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-mapreduce-client-core</artifactId>
            <version>2.7.3</version>
        </dependency>
        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-common</artifactId>
            <version>2.7.3</version>
        </dependency>
    </dependencies>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.7</maven.compiler.source>
        <maven.compiler.target>1.7</maven.compiler.target>
    </properties>
    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.2.1</version>
                <configuration>
                    <mainClass>HadoopMain</mainClass>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

有什么想法吗?非常感谢。

0 个答案:

没有答案