Glassfish 4.1 LogFactory and WSSElementFactory NoClassDefFoundError

Viewed 679

When I run my rest api point on a Glassfish 4.1 server I face following NoClassDefFoundError even if I ship the ear with commons-logging as dependecy respectively even if the library is unpacked under WEB-INF\lib

Also it look like that I don't face the problem using Glassfish 4.0

Any ideas how to solve this problem?

First LogFactory isn't found

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)

and then WSSElementFactory isn't too

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 Answers

Maybe my answer is little outdated, but I've encountered the same problem with Glassfish 4.1.1 and managed to solve it by updating Metro libraries

Here is an instruction:

  1. Download and unzip https://maven.java.net/content/repositories/releases//org/glassfish/metro/metro-standalone/2.3.1/metro-standalone-2.3.1.zip
  2. Delete (backup) some files from your glassfish/modules folder:
  • jaxb-extra-osgi.jar
  • jaxb-osgi.jar
  • stax2-api.jar
  • webservices-extra-jdk-packages.jar
  • webservices-osgi.jar
  • woodstox-core-asl.jar
  1. Replace them with metro/osgi content from unpacked zip
  2. Stop Glassfish
  3. Delete content of domain1/generated and domain1/osgi-cache folders
  4. Start Glassfish

It worked for me, both errors were gone

Hope it'll help someone

Related