我正在为 nexus oss 写一个插件。我在其中使用 axis 进行 webservice 调用。它抛出一个
InvocationTargetException:目标:java.lang.NoClassDefFoundError:无法初始化类 org.apache.axis.client.AxisClient
所以如果 nexus 抛出这个 NoClassDefFoundError 找不到我的 axis jar,我很担心。所以我开始逐步调试以检查 nexus 是否知道我的 axis jar 并且在调试时我发现控件进入 axis jar 内部(所以我假设 nexus 没有看到 axis jar 是错误的)。它进去了Service.java在 Axis 上,那里的代码就像
protected AxisClient getAxisClient() {
return new AxisClient(getEngineConfiguration());
}
/**
* Constructs a new Service object - this assumes the caller will set
* the appropriate fields by hand rather than getting them from the
* WSDL.
*/
public Service() {
engine = getAxisClient();
}
它在 engine = getAxisClient(); 行抛出这个异常;实际上在行 return new AxisClient(getEngineConfiguration());在 getAxisClient 方法中。 因此,如果它能找到 axis.jar 中的 service.java,那么就没有任何理由找不到 axis jar 中同一包中的 AxisClient 类。
那么你能帮我找出这个异常的原因吗。
我的 axis jar 没有被 nexus 获取吗? 如何查找 jar 是否被 nexus 获取?
最佳答案
我的老板帮我找到了答案。
其实是 commons-logging 的问题。我在我的 nexus 中加载了一个 commons-logging 。在 jetty 服务器中运行的 nexus 本身有一个 commons-logging ,所以发生了冲突。现在我从插件描述符中删除了我的公共(public)日志记录。然后问题就解决了,我的插件开始工作了。
谢谢。
关于java - 无法初始化类 org.apache.axis.client.AxisClient 即使 Axis jar 在那里,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18529458/