spring-boot:添加hadoop依赖项时运行抛出错误

时间:2016-06-07 09:10:00

标签: java spring maven spring-boot

我的SSM项目,我在我的web模块pom文件中添加了hadoop和phoenix依赖,当执行“mvn compile”时,它可以成功,但是“cd web module并执行mvn spring-boot:run”,它会产生错误如下:

<dependency>
        <groupId>org.apache.hadoop</groupId>
        <artifactId>hadoop-common</artifactId>
        <version>2.4.0</version>
        <exclusions>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-log4j12</artifactId>
            </exclusion>
            <exclusion>
                <groupId>log4j</groupId>
                <artifactId>log4j</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.apache.phoenix</groupId>
        <artifactId>phoenix-core</artifactId>
        <version>4.7.0-HBase-0.98</version>
        <exclusions>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-log4j12</artifactId>
            </exclusion>
            <exclusion>
                <groupId>log4j</groupId>
                <artifactId>log4j</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

我的网络模块pom文件是

text <- 
"BOB: blah blah blah blah
TRUDY: bleh bleh
BOB: you get the idea however some of the text is on a new line like 
this so I don't know how to extract it to the correct vector
TRUDY: bleh bleh bleh
BOB: Durrh!!!"

# Replace line feeds with spaces
text <- gsub(pattern = "\\n", replacement = " ", x = text)

# Split string into words to find alternations of BOB / TRUDY
who <- strsplit(x = text, split = " ")[[1]]
who <- who[who %in% c("BOB:", "TRUDY:")] 

# Split string using BOB: and TRUDY:
dialog <- strsplit(x = text, split = "(BOB: )|(TRUDY: )", perl = TRUE)[[1]][-1]

# create the two final vectors
bob <- trimws(dialog[which(who=="BOB:")])
trudy <- trimws(dialog[which(who=="TRUDY:")])

当我删除那些依赖项时,mvn spring-boot:run可以执行成功。

1 个答案:

答案 0 :(得分:4)

已解决,添加了servlet-api的删除:

<dependency>
        <groupId>org.apache.hadoop</groupId>
        <artifactId>hadoop-common</artifactId>
        <version>2.4.0</version>
        <exclusions>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-log4j12</artifactId>
            </exclusion>
            <exclusion>
                <groupId>log4j</groupId>
                <artifactId>log4j</artifactId>
            </exclusion>
            <exclusion>
                <groupId>javax.servlet</groupId>
                <artifactId>servlet-api</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>servlet-api-2.5</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.apache.phoenix</groupId>
        <artifactId>phoenix-core</artifactId>
        <version>4.7.0-HBase-0.98</version>
        <exclusions>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-log4j12</artifactId>
            </exclusion>
            <exclusion>
                <groupId>log4j</groupId>
                <artifactId>log4j</artifactId>
            </exclusion>
            <exclusion>
                <groupId>javax.servlet</groupId>
                <artifactId>servlet-api</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>servlet-api-2.5</artifactId>
            </exclusion>
        </exclusions>
    </dependency>