4 Replies Latest reply on Jul 5, 2011 12:08 PM by ariekenb

    SerializedXMLGregorianCalendar class not found

    maxpicoz

      Hi there,

       

      I'm upgrading to FUSE 4.4.0 and I got the following error when camel try parse the message payload from a JMS queue:

       

      org.apache.camel.RuntimeCamelException: Failed to extract body due to: javax.jms.JMSException: Failed to build body from content. Serializable class not available to broker. Reason: java.lang.ClassNotFoundException: org.apache.xerces.jaxp.datatype.SerializedXMLGregorianCalendar not found by org.apache.servicemix.bundles.xerces . Message: ....

       

      The message was initially loaded from an external web service and pushed into the JMS queue. Both producer and consumer of the JMS message queue are camel routes.

       

      The first camel route periodically polls an external web service to gather some information. The retrieved object, that contains an dateTime XML element, becomes the payload of the JMS Message.

       

      The second camel route just listens to the JMS queue and processes them.

      Here's the full stack trace:

       

              at org.apache.camel.component.jms.JmsBinding.extractBodyFromJms(JmsBinding.java:160)[91:org.apache.camel.camel-jms:2.7.1.fuse-00-27]

              at org.apache.camel.component.jms.JmsMessage.createBody(JmsMessage.java:204)[91:org.apache.camel.camel-jms:2.7.1.fuse-00-27]

              at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:41)[76:org.apache.camel.camel-core:2.7.1.fuse-00-27]

              at org.apache.camel.impl.DefaultUnitOfWork.(DefaultUnitOfWork.java:82)[76:org.apache.camel.camel-core:2.7.1.fuse-00-27]

              at org.apache.camel.processor.UnitOfWorkProcessor.createUnitOfWork(UnitOfWorkProcessor.java:147)[76:org.apache.camel.camel-core:2.7.1.fuse-00-27]

              at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:90)[76:org.apache.camel.camel-core:2.7.1.fuse-00-27]

              at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:80)[76:org.apache.camel.camel-core:2.7.1.fuse-00-27]

              at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[76:org.apache.camel.camel-core:2.7.1.fuse-00-27]

              at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[76:org.apache.camel.camel-core:2.7.1.fuse-00-27]

              at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)[76:org.apache.camel.camel-core:2.7.1.fuse-00-27]

              at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:106)[76:org.apache.camel.camel-core:2.7.1.fuse-00-27]

              at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:85)[76:org.apache.camel.camel-core:2.7.1.fuse-00-27]

              at org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:93)[91:org.apache.camel.camel-jms:2.7.1.fuse-00-27]

              at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:560)[92:org.springframework.jms:3.0.5.RELEASE]

              at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:498)[92:org.springframework.jms:3.0.5.RELEASE]

              at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:467)[92:org.springframework.jms:3.0.5.RELEASE]

              at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:325)[92:org.springframework.jms:3.0.5.RELEASE]

              at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:263)[92:org.springframework.jms:3.0.5.RELEASE]

              at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1058)[92:org.springframework.jms:3.0.5.RELEASE]

              at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1050)[92:org.springframework.jms:3.0.5.RELEASE]

               at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:947)[92:org.springframework.jms:3.0.5.RELEASE]

              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)[:1.6.0_20]

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)[:1.6.0_20]

              at java.lang.Thread.run(Thread.java:636)[:1.6.0_20]

      Caused by: javax.jms.JMSException: Failed to build body from content. Serializable class not available to broker. Reason: java.lang.ClassNotFoundException: org.apache.xerces.jaxp.datatype.SerializedXMLGregorianCalendar not found by org.apache.servicemix.bundles.xerces

              at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:35)[50:org.apache.activemq.activemq-core:5.5.0.fuse-00-27]

              at org.apache.activemq.command.ActiveMQObjectMessage.getObject(ActiveMQObjectMessage.java:186)[50:org.apache.activemq.activemq-core:5.5.0.fuse-00-27]

              at org.apache.camel.component.jms.JmsBinding.extractBodyFromJms(JmsBinding.java:127)[91:org.apache.camel.camel-jms:2.7.1.fuse-00-27]

              ... 23 more

      Caused by: java.lang.ClassNotFoundException: org.apache.xerces.jaxp.datatype.SerializedXMLGregorianCalendar not found by org.apache.servicemix.bundles.xerces

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

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

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

              at java.lang.ClassLoader.loadClass(ClassLoader.java:266)[:1.6.0_20]

              at org.apache.felix.framework.ModuleImpl.getClassByDelegation(ModuleImpl.java:670)

              at org.apache.felix.framework.resolver.WireImpl.getClass(WireImpl.java:102)

              at org.apache.felix.framework.ModuleImpl.searchDynamicImports(ModuleImpl.java:1462)

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

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

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

              at java.lang.ClassLoader.loadClass(ClassLoader.java:266)[:1.6.0_20]

              at java.lang.Class.forName0(Native Method)[:1.6.0_20]

              at java.lang.Class.forName(Class.java:264)[:1.6.0_20]

              at org.apache.activemq.util.ClassLoadingAwareObjectInputStream.load(ClassLoadingAwareObjectInputStream.java:63)

              at org.apache.activemq.util.ClassLoadingAwareObjectInputStream.resolveClass(ClassLoadingAwareObjectInputStream.java:37)

              at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1592)[:1.6.0_20]

              at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1513)[:1.6.0_20]

              at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1749)[:1.6.0_20]

              at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1346)[:1.6.0_20]

              at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1963)[:1.6.0_20]

              at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1887)[:1.6.0_20]

              at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1770)[:1.6.0_20]

              at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1346)[:1.6.0_20]

              at java.io.ObjectInputStream.readObject(ObjectInputStream.java:368)[:1.6.0_20]

              at java.util.ArrayList.readObject(ArrayList.java:696)[:1.6.0_20]

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.6.0_20]

              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)[:1.6.0_20]

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.6.0_20]

              at java.lang.reflect.Method.invoke(Method.java:616)[:1.6.0_20]

              at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:991)[:1.6.0_20]

              at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1865)[:1.6.0_20]

              at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1770)[:1.6.0_20]

              at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1346)[:1.6.0_20]

              at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1963)[:1.6.0_20]

              at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1887)[:1.6.0_20]

              at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1770)[:1.6.0_20]

              at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1346)[:1.6.0_20]

              at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1684)[:1.6.0_20]

              at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1340)[:1.6.0_20]

              at java.io.ObjectInputStream.readObject(ObjectInputStream.java:368)[:1.6.0_20]

              at org.apache.activemq.command.ActiveMQObjectMessage.getObject(ActiveMQObjectMessage.java:184)[50:org.apache.activemq.activemq-core:5.5.0.fuse-00-27]

              ... 24 more

        • 1. Re: SerializedXMLGregorianCalendar class not found
          ffang

          Hi,

           

          org.apache.xerces.jaxp.datatype.SerializedXMLGregorianCalendar isn't in the org.apache.servicemix.bundles.xerces(2.9.1) bundle,  it come from later xerces-impl jar.

           

          I guess you have two bundles, each for one camel router(jms consumer and provider), is it correct? Somehow your jms provider use new xerces-impl and jms consumer still use old version which cause this error when do deserialization.

           

          I can't tell so much now without more details from your side, could you please post the result of

          osgi:headers your_camel_router_bundle_id

          and

          packages:imports your_camel_router_bundle_id

          ?

           

          Moreover, if you can attach your bundle project which I can build and deploy, it would be much more helpful.

           

          Freeman

           

          Edited by: ffang on Jun 25, 2011 6:26 AM

          • 2. Re: SerializedXMLGregorianCalendar class not found
            ariekenb

            I ran into this same problem on FUSE ESB 4.4.0-fuse-00-39.

             

            I am attaching an example maven project (xerces-test.zip) that builds a bundle that shows the problem with the default FUSE ESB configuration.  This project generates a small serializable object (TestSchemaElement) using JAXB that contains an XMLGregorianCalendar field.  It creates 2 spring beans: Producer which sends a serialized TestSchemaElement every second to an activemq queue using Camel, and Consumer which consumes the serialized TestSchemaElement using Camel.

             

            If I deploy this bundle into the default configuration of FUSE ESB 4.4.0-fuse-00-39 I get the same exception as the original post (Serializable class not available to

            broker. Reason: java.lang.ClassNotFoundException: org.apache.xerces.jaxp.datatype.SerializedXMLGregorianCalendar not found by org.apache.servicemix.bundles.xerces).

             

            By default, I see from osgi:list that xercesImpl 2.9.1.3 is installed in FUSE ESB.  xerces 2.9.1.3 contains the org.apache.xerces.jaxp.datatype package, but does not contain the org.apache.xerces.jaxp.datatype.SerializedXMLGregorianCalendar class.

             

            I also see that an xercesImpl 2.11.0 is installed in lib/endorsed.  This version of xercesImpl does contain the org.apache.xerces.jaxp.datatype.SerializedXMLGregorianCalendar class.

             

            Confusingly there is also a third version of xercesImpl (2.9.1.4) in the system directory.  I don't ever see this get loaded into the container though.

             

            I have found that doing the following avoids the ClassNotFoundException:

             

            1. Set resolveOptionalImports = false in etc/org.apache.karaf.features.obr.cfg.  This prevents xercesImpl 2.9.1.3 from being loaded in the container.

            2. Copy lib/endorsed/xercesImpl-2.11.0.jar to deploy.  This causes xercesImpl 2.11.0 to be deployed into the container.

             

            It seems xercesImpl is a bit of a mess in the FUSE ESB 4.4 releases - version 2.11.0 is in the endorsed directory, and 2 different versions of 2.9.1 are in the system directory.  Can this be simplified so only 1 version of xercesImpl is needed?

            • 3. Re: SerializedXMLGregorianCalendar class not found
              ffang

              Hi,

               

              This is a known issue and already get fixed, it can be picked up by next release.

              We need export xerces and xalan package from system bundle as we endorse it now, and this also can prevent other xerces and xalan bundles get installed.

              I just attach a custom.properties which you need copy to $FUSE_ESB/etc folder to override the old one. You may need remove $FUSE_ESB/data folder before you restart the FUSE ESB.

               

              Freeman

              • 4. Re: SerializedXMLGregorianCalendar class not found
                ariekenb

                Freeman -

                 

                Thanks.  That version of custom.properties does seem to fix the problem.

                 

                Is there a bug open for this issue?  Do you know when a new version of FUSE ESB will be released that will have this fix?

                 

                Thanks,

                Aaron