camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alfmateos <alf.mat...@gmail.com>
Subject Re: camel bindy - @FixedLengthRecord: crlf attribute causes null pointer
Date Mon, 14 Apr 2014 09:44:58 GMT
Hi Claus, thanks a lot for your help. Unfortunately, it didn't work... My
JBoss version is JBoss EAP 6.1.0.GA (AS 7.2.0.Final-redhat-8), can this be
the reason why it doesn't work with camel-jboss6?

What I did in order to try to make it work was:

1.- Add this dependency:

            <!--  Camel JBoss, required for bindy + Jboss -->
            <dependency>
                <groupId>org.apache-extras.camel-extra</groupId>
                <artifactId>camel-jboss6</artifactId>
                <version>2.11.0</version>
            </dependency>

I use camel 2.11.0, don't know if I should use a newer one to get
camel-jboss6 working with JBoss AS 7.2.0.Final...

2.- Add this resolver to my bean's xml file. Should I reference this
jbossResolver later on? If so, how?

    <!--  Camel-Jboss -->
    <bean id="jbossResolver"
class="org.apacheextras.camel.jboss.JBossPackageScanClassResolver"/>

3.- In order to invoke bindy marshalling, I tried both of these ways, with
no success:

    from("direct:bindySegTraMarshalling").marshal().bindy(BindyType.Fixed,
        "es.gc.epsilon.core.camel.thirdparties.spain.tgss.bindy");

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

Is it that I missed something on step #1?
Thanks in advance...

PS: I also saw this article about camel and classloading on Jboss as 7,
don't know if you think this can help to get my bindy marsalling working...
Thanks again.

Alfonso.



2014-04-11 15:29 GMT+02:00 Claus Ibsen-2 [via Camel] <
ml-node+s465427n5750128h67@n5.nabble.com>:

> Hi
>
> You may still need to use camel-jboss to have the package scanning
> work in the EAP container.
> https://camel.apache.org/camel-jboss.html
>
> Ideally in the future we migrate camel-bindy so it does no longer do
> package scanning so you would need to configure the .class up front.
> But then it works for everybody.
>
> eg part of the work is that you specify the class which you do
>
>   from("direct:bindySegTraMarshalling").marshal().bindy(BindyType.Fixed,
>             SegmentoTra.class);
>
> But there is still some logic in bindy that relies on the package
> scanning.
>
>
>
>
> On Fri, Apr 11, 2014 at 1:59 PM, alfmateos <[hidden email]<http://user/SendEmail.jtp?type=node&node=5750128&i=0>>
> wrote:
>
> >
> >
> > 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.
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> Email: [hidden email]<http://user/SendEmail.jtp?type=node&node=5750128&i=1>
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
> hawtio: http://hawt.io/
> fabric8: http://fabric8.io/
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://camel.465427.n5.nabble.com/camel-bindy-FixedLengthRecord-crlf-attribute-causes-null-pointer-tp5750120p5750128.html
>  To unsubscribe from camel bindy - @FixedLengthRecord: crlf attribute
> causes null pointer, click here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5750120&code=YWxmLm1hdGVvc0BnbWFpbC5jb218NTc1MDEyMHwtMTAzNzU0OTU1Mw==>
> .
> NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://camel.465427.n5.nabble.com/camel-bindy-FixedLengthRecord-crlf-attribute-causes-null-pointer-tp5750120p5750184.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message