WAR中的Maven Jar依赖项产生ClassNotFoundException

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

我对J2ee项目(EAR + WAR)的maven依赖存在问题。更详细:

在WAR项目pom中,我具有JAR应用程序依赖项:

<dependency>
    <groupId>JAR_APP_groupid</groupId>
    <artifactId>JAR_APP_artifactid</artifactId>
    <version>JAR_APP_version</version>
</dependency>

上面的JAR(JAR_APP)由另一个包含以下依赖项的Maven项目制作:

<dependency>
    <groupId>org.apache.httpcomponents</groupId>
    <artifactId>httpclient</artifactId>
    <version>4.5.3</version>
</dependency>

问题是,当我构建WAR时,我在lib文件夹中看到JAR_APP依赖关系和httpclient(sub)依赖关系,但是当我在应用程序服务器(websphere 9.0)上运行该应用程序时,出现以下错误:

原因:java.lang.ClassNotFoundException:org.apache.http.client.methods.HttpUriRequest

我不知道为什么。你能帮我吗?

非常感谢。

maven jakarta-ee jar war classnotfoundexception
1个回答
0
投票

WebSphere已经使用Apache Http Components,并且类加载器从系统中选择一个。我认为可以更改AS加载依赖项的顺序(最后一个是父项)。

祝你好运,嘟嘟声

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