java.lang.NoSuchMethodError:'java.util.Map jakarta.servlet.SessionCookieConfig.getAttributes()

kulphzqa  于 2023-05-15  发布在  Java
关注(0)|答案(1)|浏览(138)

我正在使用spring Boot war文件来启动一个web应用程序。服务器引导正常。当我在浏览器中打开url时,我在spring Boot 日志中得到这个异常。互联网似乎没有解决这个问题可能是因为这个问题与雅加达

java.lang.NoSuchMethodError: 'java.util.Map jakarta.servlet.SessionCookieConfig.getAttributes()'
        at org.apache.catalina.core.ApplicationSessionCookieConfig.createSessionCookie(ApplicationSessionCookieConfig.java:227)
        at org.apache.catalina.connector.Request.doGetSession(Request.java:2971)
        at org.apache.catalina.connector.Request.getSession(Request.java:2384)
        at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:639)
        at jakarta.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:221)
        at jakarta.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:221)
        at jakarta.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:221)
        at org.springframework.security.web.context.HttpSessionSecurityContextRepository.saveContextInHttpSession(HttpSessionSecurityContextRepository.java:169)
        at org.springframework.security.web.context.HttpSessionSecurityContextRepository.saveContext(HttpSessionSecurityContextRepository.java:152)
        at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:125)
        at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:101)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374)
        at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:179)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374)
        at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374)
        at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal(BasicAuthenticationFilter.java:170)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374)
        at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:227)
        at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:221)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374)

