未找到 Java Axis Web 服务项目依赖项

发布于 2024-07-27 17:10:58 字数 781 浏览 7 评论 0原文

我有一个 Axis (1.4) Web 服务(在 Tomcat 6.0.20 上运行),该服务工作正常,直到我尝试使用另一个项目中的任何类。

我有我的 Web 服务项目和另一个包含业务逻辑的项目。 我已将业务逻辑项目添加为我的 Web 服务项目中的项目依赖项/引用。

package MyProject.services;
import BusinessLogic.Core.TestClass;

    public class MyServiceImpl implements MyProject.services.MyServiceImpl_PortType {

    public java.lang.String getServerStatus() throws java.rmi.RemoteException {
             //BusinessLogic.Core.TestClass core = new BusinessLogic.Core.TestClass();
             return "This is working fine!";
    }
}

当我调用上面的方法时,一切正常。 但是,如果我取消注释 getServerStatus() 中的行,则会收到 NoClassDefFoundException。

代码当然编译得很好,据我所知,我已经添加了所有依赖项。 TestClass 只有一个打印“Hello”的构造函数,没有其他依赖项。

我对 java web 服务比较陌生,所以这可能只是我犯的一个愚蠢的错误。 你有什么想法?

I have an Axis (1.4) web service (running on Tomcat 6.0.20) that is working fine until I try to use any class from another project.

I have my web service project and another project containing business logic. I have added the business logic project as a project dependency/reference in my web service project.

package MyProject.services;
import BusinessLogic.Core.TestClass;

    public class MyServiceImpl implements MyProject.services.MyServiceImpl_PortType {

    public java.lang.String getServerStatus() throws java.rmi.RemoteException {
             //BusinessLogic.Core.TestClass core = new BusinessLogic.Core.TestClass();
             return "This is working fine!";
    }
}

When I invoke the method above, everything works fine. However, if I uncomment the line in getServerStatus(), I get a NoClassDefFoundException.

The code is ofcourse compiling fine and as far as I can see i have added all dependencies.
The TestClass has only a constructor that prints "Hello" and has no other dependencies.

I'm relatively new to java web services so it is probably just a stupid mistake I have made. Do you have any ideàs?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

温折酒 2024-08-03 17:10:58

你说你在不同的项目中拥有它们。 如果这意味着 Tomcat 内有 WAR 文件/文件夹,那么您的问题可能是一个 Web 应用程序无法直接看到任何其他 Web 应用程序(包括类路径)。

如果没有,请编辑您的问题,使其非常具体地说明您所看到的内容和您的期望。

You say you have them in different projects. If this means WAR-files/folders inside Tomcat, then your problem could be that one web application cannot see any other web application directly (including classpath).

If not, then edit your question to be very specific about what you see and what you expect.

荆棘i 2024-08-03 17:10:58

您还没有说明您是如何构建和部署它的。 TestClass 是否在 jar 文件中? 如果是,jar 文件在已部署系统中的位置,以及您的 Web 服务类是如何部署的?

You haven't said how you're building and deploying this. Is TestClass in a jar file somewhere? If so, where is the jar file in the deployed system, and how are your web service classes deployed?

野の 2024-08-03 17:10:58

这不是您问题的答案,但您可以使用这个免费的 soapui

来查看生成的 wsdl并调用服务上的方法。
这意味着您可以测试您的服务,而无需编译存根并将其部署到第二个测试客户端(您必须在稍后阶段执行此操作)

希望这会有所帮助

This is not an answer to your question but you can use this free soapui

to look at the wsdl that is produced and call methods on the service.
This means that you can test your service without compiling and deploying the stubs to a second test client (which you will have to do at a later stage)

Hope this helps

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文