Java 即使存在轴 jar,也无法初始化类 org.apache.axis.client.AxisClient

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18529458/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 08:47:44  来源:igfitidea点击:

Could not initialize class org.apache.axis.client.AxisClient thrown even though axis jar was there

javaweb-servicesaxisnoclassdeffounderrornexus

提问by Harish Kayarohanam

I am writing a plugin for nexus oss . where I am using axis for making webservice calls . It throws an

我正在为 nexus oss 编写一个插件。我正在使用轴进行网络服务调用。它抛出一个

InvocationTargetException : target : java.lang.NoClassDefFoundError: Could not initialize class org.apache.axis.client.AxisClient

InvocationTargetException : target : java.lang.NoClassDefFoundError: 无法初始化类 org.apache.axis.client.AxisClient

so i was apprehensive if nexus could not find my axis jar as it threw this NoClassDefFoundError. so I started debugging step by step to check if nexus knows my axis jar and while debugging I found that the the control goes inside the axis jar (so my assumption that nexus did not see axis jar is wrong ). It went inside Service.javain axis and there the code was like

所以我很担心如果 nexus 找不到我的轴罐,因为它抛出了这个 NoClassDefFoundError。所以我开始逐步调试以检查 nexus 是否知道我的轴 jar,在调试时我发现控件进入轴 jar(所以我假设 nexus 没有看到轴 jar 是错误的)。它进入了Service.java中的轴,那里的代码就像

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();
}

It was throwing this exception at line engine = getAxisClient(); that is actually at line return new AxisClient(getEngineConfiguration()); inside getAxisClient method . so if it can find service.java which is inside axis.jar , there cannot be any reason why it cannot find the AxisClient class which is in the same package in axis jar.

它在 line engine = getAxisClient(); 处抛出这个异常。这实际上是在 line return new AxisClient(getEngineConfiguration()); 在 getAxisClient 方法中。因此,如果它可以找到位于 axis.jar 中的 service.java ,那么就没有任何理由无法找到轴 jar 中同一个包中的 AxisClient 类。

So can you please help me in spotting out the reasons for this exception.

所以你能帮我找出这个例外的原因吗?

Is my axis jar not fetched by nexus ? How to find if the jar was fetched by nexus ?

我的轴罐不是由 nexus 获取的吗?如何查找 jar 是否由 nexus 获取?

采纳答案by Harish Kayarohanam

My boss helped me find the answer .

我的老板帮我找到了答案。

It was actually the problem with commons-logging . I loaded a commons-logging in my nexus .The nexus which was running in a jetty server itself had a commons-logging , so there was a conflict . Now I removed my commons logging from the plugin descriptor . Then the problem was over , my plugin started working .

这实际上是 commons-logging 的问题。我在我的 nexus 中加载了一个 commons-logging。在码头服务器中运行的 nexus 本身有一个 commons-logging,所以有一个冲突。现在我从插件描述符中删除了我的公共日志记录。然后问题就解决了,我的插件开始工作了。

Thanks .

谢谢 。