gpt4 book ai didi

java - 找不到Struts2标签

转载 作者:行者123 更新时间:2023-11-30 02:37:12 25 4
gpt4 key购买 nike

我来这里是为了问一个其他人已经问过的问题,但我找到的每个答案都不能解决我的问题。

我目前正在将 struts2mavenjetty-maven-plugin 结合使用,但 Eclipse 抛出有关我的 JSP 的错误 文件说找不到 /struts-tag.tld 文件。

此外,当我启动 jetty:run 命令时,它会显示:

[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]]

还有 pom

<groupId>xx.xx</groupId>
<artifactId>xxxxx</artifactId>

<packaging>war</packaging>
<version>1</version>


<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>2.5.10.1</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.2.7.Final</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.8</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
</dependencies>

<build>
<finalName>starserv</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<warName>${project.artifactId}</warName>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.3.0.M2</version>
<configuration>
<scanIntervalSeconds>5</scanIntervalSeconds>
<war>${project.basedir}/target/${project.artifactId}.war</war>
<webApp>
<webInfIncludeJarPattern>^$</webInfIncludeJarPattern>
<containerIncludeJarPattern>^$</containerIncludeJarPattern>
</webApp>
</configuration>
</plugin>
</plugins>
</build>

有人知道怎么解决吗?因为没有任何效果。

最佳答案

我发现了问题。

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

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

希望它能帮助别人!

关于java - 找不到Struts2标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42738254/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com