当我在 Glassfish 4.1 服务器上运行我的 rest api 点时,即使我分别将耳朵与commons-logging
作为依赖项一起运送,即使库在WEB-INFlib
下解压缩,我也面临以下NoClassDefFoundError
看起来我在使用Glassfish 4.0时不会遇到问题
有什么想法可以解决这个问题吗?
找不到第一个LogFactory
javax.xml.ws.WebServiceException: java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at com.sun.xml.wss.jaxws.impl.SecurityClientTube.processRequest(SecurityClientTube.java:252)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:1136)
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:1050)
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:1019)
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:877)
at com.sun.xml.ws.client.Stub.process(Stub.java:463)
at com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:191)
at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:108)
at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:92)
at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:161)
然后WSSElementFactory
不是太
javax.xml.ws.WebServiceException: java.lang.NoClassDefFoundError: Could not initialize class com.sun.xml.ws.security.opt.impl.util.WSSElementFactory
at com.sun.xml.wss.jaxws.impl.SecurityClientTube.processRequest(SecurityClientTube.java:252)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:1136)
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:1050)
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:1019)
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:877)
at com.sun.xml.ws.client.Stub.process(Stub.java:463)
at com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:191)
at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:108)
at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:92)
at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:161)
也许我的答案有点过时,但我在 Glassfish 4.1.1 中遇到了同样的问题,并通过更新 Metro 库设法解决了它
这是一个说明:
- 下载并解压缩 https://maven.java.net/content/repositories/releases//org/glassfish/metro/metro-standalone/2.3.1/metro-standalone-2.3.1.zip
- 从您的玻璃鱼/模块文件夹中删除(备份(一些文件:
- JAXB-extra-OSGi.jar
- Jaxb-OSGI.jar
- stax2-api.jar
- WebServices-extra-JDK-packages.jar
- WebServices-OSGi.jar
- 伍德斯托克斯核心ASL.jar
- 将它们替换为解压缩的metro/osgi内容
- 停止玻璃鱼 删除域 1/
- 生成文件夹和域 1/osgi 缓存文件夹的内容
- 启动玻璃鱼
它对我有用,两个错误都消失了
希望它能帮助某人