【发布时间】:2020-01-05 14:47:51
【问题描述】:
我对 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(子)依赖项,但是当我在应用程序服务器(websphere 9.0)上运行应用程序时,我收到以下错误:
原因:java.lang.ClassNotFoundException: org.apache.http.client.methods.HttpUriRequest
我不知道为什么。 你能帮帮我吗?
非常感谢。
【问题讨论】:
-
Maven中的JAR_APP项目有什么样的打包方式?
-
Websphere 可以有自己的不同版本的 httpclient 吗?
-
包装是JAR
-
如果是 websphere,您需要将 httpclient 定义为提供的范围......并且您必须针对 websphere 提供的版本进行构建。
-
我试图将 org.apache.httpcomponents 定义为提供的范围。我也尝试排除对WAR pom的依赖...但问题仍然存在。
标签: maven jakarta-ee jar war classnotfoundexception