4 Replies Latest reply on Apr 5, 2012 7:15 PM by ffang

    cxf saml client java.lang.ClassNotFoundException: org.joda.time.ReadableIns

    padams

      I'm new to FuseESB and am trying to test interoperability with an external web service secured by SAML SV.  I'm having an issue with my osgi bundle resolving a class when building the SAML Token to place in an outgoing web service request.

       

      Caused by: java.lang.NoClassDefFoundError: org/joda/time/ReadableInstant

              at org.apache.ws.security.saml.ext.AssertionWrapper.(AssertionWrapper.java:279)[130:org.apache.ws.security.wss4j:1.6.1]

              at org.apache.cxf.ws.security.wss4j.policyhandlers.AbstractBindingBuilder.addSamlToken(AbstractBindingBuilder.java:891)[132:org.apache.cxf.bundle:2.4.3.fuse-01-02]

      ...

      Caused by: java.lang.ClassNotFoundException: org.joda.time.ReadableInstant not found by org.apache.ws.security.wss4j

              at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:845)

              at org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:74)

              at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1839)

              at java.lang.ClassLoader.loadClass(ClassLoader.java:247)[:1.6.0_30]

       

      This happens whether I manually instantiate the CXF client or configure it via spring.  I have tried adding the joda-time bundle explicitly as a dependency but this makes no difference.  In addition, while my bundle only uses this package indirectly, I have explicitly added to the list of packages to import and again this makes no difference.

       

      Does anyone have any pointers of where I can look to debug this issue?

       

      wss4j and joda-time appear to be installed and active.

      karaf@root> osgi:list | grep -i wss

      WSS4J (1.6.1)

      WSS4J (1.6.6.SNAPSHOT)

      karaf@root> osgi:list | grep -i joda

      Apache ServiceMix Bundles: joda-time-1.5.2 (1.5.2.2)

       

      Though I'm rather new to osgi so there's likely something else I'm overlooking.  I have enabled trace logging as well and nothing jumps out at me.

       

      Thanks.

        • 1. Re: cxf saml client java.lang.ClassNotFoundException: org.joda.time.ReadableIns
          ffang

          Hi,

           

          My first glance is that you have

          220 Installed 60 WSS4J (1.6.6.SNAPSHOT)

          which shouldn't be here at all, why you introduce WSS4J 1.6.6-SNAPSHOT? Our FUSE ESB release doesn't have this version.

           

          Freeman

          • 2. Re: cxf saml client java.lang.ClassNotFoundException: org.joda.time.ReadableIns
            ffang

            Hi,

             

            I get it, it comes from that we have a 1.5.x joda-time bundle installed which can't meet wss4j optional import requirement(which need joda-time 1.6.x). But you shouldn't have WSS4J (1.6.6.SNAPSHOT) installed in any case.

             

            You didn't mention which FUSE ESB verison you're using, I assume it's

            4.4.1-fuse-03-06, so you can edit

            FUSE_ESB/system/org/apache/activemq/activemq-karaf/5.5.1-fuse-03-06/activemq-karaf-5.5.1-fuse-03-06-features.xml

            change

            mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.joda-time/1.5.2_2

            to

            mvn:joda-time/joda-time/1.6.2

             

            then remove

            FUSE_ESB/data folder and restart FUSE ESB, then your SAML client should work.

             

            I'll create an internal jira and fix it soon.

             

            Freeman

            • 3. Re: cxf saml client java.lang.ClassNotFoundException: org.joda.time.ReadableIns
              padams

              I had noticed the extra version of WSS4J and am not sure exactly how it got there, something dumb I did no doubt, so I removed that.  I also made the change suggested to update the version of joda-time and this moved me forward.  My requests are now round tripping successfully with the service but failing once the response gets back with:

               

              java.lang.NoSuchMethodError: org.apache.ws.security.WSDataRef.getTransformAlgorithms()Ljava/util/List;

                   at org.apache.cxf.ws.security.wss4j.policyvalidators.AlgorithmSuitePolicyValidator.checkDataRefs(AlgorithmSuitePolicyValidator.java:124)

                   at org.apache.cxf.ws.security.wss4j.policyvalidators.AlgorithmSuitePolicyValidator.checkSignatureAlgorithms(AlgorithmSuitePolicyValidator.java:96)

                   at org.apache.cxf.ws.security.wss4j.policyvalidators.AlgorithmSuitePolicyValidator.validatePolicy(AlgorithmSuitePolicyValidator.java:57)

                   at org.apache.cxf.ws.security.wss4j.policyvalidators.AbstractBindingPolicyValidator.checkProperties(AbstractBindingPolicyValidator.java:172)

                   at org.apache.cxf.ws.security.wss4j.policyvalidators.AsymmetricBindingPolicyValidator.validatePolicy(AsymmetricBindingPolicyValidator.java:76)

                   at org.apache.cxf.ws.security.wss4j.PolicyBasedWSS4JInInterceptor.checkBindingCoverage(PolicyBasedWSS4JInInterceptor.java:581)

                   at org.apache.cxf.ws.security.wss4j.PolicyBasedWSS4JInInterceptor.doResults(PolicyBasedWSS4JInInterceptor.java:468)

                   at org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.handleMessage(WSS4JInInterceptor.java:265)

                   at org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.handleMessage(WSS4JInInterceptor.java:85)

                   at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)

                   at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:795)

                   at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1626)

                   at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1493)

                   at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1401)

                   at org.apache.cxf.io.CacheAndWriteOutputStream.postClose(CacheAndWriteOutputStream.java:47)

                   at org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:194)

                   at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)

                   at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:648)

                   at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)

                   at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)

                   at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:531)

                   at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:461)

                   at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:364)

                   at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:317)

                   at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:88)

                   at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:134)

               

              Since it's a NoSuchMethodMethodError this also strikes me as some sort of version mis-match issue?

               

              I'm running 4.4.1-03-06.

               

              Thanks for the help.

              • 4. Re: cxf saml client java.lang.ClassNotFoundException: org.joda.time.ReadableIns
                ffang

                Hi,

                 

                Please see my last comment in

                http://fusesource.com/forums/thread.jspa?threadID=3808

                 

                Freeman