繁体   English   中英

Spring Boot 2.2 activemq 码头冲突

[英]Spring boot 2.2 activemq jetty conflict

我正在尝试将 Spring boot 与 jetty starter 一起升级到 2.2 版。 由于码头版本冲突,我收到这些错误以下方法不存在:

'org.eclipse.jetty.websocket.server.NativeWebSocketConfiguration org.eclipse.jetty.websocket.server.NativeWebSocketServletContainerInitializer.initialize(org.eclipse.jetty.servlet.ServletContextHandler)'

该方法的类 org.eclipse.jetty.websocket.server.NativeWebSocketServletContainerInitializer 可从以下位置获得:

jar:file:/some-dir/target/p3.0.166-SNAPSHOT.war!/WEB-INF/lib/jetty-all-9.4.19.v20190610-uber.jar!/org/eclipse/jetty/websocket/server/NativeWebSocketServletContainerInitializer.class
jar:file:/some-dir/target/p3.0.166-SNAPSHOT.war!/WEB-INF/lib/websocket-server-9.4.20.v20190813.jar!/org/eclipse/jetty/websocket/server/NativeWebSocketServletContainerInitializer.class

我有 activemq 依赖项,它引入了自己的码头所有版本 9.4.19 依赖项,这与 spring-boot 2.2 码头 (9.4.20) 冲突

在此处输入图片说明

我的 pom.xml 的一部分是:

       <dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <exclusions>
            <exclusion>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-tomcat</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

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

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
            <!--
        Jsp-api isn't standard in spring boot
    -->
    <dependency>
        <groupId>javax.servlet.jsp</groupId>
        <artifactId>javax.servlet.jsp-api</artifactId>
        <version>${jsp.version}</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <scope>provided</scope>
    </dependency>

    <!-- artefacts enable JSP running in spring-boot -->
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
    </dependency>
    <dependency>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>apache-jsp</artifactId>
    </dependency>
    <dependency>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>apache-jstl</artifactId>
    </dependency>

    <!--
        Used to be a single artifact.
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
        Newer versions splits the interface and implementation.
        This suggests to use a Glassfish implementation.
        https://www.andygibson.net/blog/quickbyte/jstl-missing-from-maven-repositories/
        The one we used had an Apache implementation, so going with that.
        https://stackoverflow.com/a/24444342
        -->
    <dependency>
        <groupId>org.apache.taglibs</groupId>
        <artifactId>taglibs-standard-spec</artifactId>
        <version>${taglibs.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.taglibs</groupId>
        <artifactId>taglibs-standard-impl</artifactId>
        <version>${taglibs.version}</version>
    </dependency>
            <!-- Unit test dependencies -->
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.easytesting</groupId>
        <artifactId>fest-assert</artifactId>
        <version>1.4</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-core</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-test</artifactId>
        <scope>test</scope>
    </dependency>

    <!-- html compressing is used by hrmanager in the JSP -->
    <dependency>
        <groupId>com.googlecode.htmlcompressor</groupId>
        <artifactId>htmlcompressor</artifactId>
        <version>1.5.2</version>
    </dependency>

    <!-- ApacheMQ HTTP jarfile set -->
    <dependency>
        <groupId>org.apache.activemq</groupId>
        <artifactId>activemq-client</artifactId>
    </dependency>
    <dependency>
        <groupId>org.apache.activemq</groupId>
        <artifactId>activemq-http</artifactId>
    </dependency>
</dependencies>

知道我该如何解决这个问题吗?

ActiveMQ 在这里是错误的。

jetty-all不打算用作项目中的依赖项。

https://www.eclipse.org/lists/jetty-users/msg06030.html

它仅作为文档的命令行工具存在,用于向人们介绍 Jetty 的基本功能集。

它没有也不可能包含 Jetty 的所有内容。

一个拥有 Jetty 生产的所有东西的单一工件是不可能的。

正如@Shilan 指出的那样,排除jetty-all是正确的解决方案。

使用其他适当的依赖项(似乎是spring-boot-starter-jetty )将已经引入您需要的正确 Jetty 传递依赖项。

您可以从命令行使用$ mvn dependency:tree来查看这一点(在排除jetty-all之前和之后)

您可能希望运行其中一个重复类查找器 maven 插件,以查看您正在执行的其他重复类并对其进行更正。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM