3 Replies Latest reply on Dec 13, 2012 7:44 AM by Gareth Healy

    XStream CannotResolveClassException after stop/starting route

    Gareth Healy Newbie

      I have a route which reads JSON of activemq and updates an external service. As the external service can be down for planned maintenance i'd like to stop the route in the ESB (i.e: camel:route-stop myRoute) for a period, and then start it back up (i.e: camel:route-start myRoute). Once its started back up, i'd expect it to read of the queue and carry on as normal.

       

      However, when i stop/start my route; i get the below exception.

       

      17:44:56,114 | ERROR | xternalServices] | DefaultErrorHandler              | 137 - org.apache.camel.camel-core - 2.9.0.fuse-70-097 | Failed delivery for (MessageId: ID:BHWKS157-24253-1355333692630-2:29:1:1:1 on ExchangeId: ID-BHWKS157-24207-1355333676816-2-28). Exhausted after delivery attempt: 1 caught: com.thoughtworks.xstream.mapper.CannotResolveClassException: com.boohoo.esb.commerce.modules.inventory.messages.InventoryChangedRequest : com.boohoo.esb.commerce.modules.inventory.messages.InventoryChangedRequest not found by org.apache.karaf.shell.shell

      com.thoughtworks.xstream.mapper.CannotResolveClassException: com.boohoo.esb.commerce.modules.inventory.messages.InventoryChangedRequest : com.boohoo.esb.commerce.modules.inventory.messages.InventoryChangedRequest not found by org.apache.karaf.shell.shell

           at com.thoughtworks.xstream.mapper.DefaultMapper.realClass(DefaultMapper.java:62)

           at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)

           at com.thoughtworks.xstream.mapper.CGLIBMapper.realClass(CGLIBMapper.java:50)

           at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)

           at com.thoughtworks.xstream.mapper.DynamicProxyMapper.realClass(DynamicProxyMapper.java:71)

           at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)

           at com.thoughtworks.xstream.mapper.ClassAliasingMapper.realClass(ClassAliasingMapper.java:86)

           at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)

           at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)

           at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)

           at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)

           at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)

           at com.thoughtworks.xstream.mapper.ArrayMapper.realClass(ArrayMapper.java:87)

           at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)

           at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)

           at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)

           at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)

           at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)

           at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:38)

           at com.thoughtworks.xstream.mapper.CachingMapper.realClass(CachingMapper.java:52)

           at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:138)

           at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:33)

           at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:931)

           at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:917)

           at com.thoughtworks.xstream.XStream.fromXML(XStream.java:861)

           at com.thoughtworks.xstream.XStream.fromXML(XStream.java:853)

           at com.boohoo.esb.common.helpers.JsonHelper.marshallFromJson(JsonHelper.java:39)

           at com.boohoo.esb.frontend.routers.common.BaseSystem.convetBody(BaseSystem.java:80)

           at com.boohoo.esb.stock.frontends.systems.Venda.sendToFrontend(Venda.java:36)

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

           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)[:1.6.0_29]

           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[:1.6.0_29]

           at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_29]

           at org.apache.camel.component.bean.MethodInfo.invoke(MethodInfo.java:340)[137:org.apache.camel.camel-core:2.9.0.fuse-70-097]

           at org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:237)[137:org.apache.camel.camel-core:2.9.0.fuse-70-097]

           at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:166)[137:org.apache.camel.camel-core:2.9.0.fuse-70-097]

           at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[137:org.apache.camel.camel-core:2.9.0.fuse-70-097]

           at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[137:org.apache.camel.camel-core:2.9.0.fuse-70-097]

           at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[137:org.apache.camel.camel-core:2.9.0.fuse-70-097]

           at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:71)[137:org.apache.camel.camel-core:2.9.0.fuse-70-097]

           at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[137:org.apache.camel.camel-core:2.9.0.fuse-70-097]

           at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[137:org.apache.camel.camel-core:2.9.0.fuse-70-097]

           at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[137:org.apache.camel.camel-core:2.9.0.fuse-70-097]

           at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:91)[137:org.apache.camel.camel-core:2.9.0.fuse-70-097]

           at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[137:org.apache.camel.camel-core:2.9.0.fuse-70-097]

           at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[137:org.apache.camel.camel-core:2.9.0.fuse-70-097]

           at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[137:org.apache.camel.camel-core:2.9.0.fuse-70-097]

           at org.apache.camel.fabric.FabricTraceProcessor.process(FabricTraceProcessor.java:81)[137:org.apache.camel.camel-core:2.9.0.fuse-70-097]

           at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[137:org.apache.camel.camel-core:2.9.0.fuse-70-097]

           at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:330)[137:org.apache.camel.camel-core:2.9.0.fuse-70-097]

           at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:220)[137:org.apache.camel.camel-core:2.9.0.fuse-70-097]

           at org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)[137:org.apache.camel.camel-core:2.9.0.fuse-70-097]

           at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[137:org.apache.camel.camel-core:2.9.0.fuse-70-097]

           at org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:304)[137:org.apache.camel.camel-core:2.9.0.fuse-70-097]

           at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[137:org.apache.camel.camel-core:2.9.0.fuse-70-097]

           at org.apache.camel.processor.Pipeline.process(Pipeline.java:117)[137:org.apache.camel.camel-core:2.9.0.fuse-70-097]

           at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)[137:org.apache.camel.camel-core:2.9.0.fuse-70-097]

           at org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)[137:org.apache.camel.camel-core:2.9.0.fuse-70-097]

           at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[137:org.apache.camel.camel-core:2.9.0.fuse-70-097]

           at org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)[137:org.apache.camel.camel-core:2.9.0.fuse-70-097]

           at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[137:org.apache.camel.camel-core:2.9.0.fuse-70-097]

           at org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:150)[137:org.apache.camel.camel-core:2.9.0.fuse-70-097]

           at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:117)[137:org.apache.camel.camel-core:2.9.0.fuse-70-097]

           at org.apache.camel.processor.RouteInflightRepositoryProcessor.processNext(RouteInflightRepositoryProcessor.java:50)[137:org.apache.camel.camel-core:2.9.0.fuse-70-097]

           at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[137:org.apache.camel.camel-core:2.9.0.fuse-70-097]

           at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[137:org.apache.camel.camel-core:2.9.0.fuse-70-097]

           at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[137:org.apache.camel.camel-core:2.9.0.fuse-70-097]

           at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[137:org.apache.camel.camel-core:2.9.0.fuse-70-097]

           at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:71)[137:org.apache.camel.camel-core:2.9.0.fuse-70-097]

           at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)[137:org.apache.camel.camel-core:2.9.0.fuse-70-097]

           at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:86)[137:org.apache.camel.camel-core:2.9.0.fuse-70-097]

           at org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:104)[144:org.apache.camel.camel-jms:2.9.0.fuse-70-097]

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

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

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

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

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

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

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

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

           at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)[:1.6.0_29]

           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)[:1.6.0_29]

           at java.lang.Thread.run(Thread.java:662)[:1.6.0_29]

       

      I have to shutdown the ESB and start it backup for the exception to go away. I presume its something to do with classloaders, but unsure how to fix.

       

      The JSON is as follows:

       

      {"inventoryChangedRequest": {

        "inventory": {

          "sku": "azz8243416516",

          "quantity": 0

        }

      }}

       

      And the code i use to convert it to an object is:

       

      public static   type, String json) {

          XStream xStream = new XStream(new JettisonMappedXmlDriver());

          xStream.setMode(XStream.NO_REFERENCES);

          xStream.processAnnotations(type);

          Object jsonAsObject = xStream.fromXML(json);

           

          return type.isInstance(jsonAsObject) ? type.cast(jsonAsObject) : null;

      }

       

      Any help is appreciated.

       

      Edited by: garethahealy on Dec 12, 2012 6:24 PM

        • 1. Re: XStream CannotResolveClassException after stop/starting route
          Claus Ibsen Master

          Hi

           

          Thanks for reporting.

          I have logged a ticket to not forget about this issue

          http://fusesource.com/issues/browse/MR-679

           

          Can you check in your xstream coverter code, if there is any way to pass in a class loader instance to it? Maybe using some parameter etc?

           

          And can you take a look at your application bundle (eg the bundle with this route you restart) what the OSGi MANIFEST.MF entries are for import|export ? And if you have any dynamic imports enabled or not?

          • 2. Re: XStream CannotResolveClassException after stop/starting route
            Gareth Healy Newbie

            Claus,

             

            No, i dont use any dynamic imports.

             

            The IMPORTS:

            Import-Package: com.boohoo.esb.commerce.modules.inventory.entities;version="[1.0,2)",

            com.boohoo.esb.commerce.modules.inventory.messages;version="[1.0,2)",

            com.boohoo.esb.common.helpers;version="[1.0,2)",javax.jms,org.apache.activemq.camel.component,org.apache.camel;version="[2.9,3)",

            org.apache.camel.builder;version="[2.9,3)",org.apache.camel.component.jms;version="[2.9,3)",org.apache.camel.model;version="[2.9,3)"

            ,org.osgi.service.blueprint;version="[1.0.0,2.0.0)"

             

            The EXPORTS:

            Export-Package:

            com.boohoo.esb.stock.frontends.routes;uses:="org.apache.camel.builder,org.apache.camel.model";version="1.0.0.SNAPSHOT",

            com.boohoo.esb.stock.frontends.systems;uses:="org.apache.camel,com.boohooesb.commerce.modules.inventory.entities,com.boohoo.esb.common.helpers,com.boohoo.esb.commerce.modules.inventory.messages";version="1.0.0.SNAPSHOT"

             

            I cant see anything wrong with the above, looks quite standard...

             

            The converter code can be changed to anything, as its currently the only place i use it.

             

            I've created a sample project which has the same setup as mine @[here|http://bit.ly/UFhQSo]

             

            I've included a features file so you can just do:

             

            features:addurl mvn:com.boohoo/example-boohoo-esb-features/1.0-SNAPSHOT/xml/features

            features:install boohoo-esb-all

             

            The route to stop/start is: stockUpdateFor_VendaUAT

             

            Hope this helps.

             

            Edited by: garethahealy on Dec 13, 2012 10:12 AM

            • 3. Re: XStream CannotResolveClassException after stop/starting route
              Gareth Healy Newbie

              I've fixed my issue by changing the code to use the camel data formats instead.

               

              ();

                          aliases.put("inventoryChangedRequest", InventoryChangedRequest.class.getName());

                           

                          XStreamDataFormat jsonUnmarshalInventoryChangedRequest = new XStreamDataFormat("UTF-8");

                          jsonUnmarshalInventoryChangedRequest.setDriverRef("jsonUnmarshalDriver");

                          jsonUnmarshalInventoryChangedRequest.setAliases(aliases);

               

              route.from("activemq:Consumer.VendaUAT.VirtualTopic.sendStockToExternalServices")

                                      .unmarshal(jsonUnmarshalInventoryChangedRequest)