Glad you got a bit farther.  The exception cites line 51, which line is that 
from your method?  I agree there doesn't look like much to go on from the 
exception.
Could you get the XML the method is seeing logged perhaps, or the value of the 
src parameter?  Maybe inspect the cause and message of the exception in catch 
block?




________________________________
From: Kenneth Henriksen <phecda...@gmail.com>
To: Maven Users List <users@maven.apache.org>
Sent: Wed, December 16, 2009 7:04:42 PM
Subject: Re: How to deploy JiBX Maven project from Ant specifications

Thank you for your answer John. I believe the TerrorMapping.xml is now
included.

I still get this error when deploying on ServiceMix though:

javax.jms.JMSException: Error sending JBI exchange
        at
org.apache.servicemix.jms.endpoints.AbstractConsumerEndpoint.onMessage(AbstractConsumerEndpoint.java:575)
        at
org.apache.servicemix.jms.endpoints.JmsConsumerEndpoint$1.onMessage(JmsConsumerEndpoint.java:505)
        at
org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:518)
        at
org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:479)
        at
org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:451)
        at
org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:323)
        at
org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:261)
        at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:982)
        at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:974)
        at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:876)
        at java.lang.Thread.run(Thread.java:619)
Caused by: org.jibx.runtime.JiBXException: Error marshalling XML to Object
        at terror.util.JiBXUtil.marshalDocument(JiBXUtil.java:51)
        at
terror.util.TerrorJMSMarshaler.populateMessage(TerrorJMSMarshaler.java:19)
        at
org.apache.servicemix.jms.endpoints.DefaultConsumerMarshaler.createExchange(DefaultConsumerMarshaler.java:99)
        at
org.apache.servicemix.jms.endpoints.AbstractConsumerEndpoint.onMessage(AbstractConsumerEndpoint.java:544)
        ... 10 more

The queue I'm sending the "TerrorTypeRequest1" object to is defined like
this:


       xmlns:fork="http://henriksenweb.com/FORK";>

    .....

  <jms:consumer service="fork:terrorReceiver"
       endpoint="jmsEndpoint"
       targetService="fork:terrorDSLRouter"
       destinationName="terror.in"
       connectionFactory="#connectionFactory"
       marshaler="#TerrorJMSMarshaler"/>

</beans>

The "JiBXUtil.marshalDocument" function is defined like this:

public static Source marshalDocument(Object src, String encoding) throws
JiBXException {
  Source result = null;
  try {
   ByteArrayOutputStream bOut = new ByteArrayOutputStream();
   IMarshallingContext ctx =
BindingDirectory.getFactory(src.getClass()).createMarshallingContext();
   ctx.marshalDocument(src, "UTF-8", null, bOut);
   result = new StreamSource(new ByteArrayInputStream(bOut.toByteArray()));
  }
  catch (Exception e) {
   throw new JiBXException("Error marshalling XML to Object",e);
  }
  return result;
}

The relevant part of the TerrorMapping.xml:

<mapping name="TerrorType1Request" class="terror.model.TerrorType1Request"
ns="http://henriksenweb.com/terror";>
   <namespace uri="http://henriksenweb.com/terror"; default="elements"/>
    <value name="buildYear" field="buildYear"/>
    <value name="carType" field="carType"/>
    <value name="companyCar" field="companyCar"/>
    <value name="numberPlate" field="numberPlate"/>
    <value name="requestID" field="requestID"/>
    <value name="startDate" field="startDate"
    serializer="terror.util.DateJiBXSerializer.serialize"
    deserializer="terror.util.DateJiBXSerializer.deserialize"/>
</mapping>

And finally the object I'm sending is an instance of the (simple) class
"TerrorType1Request":


import java.io.Serializable;
import java.util.Date;

public class TerrorType1Request implements Serializable {

private static final long serialVersionUID = -507216273438778375L;
private String requestID;
private String numberPlate;
private String carType;
private int buildYear;
private boolean companyCar;
private Date startDate;

public String getRequestID() {
  return requestID;
}
public void setRequestID(String requestID) {
  this.requestID = requestID;
}
public String getNumberPlate() {
  return numberPlate;
}
public void setNumberPlate(String numberPlate) {
  this.numberPlate = numberPlate;
}
public String getCarType() {
  return carType;
}
public void setCarType(String carType) {
  this.carType = carType;
}
public int getBuildYear() {
  return buildYear;
}
public void setBuildYear(int buildYear) {
  this.buildYear = buildYear;
}
public boolean isCompanyCar() {
  return companyCar;
}
public void setCompanyCar(boolean companyCar) {
  this.companyCar = companyCar;
}
public Date getStartDate() {
  return startDate;
}
public void setStartDate(Date startDate) {
  this.startDate = startDate;
}

}


So where does it go wrong? Could it be something about namespaces? I don't
think the exception is telling me much.

Kind regards,
Kenneth H



      

Reply via email to