I use camel 2.11.0 with JBoss 6.1 EAP, and I use this route:

    from("direct:bindySegTraMarshalling").marshal().bindy(BindyType.Fixed,
            SegmentoTra.class);

The SegmentoTra.class is annotated like this:

@FixedLengthRecord(length = 70, paddingChar = ' ', crlf="WINDOWS")
public class SegmentoTra {

  @DataField(pos = 1, length = 3)
  private String cabeceraSegmento = "TRA";

But I get this error:

13:47:35,095 ERROR [org.apache.camel.processor.DefaultErrorHandler] (Camel
(processesCamelContext) thread #3 - seda://afiQueue) Failed delivery for
(MessageId: ID-alfonso-mbp-2-local-62630-1397215413330-0-4 on ExchangeId:
ID-alfonso-mbp-2-local-62630-1397215413330-0-3). Exhausted after delivery
attempt: 1 caught: java.lang.NullPointerException:
java.lang.NullPointerException
        at
org.apache.camel.dataformat.bindy.util.ConverterUtils.*getByteReturn(ConverterUtils.java:41)
*[camel-bindy-2.11.0.jar:2.11.0]
        at
org.apache.camel.dataformat.bindy.fixed.BindyFixedLengthDataFormat.marshal(BindyFixedLengthDataFormat.java:78)
[camel-bindy-2.11.0.jar:2.11.0]
        at
org.apache.camel.processor.MarshalProcessor.process(MarshalProcessor.java:59)
[camel-core-2.11.0.jar:2.11.0]
...
...

The error shows up when I execute the route inside JBoss but outside
eclipse. But when I use JBoss Tools to add a new server pointing to my jboss
installation, and I deploy my solution by using Add/Remove on JBoss then
everything works like a charm.

I was debuging the code of bindy, and it looks like that it's not able to
load the class that is annotated... It doesn't get inside the "if (record !=
null)" of this method of the class BindyFixedLengthRecord:

    private void initFixedLengthRecordParameters() {

        for (Class<?> cl : models) {

            // Get annotation @FixedLengthRecord from the class
            FixedLengthRecord record =
cl.getAnnotation(FixedLengthRecord.class);

           * if (record != null) *{
                LOG.debug("Fixed length record: {}", record);

                // Get carriage return parameter
                crlf = record.crlf();
                LOG.debug("Carriage return defined for the CSV: {}", crlf);

                // Get hasHeader parameter
                hasHeader = record.hasHeader();
                LOG.debug("Has Header: {}", hasHeader);
                
                // Get skipHeader parameter
                skipHeader = record.skipHeader();







--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-bindy-FixedLengthRecord-crlf-attribute-causes-null-pointer-tp5750120.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to