【发布时间】:2015-07-30 23:21:47
【问题描述】:
我有一个使用 WAS 8.5.5 的 Maven 网络应用程序。
应用启动时出现以下错误:
引起:java.lang.NoSuchFieldError: org/apache/http/message/BasicLineFormatter.INSTANCE
这意味着我的类路径中存在某种不匹配的 jars(httpclient 和 httpcore)。
为了获取更多信息,我运行了以下代码:
ClassLoader classLoader = Test.class.getClassLoader();
URL resource = classLoader.getResource("org/apache/http/message/BasicLineFormatter.class");
log.info("Outputting resoure info: " + resource.getFile() + " " + resource.getPath() + " " + resource.getRef());
try {
log.info(FileLocator.resolve(resource));
log.info(FileLocator.toFileURL(resource));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
这给了我以下输出:
开始输出资源信息: /org/apache/http/message/BasicLineFormatter.class /org/apache/http/message/BasicLineFormatter.class 空开始 jar:file:/C:/RAD9.0/IBM/WebSphere/AppServer_2/plugins/com.ibm.ws.prereq.jaxrs.jar!/org/apache/http/message/BasicLineFormatter.class 开始 文件:/C:/RAD9.0/IBM/WebSphere/AppServer_2/profiles/AppSrv01/servers/server1/configuration/org.eclipse.osgi/bundles/105/1/.cp/org/apache/http/message/BasicLineFormatter .class
这些显然都是在启动时加载到 WAS 的。我该如何阻止这种情况发生?我尝试通过最后设置加载父级来更改应用程序设置中模块加载的优先级,但这完全阻止了应用程序的出现。
有什么想法吗?
【问题讨论】:
标签: java maven dependencies websphere