payara / Payara

Payara Server is an open source middleware platform that supports reliable and secure deployments of Java EE (Jakarta EE) and MicroProfile applications in any environment: on premise, in the cloud or hybrid.
http://www.payara.fish
Other
882 stars 306 forks source link

java.lang.NoClassDefFoundError with a WSIT SOAP WebService #493

Closed Aldur300 closed 8 years ago

Aldur300 commented 8 years ago

Having a bug on version Payara Server 4.1.1.154 #badassfish (build 270)

It is a wsit enabled SOAP web service:

Severe: org/apache/commons/logging/LogFactory java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at org.apache.xml.security.Init.(Init.java:59) at com.sun.xml.ws.security.opt.impl.incoming.SecurityRecipient.(SecurityRecipient.java:132) at com.sun.xml.wss.provider.wsit.WSITServerAuthContext.verifyInboundMessage(WSITServerAuthContext.java:587) at com.sun.xml.wss.provider.wsit.WSITServerAuthContext.validateRequest(WSITServerAuthContext.java:364) at com.sun.xml.wss.provider.wsit.WSITServerAuthContext.validateRequest(WSITServerAuthContext.java:267) at com.sun.enterprise.security.webservices.CommonServerSecurityPipe.processRequest(CommonServerSecurityPipe.java:170) at com.sun.enterprise.security.webservices.CommonServerSecurityPipe.process(CommonServerSecurityPipe.java:141) at com.sun.xml.ws.api.pipe.helper.PipeAdapter.processRequest(PipeAdapter.java:119) 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.server.WSEndpointImpl$2.process(WSEndpointImpl.java:419) at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:868) at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:422) at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:169) at org.glassfish.webservices.Ejb3MessageDispatcher.handlePost(Ejb3MessageDispatcher.java:110) at org.glassfish.webservices.Ejb3MessageDispatcher.invoke(Ejb3MessageDispatcher.java:80) at org.glassfish.webservices.EjbWebServiceServlet.dispatchToEjbEndpoint(EjbWebServiceServlet.java:210) at org.glassfish.webservices.EjbWebServiceServlet.service(EjbWebServiceServlet.java:153) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.glassfish.grizzly.servlet.ServletHandler.doServletService(ServletHandler.java:226) at org.glassfish.grizzly.servlet.ServletHandler.service(ServletHandler.java:178) at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167) at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206) at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180) at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235) at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119) at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:283) at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200) at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:132) at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:111) at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77) at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:536) at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137) at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:591) at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:571) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory not found by org.glassfish.metro.webservices-osgi [289] at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1532) at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75) at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1955) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 42 more

harf18 commented 8 years ago

Same bug

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)

smillidge commented 8 years ago

I think this maybe something in this version. Can you try 4.1.153 and see if the problem is exhibited there?

Aldur300 commented 8 years ago

On 4.1.153 it is working fine.

smillidge commented 8 years ago

This looks like a regression of #218

smillidge commented 8 years ago

This is likely due to https://github.com/payara/Payara/commit/b9c3a68f11efd581619e689f2420ab6e5212ddfb#diff-a93fde4983f83219e364fad801d455a3 and the synch up with upstream

harf18 commented 8 years ago

For me, even in 4.1.153, the issue is still here when I call the webservice method :

