java - 无法初始化类 org.apache.axis.client.AxisClient 即使 Axis jar 在那里

标签 java web-services axis noclassdeffounderror nexus

我正在为 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/

相关文章:

java - mybatis 在 @Test 中有效,但在主代码中无效

java - Teiid 可以像 RDBMS 一样使用 VIEW 吗?

web-services - 如何替换 AXIS 的 "Hi there, this is an AXIS service!"页面?

c# - 用鼠标移动对象但不移动到鼠标指针所在的位置

java - 测试 Axis 1.4 SOAP 调用时有条件地模拟异常/返回值

java - 在 RHS 处引用 Spring XML 中的属性的属性?

java - 如何在 Windows 10 环境中从 Java 运行在 Ubuntu 上用 Bash 编写的 shell 脚本?

java - 使用串口向打印机发送ESC/POS命令

java - 我如何在过滤器中获取请求

java - 如何从 axis1 stub 获取传输的响应 header