这里是我的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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.0.6</version>
        <relativePath /> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.sample</groupId>
    <artifactId>sample</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>
    <name>sample</name>
    <description>Demo project for Spring Boot</description>
    <properties>
        <java.version>20</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
        </dependency>
        <dependency>
            <groupId>com.stripe</groupId>
            <artifactId>stripe-java</artifactId>
            <version>22.5.1</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.11.0</version>
        </dependency>
        <!--
        https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-json -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-json</artifactId>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.aspectj/aspectjweaver -->
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjweaver</artifactId>
            <scope>runtime</scope>
        </dependency>
        <!--
        https://mvnrepository.com/artifact/commons-fileupload/commons-fileupload -->
        <dependency>
            <groupId>commons-fileupload</groupId>
            <artifactId>commons-fileupload</artifactId>
            <version>1.5</version>
        </dependency>
        <!--
        https://mvnrepository.com/artifact/org.springframework.security/spring-security-core -->
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>
        </dependency>
        <!--
        https://mvnrepository.com/artifact/org.springframework.security/spring-security-config -->
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
        </dependency>
        <!--
        https://mvnrepository.com/artifact/org.springframework.security/spring-security-web -->
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.springframework/spring-web -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
        </dependency>
        <!--
        https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- Exclude Spring Boot's Default Logging -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- Add Log4j2 Dependency -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-log4j2</artifactId>
        </dependency>

        <!--
        https://mvnrepository.com/artifact/org.springframework/spring-webmvc -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
        </dependency>
        <!--
        https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
        </dependency>
        <!--
        https://mvnrepository.com/artifact/org.apache.httpcomponents/httpmime -->
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpmime</artifactId>
        </dependency>
        <!--
        https://mvnrepository.com/artifact/org.glassfish.hk2/osgi-resource-locator -->
        <dependency>
            <groupId>org.glassfish.hk2</groupId>
            <artifactId>osgi-resource-locator</artifactId>
            <version>2.5.0-b42</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.json/json -->
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20160810</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/com.paypal.sdk/paypal-core -->
        <dependency>
            <groupId>com.paypal.sdk</groupId>
            <artifactId>paypal-core</artifactId>
            <version>1.7.2</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/com.paypal.sdk/rest-api-sdk -->
        <dependency>
            <groupId>com.paypal.sdk</groupId>
            <artifactId>rest-api-sdk</artifactId>
            <version>1.13.0</version>
        </dependency>
        <!--
        https://mvnrepository.com/artifact/com.paypal.sdk/adaptivepaymentssdk -->
        <dependency>
            <groupId>com.paypal.sdk</groupId>
            <artifactId>adaptivepaymentssdk</artifactId>
            <version>2.9.117</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.quartz-scheduler/quartz -->
        <dependency>
            <groupId>org.quartz-scheduler</groupId>
            <artifactId>quartz</artifactId>
        </dependency>
        <!-- https://mvnrepository.com/artifact/com.paypal.sdk/permissionssdk -->
        <dependency>
            <groupId>com.paypal.sdk</groupId>
            <artifactId>permissionssdk</artifactId>
            <version>2.6.109</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.jsoup/jsoup -->
        <dependency>
            <groupId>org.jsoup</groupId>
            <artifactId>jsoup</artifactId>
            <version>1.10.2</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/commons-lang/commons-lang -->
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>2.6</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/commons-logging/commons-logging -->
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>1.2</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>8.0.30</version>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jaxb</groupId>
            <artifactId>jaxb-runtime</artifactId>
        </dependency>
        <!-- JAXB API only -->
        <dependency>
            <groupId>jakarta.xml.bind</groupId>
            <artifactId>jakarta.xml.bind-api</artifactId>
        </dependency>

        <!-- JAXB RI, Jakarta XML Binding -->
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-impl</artifactId>
            <scope>runtime</scope>
        </dependency>

        <!-- https://mvnrepository.com/artifact/jakarta.mail/jakarta.mail-api -->
        <dependency>
            <groupId>jakarta.mail</groupId>
            <artifactId>jakarta.mail-api</artifactId>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.hibernate.orm/hibernate-core -->
        <dependency>
            <groupId>org.hibernate.orm</groupId>
            <artifactId>hibernate-core</artifactId>
        </dependency>

        <!--
        https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-jasper</artifactId>
        </dependency>
        <!--
        https://mvnrepository.com/artifact/jakarta.servlet/jakarta.servlet-api -->
        <dependency>
            <groupId>jakarta.servlet</groupId>
            <artifactId>jakarta.servlet-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>jakarta.servlet.jsp</groupId>
            <artifactId>jakarta.servlet.jsp-api</artifactId>
            <version>3.0.0</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.glassfish.web</groupId>
            <artifactId>jakarta.servlet.jsp.jstl</artifactId>
        </dependency>

        <!--
        https://mvnrepository.com/artifact/jakarta.servlet.jsp.jstl/jakarta.servlet.jsp.jstl-api -->
        <dependency>
            <groupId>jakarta.servlet.jsp.jstl</groupId>
            <artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.eclipse.jetty/apache-jsp -->
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>apache-jsp</artifactId>
        </dependency>

    </dependencies>

    <build>
        <finalName>sample</finalName>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <version>3.0.6</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>repackage</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.10.1</version>
                    <configuration>
                        <!--<compilerVersion>19</compilerVersion>-->
                        <release>20</release>
                        <!--<compilerArgs>&#45;&#45;source 19</compilerArgs>-->
                        <compilerArgs>--enable-preview</compilerArgs>
                        <!--<compilerArgs>&#45;&#45;add-modules jdk.incubator.concurrent</compilerArgs>-->
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>3.3.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <configuration>
                        <argLine>-Dserver.port=8081 -Dserver.path=c:\\temp</argLine>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>hibernate3-maven-plugin</artifactId>
                    <version>2.2</version>
                    <executions>
                        <execution>
                            <id>generate-entities</id>
                            <phase>generate-sources</phase>
                            <goals>
                                <goal>hbm2java</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <components>
                            <component>
                                <name>hbm2java</name>
                                <implementation>jdbcconfiguration</implementation>
                                <outputDirectory>target/hibernate/hbm2java</outputDirectory>
                            </component>
                        </components>
                        <componentProperties>
                            <propertyfile>src/main/resources/database.properties</propertyfile>
                            <jdk5>true</jdk5>
                            <ejb3>false</ejb3>
                            <packagename>com.sample.hibernate.bean</packagename>
                            <format>true</format>
                            <haltonerror>true</haltonerror>
                        </componentProperties>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>org.apache.derby</groupId>
                            <artifactId>derby</artifactId>
                            <version>10.5.3.0_1</version>
                        </dependency>
                        <dependency>
                            <groupId>cglib</groupId>
                            <artifactId>cglib-nodep</artifactId>
                            <version>2.2.2</version>
                        </dependency>
                        <!--
                        https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
                        <dependency>
                            <groupId>mysql</groupId>
                            <artifactId>mysql-connector-java</artifactId>
                            <version>8.0.30</version>
                        </dependency>
                    </dependencies>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>hibernate3-maven-plugin</artifactId>
                    <version>2.2</version>
                    <executions>
                        <execution>
                            <id>generate-xml-files</id>
                            <phase>generate-resources</phase>
                            <goals>
                                <goal>hbm2hbmxml</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <components>
                            <component>
                                <name>hbm2hbmxml</name>
                                <implementation>jdbcconfiguration</implementation>
                                <outputDirectory>target/hibernate/hbm2hbmxml</outputDirectory>
                            </component>
                        </components>
                        <componentProperties>
                            <propertyfile>src/main/resources/database.properties</propertyfile>
                            <jdk5>true</jdk5>
                            <ejb3>false</ejb3>
                            <packagename>hbm</packagename>
                            <format>true</format>
                            <haltonerror>true</haltonerror>
                        </componentProperties>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>org.apache.derby</groupId>
                            <artifactId>derby</artifactId>
                            <version>10.5.3.0_1</version>
                        </dependency>
                        <dependency>
                            <groupId>cglib</groupId>
                            <artifactId>cglib-nodep</artifactId>
                            <version>2.2.2</version>
                        </dependency>
                        <!--
                        https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
                        <dependency>
                            <groupId>mysql</groupId>
                            <artifactId>mysql-connector-java</artifactId>
                            <version>8.0.30</version>
                        </dependency>
                    </dependencies>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>hibernate3-maven-plugin</artifactId>
                    <version>2.2</version>
                    <executions>
                        <execution>
                            <id>generate-xml-files1</id>
                            <phase>generate-resources</phase>
                            <goals>
                                <goal>hbm2cfgxml</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <components>
                            <component>
                                <name>hbm2cfgxml</name>
                                <implementation>jdbcconfiguration</implementation>
                                <outputDirectory>target/hibernate/hbm2cfgxml</outputDirectory>
                            </component>
                        </components>
                        <componentProperties>
                            <propertyfile>src/main/resources/database.properties</propertyfile>
                            <jdk5>true</jdk5>
                            <ejb3>false</ejb3>
                            <packagename>resources</packagename>
                            <format>true</format>
                            <haltonerror>true</haltonerror>
                        </componentProperties>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>org.apache.derby</groupId>
                            <artifactId>derby</artifactId>
                            <version>10.5.3.0_1</version>
                        </dependency>
                        <dependency>
                            <groupId>cglib</groupId>
                            <artifactId>cglib-nodep</artifactId>
                            <version>2.2.2</version>
                        </dependency>
                        <!--
                        https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
                        <dependency>
                            <groupId>mysql</groupId>
                            <artifactId>mysql-connector-java</artifactId>
                            <version>8.0.30</version>
                        </dependency>
                    </dependencies>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

