Have you created a mapping file for your custom class? You need to provide
JiBX with a mapping file so it knows how to do the marshalling. In the
article, they've defined one for their classes in
InsuranceSMDZone/jibx/InsuranceMapping.xml

On Wed, Dec 16, 2009 at 1:43 PM, Kenneth H <[email protected]> wrote:

>
>
> janstey wrote:
> >
> > In JBI applications, each SU has its own classloader so I *think* if you
> > make sure that your custom classes are available on the Camel SU's
> > classpath
> > and the JMS SU's classpath all will be well.
> >
>
> You were right. After moving the relevant classes to the classpath
> directory, the exception is gone. However, it would be to easy if things
> just worked, so Servicmix throws a new exception. This time it's JiBX,
> annoying:
>
> 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 function that throws the exceptions is 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;
> }
>
> I don't know where the problems is. The exceptiopns doesn't give much
> information.
>
> Kind regards,
> Kenneth
> --
> View this message in context:
> http://old.nabble.com/Help-to-understand-xpath-expression-in-camel-routebuilder-tp26779963p26814820.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>


-- 
Cheers,
Jon

Camel in Action: http://manning.com/ibsen
Blog: http://janstey.blogspot.com

Reply via email to