TomEE从8.0.13升级到9.0.0 Spring 应用程序:原因:java.lang.NoClassDefFoundError:javax/小服务程序/jsp/标签文本/最后尝试捕获

fquxozlt  于 2023-03-11  发布在  Java
关注(0)|答案(1)|浏览(94)

We got a security incident to update TomEE from 8.0.13 to 9.0.0. After updating we couldn't able to start our application, we are using spring based application but our build process it something, we are building war file and this war file will be deployed to TomEE server(9.0.0).
Please find my pom.xml below, can anyone help me in resolving this?
4.0.0 org.springframework.boot spring-boot-starter-parent 2.5.6 com.company myapplication 0.0.1-SNAPSHOT myapplication war <java.version>1.8</java.version> org.apache.poi poi 5.2.3 org.apache.poi poi-ooxml 5.2.3 com.opencsv opencsv 5.7.1 jakarta.xml.bind jakarta.xml.bind-api com.sun.xml.bind jaxb-impl 2.3.8 runtime com.google.guava guava 31.1-jre net.sf.flexjson flexjson 3.3 org.apache.commons commons-lang3 javax.ws.rs javax.ws.rs-api 2.1.1 org.apache.httpcomponents httpclient 4.5.14 org.apache.httpcomponents httpmime 4.5.14

<!--new Changes for client change -->
    <dependency>
        <groupId>org.json</groupId>
        <artifactId>json</artifactId>
        <version>20220924</version>
    </dependency>
    <dependency>
        <groupId>com.sa</groupId>
        <artifactId>edx_api</artifactId>
        <version>2.2.4</version>
    </dependency>
    <!-- START Flexlm license dependencies -->
    <dependency>
        <groupId>com.macrovision</groupId>
        <artifactId>flexlm</artifactId>
        <version>1.0</version>
    </dependency>
    <dependency>
        <groupId>com.macrovision</groupId>
        <artifactId>EccpressoAll</artifactId>
        <version>1.0</version>
    </dependency>
    <dependency>
        <groupId>com.macrovision</groupId>
        <artifactId>flexlmmgmt</artifactId>
        <version>1.0</version>
    </dependency>
    <dependency>
        <groupId>com.macrovision</groupId>
        <artifactId>flexlmutil</artifactId>
        <version>1.0</version>
    </dependency>
    <!-- END Flexlm license dependencies -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-aop</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <exclusions>
            <exclusion>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-logging</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>org.apache.tomcat.embed</groupId>
        <artifactId>tomcat-embed-jasper</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
    </dependency>
    <!-- New changes event bus -->
    <dependency>
        <groupId>org.apache.activemq</groupId>
        <artifactId>activemq-core</artifactId>
        <version>5.7.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.activemq</groupId>
        <artifactId>activemq-broker</artifactId>
        <version>5.17.4</version><!--$NO-MVN-MAN-VER$-->
    </dependency>

</dependencies>
<build>
    <finalName>MyApplication</finalName>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

TomEE logs:
Caused by: java.lang.NoClassDefFoundError: javax/servlet/jsp/tagext/TryCatchFinally at java.base/java.lang.ClassLoader.defineClass1(Native Method) at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1010) at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150) at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:512) at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:420) at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:414) at java.base/java.security.AccessController.doPrivileged(AccessController.java:691) at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:413) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:586) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:519) at java.base/java.lang.ClassLoader.defineClass1(Native Method) at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1010) at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150) at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:512) at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:420) at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:414) at java.base/java.security.AccessController.doPrivileged(AccessController.java:691) at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:413) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:586) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:573) at org.apache.openejb.core.TempClassLoader.loadClass(TempClassLoader.java:222) at org.apache.openejb.core.TempClassLoader.loadClass(TempClassLoader.java:83) at org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans.deploy(AnnotationDeployer.java:2371) at org.apache.openejb.config.AnnotationDeployer$ProcessAnnotatedBeans.deploy(AnnotationDeployer.java:2019)
Expectation is it should run without any errors.

2skhul33

2skhul331#

是否尝试过添加此依赖项
https://mvnrepository.com/artifact/javax.servlet.jsp/javax.servlet.jsp-api/2.3.3

<!-- https://mvnrepository.com/artifact/javax.servlet.jsp/javax.servlet.jsp-api -->
<dependency>
    <groupId>javax.servlet.jsp</groupId>
    <artifactId>javax.servlet.jsp-api</artifactId>
    <version>2.3.3</version>
    <scope>provided</scope>
</dependency>

不要忘记运行mvn clean install或任何您喜欢的命令来提取项目的依赖项

相关问题