Glassfish 4.1 LogFactory和WSSElementFactory NoClassDefFoundError

时间:2017-07-24 12:21:48

标签: java web-services glassfish apache-commons

当我在Glassfish 4.1服务器上运行我的休息api点时,即使我以NoClassDefFoundError作为依赖性发送耳朵,我也会面对commons-logging,即使该库已在WEB-INF\lib下解压缩

看起来我不会使用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)

1 个答案:

答案 0 :(得分:1)

也许我的回答是,但是我在Glassfish 4.1.1中遇到了同样的问题,并设法通过更新Metro库解决了该问题

这是一条指令:

  1. 下载并解压缩Apps Script Trigger
  2. 从您的 glassfish / modules 文件夹中删除(备份)一些文件:
  • jaxb-extra-osgi.jar
  • jaxb-osgi.jar
  • stax2-api.jar
  • webservices-extra-jdk-packages.jar
  • webservices-osgi.jar
  • woodstox-core-asl.jar
  1. 用解压缩后的 metro / osgi 内容替换它们
  2. 停止Glassfish
  3. 删除 domain1 /生成的 domain1 / osgi-cache 文件夹的内容
  4. 开始Glassfish

对我有用,两个错误都消失了

希望它会帮助某人