4 Replies Latest reply on Mar 24, 2011 9:30 AM by Matt Felstead

    DDS endpoint to email issue

    Matt Felstead Newbie

      Morning Team


      I'm having an issue converting a message received on a DDS endpoint to an email (using the Apache Velocity as a template) via smtp; i.e. the route is as follows:






      Removing the velocity line, above, will allow the email to be sent; however, the content of the email is then the object type that was received at the ddsEndpoint. I obviously wish to extract elements from this object to populate an email in the velocity template.


      With the velocity line included, no email is sent - and no messages are logged. However, when terminating the application (via cntrl c), the following exception is displayed:


      Exception in thread "Thread-12" java.lang.NoClassDefFoundError: org/apache/camel


              at org.apache.camel.component.dds.DdsExchange.createExchangeId(DdsExchan


              at org.apache.camel.component.dds.DdsExchange.getExchangeId(DdsExchange.


              at org.apache.camel.processor.Pipeline.createNextExchange(Pipeline.java:


              at org.apache.camel.processor.Pipeline.process(Pipeline.java:71)

              at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProc


              at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelp


              at org.apache.camel.processor.DelegateAsyncProcessor.processNext(Delegat


              at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsy


              at org.apache.camel.management.InstrumentationProcessor.process(Instrume


              at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelp


              at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsy


              at org.apache.camel.component.dds.DdsConsumer.createExchange(DdsConsumer


              at org.apache.camel.component.dds.DdsConsumer.on_data_available(DdsConsu


      Caused by: java.lang.ClassNotFoundException: org.apache.camel.util.UuidGenerator


              at java.net.URLClassLoader$1.run(URLClassLoader.java:202)

              at java.security.AccessController.doPrivileged(Native Method)

              at java.net.URLClassLoader.findClass(URLClassLoader.java:190)

              at java.lang.ClassLoader.loadClass(ClassLoader.java:307)

              at java.lang.ClassLoader.loadClass(ClassLoader.java:248)


      Presumably there is a problem with the class type of the object received at the ddsEndpoint? Any ideas how I can get around this?


      Many thanks



        • 1. Re: DDS endpoint to email issue
          Willem Jiang Master

          First which version of camel are you using?

          Can you enable trace[1] to see if the exchange is delivered to the endpoint rightly?


          UuidGenerator should be in camel-core jar, I'm not sure if your DDS endpoint do some work to change the class loader which could introduce this kind of issue.





          • 2. Re: DDS endpoint to email issue
            Matt Felstead Newbie

            Morning Willem


            Many thanks for your reply. I'm using version 2.5.0-fuse-00-00.


            Enabling the trace option yields the following:


            24-Mar-2011 08:48:41 org.apache.camel.processor.Logger process

            INFO: ID:csimp-client-4957-1300956504734-3:1:1:1:1 >>> (route5) gduk.irad.DDSMes

            sage@19bf996 --> dds://SimpleMessage_SensorStatus:0/SimpleMessage.SensorStatus?P

            artition=SimpleMessageSpace&ReliabilityKind=RELIABLE <<< Pattern:InOnly, Headers

            :{JMSDeliveryMode=2, CamelFileNameOnly=message1.xml, CamelFileParent=target\plac

            eorder, JMSExpiration=0, JMSXGroupID=null, CamelFileAbsolute=false, CamelFileLen

            gth=78, JMSType=null, JMSTimestamp=1300956520265, CamelFileAbsolutePath=C:\MF\SW

            \Fuse\PSIM\DDSAlarmRouter-Java\target\placeorder\message1.xml, CamelBeanMethodNa

            me=null, CamelFileRelativePath=message1.xml, JMSCorrelationID=null, JMSXGroupSeq

            =0, JMSRedelivered=false, CamelFileName=message1.xml, JMSXDeliveryCount=1, JMSMe

            ssageID=ID:csimp-client-4957-1300956504734-3:1:1:1:1, JMSReplyTo=null, CamelFile

            LastModified=Wed Mar 23 10:45:22 GMT 2011, CamelFilePath=target\placeorder\messa

            ge1.xml, JMSPriority=4, JMSDestination=queue://incomingOrderQueue}, BodyType:Sim

            pleMessage.SensorStatus, Body:SimpleMessage.SensorStatus@9e4dc0


            To provide a slightly better picture of the routing, the full route is as follows:







                       .when().method("helper", "isXml")


                         .bean(gduk.irad.DDSMessage.class, "ConvertXML")




                         .bean(gduk.irad.DDSConverter.class, "ConvertDDSToCameraStatus")




            note, I updated the last route to include another bean converter. The Trace log above relates to the ".bean(gduk.irad.DDSMessage.class, "ConvertXML").to(ddsPublisher);" section.


            There is no further Trace routing for the last part - i.e. from(ddsPublisher) - which was my original problem. When I terminate the application with cntrl c I get the same exception as before.





            • 3. Re: DDS endpoint to email issue
              Matt Felstead Newbie

              I tried updating the application to use a "processor" instead of a bean, I still get the same issue. The code is as follows:



                .process(new Processor()


                   public void process(Exchange e)


                   System.out.println("Received exchange: " + e);

                   DdsMessage message = (DdsMessage) e.getIn();

                   System.out.println("Message: " + message);

                   SimpleMessage.SensorStatus msg = (SimpleMessage.SensorStatus) e.getIn().getBody();

                   CameraStatus tmp = new CameraStatus (String.valueOf(msg.sensorID), String.valueOf(msg.alarm));

                   System.out.println("Sending direct mail");







                    .process(new Processor(){

                        public void process(Exchange e){

                           System.out.println("direct mail rec'd");

                           CameraStatus tmp = (CameraStatus)e.getIn().getBody();





              The last line displayed is "Sending direct mail". i.e. it seems to get "stuck" when updating the exchange. Again, terminating with ctrl c provides the same exception as before.


              The route is stimulated by sending a SimpleMessage.SensorStatus type object via a ProducerTemplate to the ddsPublisher uri.





              • 4. Re: DDS endpoint to email issue
                Matt Felstead Newbie

                The error appears to be a version issue. The OpenSplice camel-dds Connector is currently at version 0.2a - which uses version 2.4.0 of Apache Camel; i.e. 2.4.0-fuse-00-00. Using this version works!