</project>

这就是我启动Sping Boot 应用程序的方式

java -Dserver.port=8081 -Dserver.path=c:\\temp -jar sample.war org.springframework.boot.loader.WarLauncher

这是依赖关系树。它使用的是servlet6.0

com.sample:sample:war:0.0.1-SNAPSHOT
 +- org.springframework.boot:spring-boot-starter-test:jar:3.0.6:test
 |  +- org.springframework.boot:spring-boot-test:jar:3.0.6:test
 |  +- org.springframework.boot:spring-boot-test-autoconfigure:jar:3.0.6:test
 |  +- com.jayway.jsonpath:json-path:jar:2.7.0:test
 |  |  \- net.minidev:json-smart:jar:2.4.10:test
 |  |     \- net.minidev:accessors-smart:jar:2.4.9:test
 |  |        \- org.ow2.asm:asm:jar:9.3:test
 |  +- org.assertj:assertj-core:jar:3.23.1:test
 |  +- org.hamcrest:hamcrest:jar:2.2:test
 |  +- org.junit.jupiter:junit-jupiter:jar:5.9.2:test
 |  |  +- org.junit.jupiter:junit-jupiter-params:jar:5.9.2:test
 |  |  \- org.junit.jupiter:junit-jupiter-engine:jar:5.9.2:test
 |  |     \- org.junit.platform:junit-platform-engine:jar:1.9.2:test
 |  +- org.mockito:mockito-core:jar:4.8.1:test
 |  |  +- net.bytebuddy:byte-buddy-agent:jar:1.12.23:test
 |  |  \- org.objenesis:objenesis:jar:3.2:test
 |  +- org.mockito:mockito-junit-jupiter:jar:4.8.1:test
 |  +- org.skyscreamer:jsonassert:jar:1.5.1:test
 |  |  \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
 |  +- org.springframework:spring-core:jar:6.0.8:compile
 |  |  \- org.springframework:spring-jcl:jar:6.0.8:compile
 |  +- org.springframework:spring-test:jar:6.0.8:test
 |  \- org.xmlunit:xmlunit-core:jar:2.9.1:test
 +- com.google.code.gson:gson:jar:2.9.1:compile
 +- com.stripe:stripe-java:jar:22.5.1:compile
 +- org.slf4j:slf4j-simple:jar:2.0.7:compile
 |  \- org.slf4j:slf4j-api:jar:2.0.7:compile
 +- org.projectlombok:lombok:jar:1.18.26:compile
 +- commons-io:commons-io:jar:2.11.0:compile
 +- org.springframework.boot:spring-boot-starter-json:jar:3.0.6:compile
 |  +- org.springframework:spring-web:jar:6.0.8:compile
 |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.14.2:compile
 |  |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.14.2:compile
 |  |  \- com.fasterxml.jackson.core:jackson-core:jar:2.14.2:compile
 |  +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.14.2:compile
 |  +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.14.2:compile
 |  \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.14.2:compile
 +- org.aspectj:aspectjweaver:jar:1.9.19:runtime
 +- commons-fileupload:commons-fileupload:jar:1.5:compile
 +- org.springframework.security:spring-security-core:jar:6.0.3:compile
 |  +- org.springframework.security:spring-security-crypto:jar:6.0.3:compile
 |  +- org.springframework:spring-aop:jar:6.0.8:compile
 |  +- org.springframework:spring-beans:jar:6.0.8:compile
 |  +- org.springframework:spring-context:jar:6.0.8:compile
 |  +- org.springframework:spring-expression:jar:6.0.8:compile
 |  \- io.micrometer:micrometer-observation:jar:1.10.6:compile
 |     \- io.micrometer:micrometer-commons:jar:1.10.6:compile
 +- org.springframework.security:spring-security-config:jar:6.0.3:compile
 +- org.springframework.security:spring-security-web:jar:6.0.3:compile
 +- org.junit.jupiter:junit-jupiter-api:jar:5.9.2:test
 |  +- org.opentest4j:opentest4j:jar:1.2.0:test
 |  +- org.junit.platform:junit-platform-commons:jar:1.9.2:test
 |  \- org.apiguardian:apiguardian-api:jar:1.1.2:test
 +- org.springframework.boot:spring-boot-starter:jar:3.0.6:compile
 |  +- org.springframework.boot:spring-boot:jar:3.0.6:compile
 |  +- org.springframework.boot:spring-boot-autoconfigure:jar:3.0.6:compile
 |  +- jakarta.annotation:jakarta.annotation-api:jar:2.1.1:compile
 |  \- org.yaml:snakeyaml:jar:1.33:compile
 +- org.springframework.boot:spring-boot-starter-log4j2:jar:3.0.6:compile
 |  +- org.apache.logging.log4j:log4j-slf4j2-impl:jar:2.19.0:compile
 |  |  \- org.apache.logging.log4j:log4j-api:jar:2.19.0:compile
 |  +- org.apache.logging.log4j:log4j-core:jar:2.19.0:compile
 |  \- org.apache.logging.log4j:log4j-jul:jar:2.19.0:compile
 +- org.springframework:spring-webmvc:jar:6.0.8:compile
 +- org.apache.httpcomponents:httpclient:jar:4.5.14:compile
 |  +- org.apache.httpcomponents:httpcore:jar:4.4.16:compile
 |  \- commons-codec:commons-codec:jar:1.15:compile
 +- org.apache.httpcomponents:httpmime:jar:4.5.14:compile
 +- org.glassfish.hk2:osgi-resource-locator:jar:2.5.0-b42:compile
 +- org.json:json:jar:20160810:compile
 +- com.paypal.sdk:paypal-core:jar:1.7.2:compile
 +- com.paypal.sdk:rest-api-sdk:jar:1.13.0:compile
 +- com.paypal.sdk:adaptivepaymentssdk:jar:2.9.117:compile
 +- org.quartz-scheduler:quartz:jar:2.3.2:compile
 |  \- com.mchange:mchange-commons-java:jar:0.2.15:compile
 +- com.paypal.sdk:permissionssdk:jar:2.6.109:compile
 +- org.jsoup:jsoup:jar:1.10.2:compile
 +- commons-lang:commons-lang:jar:2.6:compile
 +- commons-logging:commons-logging:jar:1.2:compile
 +- mysql:mysql-connector-java:jar:8.0.30:compile
 |  \- com.google.protobuf:protobuf-java:jar:3.19.4:compile
 +- org.glassfish.jaxb:jaxb-runtime:jar:4.0.2:compile
 |  \- org.glassfish.jaxb:jaxb-core:jar:4.0.2:compile
 |     +- org.eclipse.angus:angus-activation:jar:2.0.0:runtime
 |     +- org.glassfish.jaxb:txw2:jar:4.0.2:compile
 |     \- com.sun.istack:istack-commons-runtime:jar:4.1.1:compile
 +- jakarta.xml.bind:jakarta.xml.bind-api:jar:4.0.0:compile
 |  \- jakarta.activation:jakarta.activation-api:jar:2.1.1:compile
 +- com.sun.xml.bind:jaxb-impl:jar:4.0.2:runtime
 |  \- com.sun.xml.bind:jaxb-core:jar:4.0.2:runtime
 +- jakarta.mail:jakarta.mail-api:jar:2.1.1:compile
 +- org.hibernate.orm:hibernate-core:jar:6.1.7.Final:compile
 |  +- jakarta.persistence:jakarta.persistence-api:jar:3.1.0:compile
 |  +- jakarta.transaction:jakarta.transaction-api:jar:2.0.1:compile
 |  +- org.jboss.logging:jboss-logging:jar:3.5.0.Final:runtime
 |  +- org.hibernate.common:hibernate-commons-annotations:jar:6.0.6.Final:runtime
 |  +- org.jboss:jandex:jar:2.4.2.Final:runtime
 |  +- com.fasterxml:classmate:jar:1.5.1:runtime
 |  +- net.bytebuddy:byte-buddy:jar:1.12.23:runtime
 |  +- jakarta.inject:jakarta.inject-api:jar:2.0.0:runtime
 |  \- org.antlr:antlr4-runtime:jar:4.10.1:runtime
 +- org.springframework.boot:spring-boot-starter-web:jar:3.0.6:compile
 +- org.springframework.boot:spring-boot-starter-tomcat:jar:3.0.6:compile
 |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:10.1.8:compile
 |  +- org.apache.tomcat.embed:tomcat-embed-el:jar:10.1.8:compile
 |  \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:10.1.8:compile
 +- org.apache.tomcat.embed:tomcat-embed-jasper:jar:10.1.8:compile
 |  \- org.eclipse.jdt:ecj:jar:3.33.0:compile
 +- jakarta.servlet:jakarta.servlet-api:jar:6.0.0:compile
 +- jakarta.servlet.jsp:jakarta.servlet.jsp-api:jar:3.0.0:compile
 +- org.glassfish.web:jakarta.servlet.jsp.jstl:jar:3.0.1:compile
 +- jakarta.servlet.jsp.jstl:jakarta.servlet.jsp.jstl-api:jar:3.0.0:compile
 |  \- jakarta.el:jakarta.el-api:jar:5.0.0:compile
 \- org.eclipse.jetty:apache-jsp:jar:11.0.15:compile
    +- org.eclipse.jetty:jetty-util:jar:11.0.15:compile
    +- org.mortbay.jasper:apache-jsp:jar:10.0.14:compile
    |  +- org.eclipse.jetty.toolchain:jetty-schemas:jar:5.2:compile
    |  \- org.mortbay.jasper:apache-el:jar:10.0.14:compile
    \- org.eclipse.jetty.toolchain:jetty-jakarta-servlet-api:jar:5.0.2:compile
6vl6ewon

6vl6ewon1#

类路径上有Servlet 5.0 API。这是org.eclipse.jetty:apache-jsp的传递依赖:

\- org.eclipse.jetty:apache-jsp:jar:11.0.15:compile
    +- org.eclipse.jetty:jetty-util:jar:11.0.15:compile
    +- org.mortbay.jasper:apache-jsp:jar:10.0.14:compile
    |  +- org.eclipse.jetty.toolchain:jetty-schemas:jar:5.2:compile
    |  \- org.mortbay.jasper:apache-el:jar:10.0.14:compile
    \- org.eclipse.jetty.toolchain:jetty-jakarta-servlet-api:jar:5.0.2:compile

考虑到您正在使用Tomcat并且已经依赖于org.apache.tomcat.embed:tomcat-embed-jasper,我怀疑是否需要依赖于Jetty的等价物(org.eclipse.jetty:apache-jsp)。
从您的pom中删除以下内容应该可以修复NoSuchMethodError

<!-- https://mvnrepository.com/artifact/org.eclipse.jetty/apache-jsp -->
<dependency>
    <groupId>org.eclipse.jetty</groupId>
    <artifactId>apache-jsp</artifactId>
</dependency>

相关问题