[javax.servlet.ServletContext从springboot应用程序中的多个依赖项加载]]

问题描述 投票:0回答:1

所以我有这个springboot应用程序,我正在从WAS迁移到springboot设置。我有几个必须配置的JSP。为了适应这些,我添加了以下依赖项:

    <dependency>
        <groupId>org.apache.tomcat.embed</groupId>
        <artifactId>tomcat-embed-jasper</artifactId>
        <version>9.0.22</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <scope>provided</scope>
    </dependency>

该应用程序已经带有以下依赖关系,该依赖关系在整个应用程序中都使用:

    <dependency>
      <groupId>com.ibm</groupId>
      <artifactId>com.ibm-jaxrpc-client</artifactId>
      <version>6.0</version>
    </dependency>

我面临的问题是,这两个依赖项(jaxrpc-client和tomcat-embed-jasper)都具有javax.servlet.ServletContext类,这会导致以下错误:

The method's class, javax.servlet.ServletContext, is available from the following locations:

    jar:file:/C:/Users/.m2/repository/com/ibm/com.ibm-jaxrpc-client/6.0/com.ibm-jaxrpc-client-6.0.jar!/javax/servlet/ServletContext.class
    jar:file:/C:/Users/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.30/tomcat-embed-core-9.0.30.jar!/javax/servlet/ServletContext.class

It was loaded from the following location:

    file:/C:/Users/.m2/repository/com/ibm/com.ibm-jaxrpc-client/6.0/com.ibm-jaxrpc-client-6.0.jar


Action:

Correct the classpath of your application so that it contains a single, compatible version of javax.servlet.ServletContext

我无力删除任何依赖项。 jaxrpc-client已在太多地方的代码中被引用,我需要tomcat-embed-jasper来呈现我的jsp页面。我不能排除ServletContext类,因为它不是依赖项(如果我对排除的概念没错的话)。请帮助解决此问题。

所以我有这个springboot应用程序,我正在从WAS迁移到springboot设置。我有几个必须配置的JSP。为了适应这些,我添加了以下内容...

java spring-boot servlets
1个回答
0
投票

我不熟悉IBM的jaxrpc客户端,但是我认为,在尝试加载应用程序时,您在运行时会遇到此异常。

© www.soinside.com 2019 - 2024. All rights reserved.