[2015-11-06T11:03:28.922+0100] [Payara 4.1] [SEVERE] [] [] [tid: _ThreadID=63 _ThreadName=Thread-21] [timeMillis: 1446804208922] [levelValue: 1000] [[ 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) at com.sun.proxy.$Proxy457.getDateHeureReference(Unknown Source) at fr.cnous.beforeizly.soap.servlet.clientsoap.processRequest(clientsoap.java:48) at fr.cnous.beforeizly.soap.servlet.clientsoap.doGet(clientsoap.java:87) at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:344) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) at fr.cnous.beforeizly.filter.AuthentificationFilter.filter(AuthentificationFilter.java:94) at fr.cnous.beforeizly.filter.AuthentificationFilter.doFilter(AuthentificationFilter.java:43) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:316) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673) at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java) at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:416) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:283) at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167) at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206) at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180) at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235) at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119) at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:283) at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200) at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:132) at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:111) at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77) at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:536) at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137) at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:591) at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:571) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at org.apache.xml.security.Init.(Init.java:59) at com.sun.xml.ws.security.opt.impl.util.WSSElementFactory.(WSSElementFactory.java:117) at com.sun.xml.ws.security.opt.impl.JAXBFilterProcessingContext.getSecurityHeader(JAXBFilterProcessingContext.java:197) at com.sun.xml.ws.security.opt.impl.JAXBFilterProcessingContext.setJAXWSMessage(JAXBFilterProcessingContext.java:167) at com.sun.xml.wss.jaxws.impl.SecurityTubeBase.secureOutboundMessage(SecurityTubeBase.java:384) at com.sun.xml.wss.jaxws.impl.SecurityClientTube.processClientRequestPacket(SecurityClientTube.java:325) at com.sun.xml.wss.jaxws.impl.SecurityClientTube.processRequest(SecurityClientTube.java:249) ... 50 more Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory not found by org.glassfish.metro.webservices-osgi [289] at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1532) at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75) at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1955) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 57 more]]

harf18 commented 8 years ago

Same problem with Glassfish new release 4.1.1 but work fine with Glassfish 4.1

dmatej commented 8 years ago

Commons logging is deprecated for a long time ... all projects using it should replace it with JUL or SLF4J or other framework. The other way is to do something like SLF4J adapter does - reimplement ACL api and map it to used logging system ... Also be careful with dependency of JAX-WS Metro on JAXB ... sometimes it is a bit fragile ... maybe it would be good to write some tests to check some basic compatiblity. I got something in our project, I can maybe reimplement something similar (JAX-WS client connecting to HTTPS SOAP service) ... but now I'm too late with our project issues ...

Can you provide some SOAP XML example? It seems it is connected with a processing of headers. As a workaround it may help adding commons.logging.jar to domain's lib directory.

Davio commented 8 years ago

Putting the commons-lib in the domain-lib folder didn't work for me. It seemed to be an issue with initializing the web service for the first time. I used OpenSAML, but don't know if that had anything to do with it.

Reverting to Payara 4.1.153 worked.

harf18 commented 8 years ago

I use WS-Security with certificate authentication and it still not working with 4.1.153. Exemple of request :

