无法找到Struts2标记

时间:2017-03-11 17:19:52

标签: java eclipse maven struts2 maven-jetty-plugin

我在这里问一个其他人已经问过的问题,但我找到的每个答案都没有解决我的问题。

我目前正在使用struts2maven以及jetty-maven-plugin,但是eclipse会丢失有关JSPs个文件的错误,说它无法找到{{1}文件。

另外,当我启动jetty:run命令时,它会说:

/struts-tag.tld

和pom

[ERROR] Failed to execute goal org.eclipse.jetty:jetty-maven-plugin:9.3.0.M2:run (default-cli) on project starservice: Execution default-cli of goal org.eclipse.jetty:jetty-maven-plugin:9.3.0.M2:run failed: An API incompatibility was encountered while executing org.eclipse.jetty:jetty-maven-plugin:9.3.0.M2:run: java.lang.NoSuchMethodError: org.apache.logging.log4j.ThreadContext.getThreadContextMap()Lorg/apache/logging/log4j/spi/ReadOnlyThreadContextMap;
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.eclipse.jetty:jetty-maven-plugin:9.3.0.M2
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/Users/user/.m2/repository/org/eclipse/jetty/jetty-maven-plugin/9.3.0.M2/jetty-maven-plugin-9.3.0.M2.jar
[ERROR] urls[1] = file:/C:/Users/user/.m2/repository/org/sonatype/sisu/sisu-inject-bean/2.1.1/sisu-inject-bean-2.1.1.jar
[ERROR] urls[2] = file:/C:/Users/user/.m2/repository/org/sonatype/sisu/sisu-guice/2.9.4/sisu-guice-2.9.4-no_aop.jar
[...]
[ERROR] urls[45] = file:/C:/Users/user/.m2/repository/org/apache/taglibs/taglibs-standard-impl/1.2.1/taglibs-standard-impl-1.2.1.jar
[ERROR] urls[46] = file:/C:/Users/user/.m2/repository/javax/transaction/javax.transaction-api/1.2/javax.transaction-api-1.2.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]

有谁知道如何修复它?因为什么都没有用。

1 个答案:

答案 0 :(得分:1)

我发现了问题。

你只需要在struts中将log4j api添加到相同版本的log4j中。对我来说是

<dependency>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-api</artifactId>
    <version>2.8.1</version>
</dependency>

希望它会帮助别人!