0 Replies Latest reply on Jul 24, 2007 5:30 AM by Govinda Attal

    XStreamToObject --- Content not allowd in prolog

    Govinda Attal Newbie

      Hello,


      I have written an ESB service with FTPListener which polls for a XML file.
      In the Action processing pipeline I wish to convert XML stream to an object.

      For that I used 'org.jboss.soa.esb.actions.converters.XStreamToObject'

      jboss-esb.xml looks like

      ...
      ...
       <actions>
       <action name="print-before-routing"
       class="org.jboss.soa.esb.actions.SystemPrintln">
       <property name="message"
       value="[XML To Object Service] Before invoking Router" />
       </action>
      
       <action name="transform" class="org.jboss.soa.esb.actions.converters.XStreamToObject">
       <property name="class-alias" value="employee" />
      
       <property name="incoming-type" value="org.Employee" />
       </action>
      
      
       </actions>
      ...
      ...
      




      class org.Employee is as follows
      
      public class Employee
      {
       private String name;
       private String contactNo;
       private String address;
       private String employeeID;
       // Getters and setters ...
      }
      
      


      and contents of the xml file being polled is -
      
      <employee>
       <employeeID>40082</employeeID>
       <name>Govinda Attal</name>
       <contactNo>+9100000000</contactNo>
       <address>Mumbai</address>
      </employee>
      
      



      When I run this case, what I see on console is

      14:39:30,560 INFO [STDOUT] [XML To Object Service] Before invoking Router:
      14:39:30,560 INFO [STDOUT] [<employee>
       <employeeID>40082</employeeID>
       <name>Govinda Attal</name>
       <contactNo>>+9100000000</contactNo>
       <address>Mumbai</address>
      </employee>
      ].
      14:39:30,748 ERROR [STDERR] [Fatal Error] :1:1: Content is not allowed in prolog.
      14:39:30,748 WARN [ActionProcessingPipeline] Unexpected exception caught while processing the action pipeline
      com.thoughtworks.xstream.io.StreamException: : Content is not allowed in prolog.
       at com.thoughtworks.xstream.io.xml.DomDriver.createReader(DomDriver.java:47)
       at com.thoughtworks.xstream.io.xml.DomDriver.createReader(DomDriver.java:29)
       at com.thoughtworks.xstream.XStream.fromXML(XStream.java:515)
       at com.thoughtworks.xstream.XStream.fromXML(XStream.java:506)
       at org.jboss.soa.esb.actions.converters.XStreamToObject.process(XStreamToObject.java:90)
       at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.process(ActionProcessingPipeline.java:253)
       at org.jboss.soa.esb.listeners.message.MessageAwareListener$1.run(MessageAwareListener.java:301)
       at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
       at java.lang.Thread.run(Thread.java:595)
      Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog.
       at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
       at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
       at com.thoughtworks.xstream.io.xml.DomDriver.createReader(DomDriver.java:40)
       ... 9 more
      14:39:30,779 ERROR [ActionProcessingPipeline] Failed to send error to address null.
      org.jboss.soa.esb.couriers.CourierException: No deliverAsync courier
       at org.jboss.internal.soa.esb.couriers.TwoWayCourierImpl.deliver(TwoWayCourierImpl.java:166)
       at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.faultTo(ActionProcessingPipeline.java:436)
       at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.process(ActionProcessingPipeline.java:287)
       at org.jboss.soa.esb.listeners.message.MessageAwareListener$1.run(MessageAwareListener.java:301)
       at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
       at java.lang.Thread.run(Thread.java:595)
      


      Just to get hand of XStream apis I used them in a standalone java application to convert from XML to object. The apis work fine.



      I am not able to figure it out, what necesssary configuration I have missed out...
      Please help.

      Infrastructure used:
      JBOSS 4.0.5 with EJB3 Patch RC9 Patch1
      JBOSS ESB 4.2MR2

      [Off the track, I read you have added nested objects support in XStreamToObject using aliases property in ESB MR3]

      Thanks & Regards,
      Govinda