<?xml version='1.0' encoding='UTF-8'?>
<S:Envelope xmlns:S="http://www.w3.org/2003/05/soap-envelope"
    xmlns:wsse11="http://docs.oasis-open.org/wss/oasis-wss-wssecurity-secext-1.1.xsd"
    xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
    xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
    xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
    xmlns:exc14n="http://www.w3.org/2001/10/xml-exc-c14n#">
    <S:Header>
        <To xmlns="http://www.w3.org/2005/08/addressing" wsu:Id="_5002"
            >https://myUrl/endpoint/service.svc</To>
        <Action xmlns="http://www.w3.org/2005/08/addressing"
            xmlns:S="http://www.w3.org/2003/05/soap-envelope" S:mustUnderstand="true"
            >http://myUrl/Method</Action>
        <ReplyTo xmlns="http://www.w3.org/2005/08/addressing">
            <Address>http://www.w3.org/2005/08/addressing/anonymous</Address>
        </ReplyTo>
        <FaultTo xmlns="http://www.w3.org/2005/08/addressing">
            <Address>http://www.w3.org/2005/08/addressing/anonymous</Address>
        </FaultTo>
        <MessageID xmlns="http://www.w3.org/2005/08/addressing"
            >uuid:186fc2e3-526a-4cfb-8ac8-b4b678bb2ed9</MessageID>
        <wsse:Security S:mustUnderstand="true">
            <wsu:Timestamp
                xmlns:ns17="http://docs.oasis-open.org/ws-sx/ws-secureconversation/200512"
                xmlns:ns16="http://schemas.xmlsoap.org/soap/envelope/" wsu:Id="_1">
                <wsu:Created>2015-11-10T09:33:41Z</wsu:Created>
                <wsu:Expires>2015-11-10T09:38:41Z</wsu:Expires>
            </wsu:Timestamp>
            <wsse:BinarySecurityToken
                xmlns:ns17="http://docs.oasis-open.org/ws-sx/ws-secureconversation/200512"
                xmlns:ns16="http://schemas.xmlsoap.org/soap/envelope/"
                ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"
                EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary"
                wsu:Id="uuid_00e91f04-4758-41cd-ba0b-72c9a78fb77c"> xxxxxxxxxx BINARY TOKEN xxxxxxxxxxxxxx</wsse:BinarySecurityToken>
            <ds:Signature xmlns:ns17="http://docs.oasis-open.org/ws-sx/ws-secureconversation/200512"
                xmlns:ns16="http://schemas.xmlsoap.org/soap/envelope/" Id="_2">
                <ds:SignedInfo>
                    <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
                        <exc14n:InclusiveNamespaces PrefixList="wsse S"/>
                    </ds:CanonicalizationMethod>
                    <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
                    <ds:Reference URI="#_1">
                        <ds:Transforms>
                            <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
                                <exc14n:InclusiveNamespaces PrefixList="wsu wsse S"/>
                            </ds:Transform>
                        </ds:Transforms>
                        <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
                        <ds:DigestValue>xxxxxxxxxxxxxxx DIGEST VALUE xxxxxxxxxxxxxxxx=</ds:DigestValue>
                    </ds:Reference>
                    <ds:Reference URI="#_5002">
                        <ds:Transforms>
                            <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
                                <exc14n:InclusiveNamespaces PrefixList="S"/>
                            </ds:Transform>
                        </ds:Transforms>
                        <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
                        <ds:DigestValue>xxxxxxxxxxxxxxx DIGEST VALUE xxxxxxxxxxxxxxxx</ds:DigestValue>
                    </ds:Reference>
                </ds:SignedInfo>
                <ds:SignatureValue> xxxxxxxxxxxxxxx SIGNATURE xxxxxxxxxxxxxxxx</ds:SignatureValue>
                <ds:KeyInfo>
                    <wsse:SecurityTokenReference>
                        <wsse:Reference URI="#uuid_00e91f04-4758-41cd-ba0b-72c9a78fb77c"
                            ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"
                        />
                    </wsse:SecurityTokenReference>
                </ds:KeyInfo>
            </ds:Signature>
        </wsse:Security>
    </S:Header>
    <S:Body>
        <GetInfoCarteCrousRequest xmlns="http://www.example.org/wsGCCSchema"
            xmlns:ns2="http://myUrl/wschema">
            <param1>ca</param1>
            <param2>86</param2>
        </GetInfoCarteCrousRequest>
    </S:Body>
</S:Envelope>
geger75 commented 8 years ago

Not working here as well. @dmatej -> workaround does not work.

The huge advantage of Payara 4.1.1.154 for us right now is to be able to deploy our application in a two remote nodes cluster without any issues (on Payara 4.1.153 we are able to do it ONLY on a one node cluster).

This issue is nevertheless a clear blocker for us, so we stick, for now, to Payara 4.1.153

Attached a simple example using basic WSS 1.1.1 Web Services Security Username Token Profile : Netbeans 8.0.2 project (zip) + jar (remove .txt)

For the test use the default realm of type file on Payara. Edit the file realm and add the user TST with password TST

Sample request :

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ejb="http://ejb.ws.com/">
   <soapenv:Header>
    <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
        <wsse:UsernameToken wsu:Id="UsernameToken-C58CB758D72BB9DB65141779727008327">
          <wsse:Username>TST</wsse:Username>
          <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">TST</wsse:Password>
        </wsse:UsernameToken>
    </wsse:Security>
   </soapenv:Header>
   <soapenv:Body>
      <ejb:op1>
         <arg0>TST</arg0>
      </ejb:op1>
   </soapenv:Body>
</soapenv:Envelope>

EJBModule.jar.txt EJBModule.zip.txt

smillidge commented 8 years ago

Fixed by #545

peterpeterparker commented 7 years ago

@harf18 did you ever found a solution to fix that glassfish issue?

harf18 commented 7 years ago

Last version fix the problem

peterpeterparker commented 7 years ago

@harf18 thx for the feedback. do you mean last stable version 4.1.2 or a beta like 5.0-b13?

really appreciate your help, thx a lot in advance!

harf18 commented 7 years ago

I mean Payara 4.1.1.163 at least. I use the last payara release since few days (4.1.2.172) and it's working fine !

peterpeterparker commented 7 years ago

Understood, thx the feedback