camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Nullpointer exception while mapping via dozer
Date Sat, 25 Jun 2016 07:16:39 GMT
Hi

What version of Camel do you use?

And are you sure the targetModel=PaymentTransaction is the fully
qualified class name, eg it should be something like
com.foo.mycompany.PaymentTransaction



On Tue, Jun 14, 2016 at 7:22 PM, r_karthik1 <reachkarthikr@gmail.com> wrote:
> I am new to camle, I am reading the message from the IBM queue and
> implementing camel dozer but getting null pointer exception. Appreciate
> yourhelp
>
> I have the following endpoint,
>
>   from(DOMAIN_MAPPING)
>                .routeId("domainMappingLogger")
>                .to("dozer:transformOrder"
>
> +"?mappingFile=PartnerTransaferToTransactionMapping.xml"
>                        +"&targetModel=PaymentTransaction")
>                .to(JSON_MARSHALLER);
>
> Placed the dozer configuration,
> package com.mastercard.personalpayments.send.core.orchestration.camel.dozer;
>
> import org.apache.camel.converter.dozer.DozerBeanMapperConfiguration;
> import org.apache.camel.spi.Metadata;
> import org.apache.camel.spi.UriParam;
> import org.apache.camel.spi.UriParams;
> import org.apache.camel.spi.UriPath;
>
> import static org.dozer.util.DozerConstants.DEFAULT_MAPPING_FILE;
>
> /**
>  * Configuration used for a Dozer endpoint.
>  */
> @UriParams
> public class DozerConfiguration {
>
>     @UriPath @Metadata(required = "true")
>     private String name;
>     @UriParam
>     private String marshalId;
>     @UriParam
>     private String unmarshalId;
>     @UriParam
>     private String sourceModel;
>     @UriParam @Metadata(required = "true")
>     private String targetModel;
>     @UriParam(defaultValue = DEFAULT_MAPPING_FILE)
>     private String mappingFile;
>     @UriParam
>     private DozerBeanMapperConfiguration mappingConfiguration;
>
>     public DozerConfiguration() {
>         setMappingFile(DEFAULT_MAPPING_FILE);
>     }
>
>     public String getMarshalId() {
>         return marshalId;
>     }
>
>     /**
>      * The id of a dataFormat defined within the Camel Context to use for
> marshalling the mapping output to a non-Java type.
>      */
>     public void setMarshalId(String marshalId) {
>         this.marshalId = marshalId;
>     }
>
>     public String getUnmarshalId() {
>         return unmarshalId;
>     }
>
>     /**
>      * The id of a dataFormat defined within the Camel Context to use for
> unmarshalling the mapping input from a non-Java type.
>      */
>     public void setUnmarshalId(String unmarshalId) {
>         this.unmarshalId = unmarshalId;
>     }
>
>     public String getSourceModel() {
>         return sourceModel;
>     }
>
>     /**
>      * Fully-qualified class name for the source type used in the mapping.
> If specified, the input to the mapping is converted to the specified type
> before being mapped with Dozer.
>      */
>     public void setSourceModel(String sourceModel) {
>         this.sourceModel = sourceModel;
>     }
>
>     public String getTargetModel() {
>         return targetModel;
>     }
>
>     /**
>      * Fully-qualified class name for the target type used in the mapping.
>      */
>     public void setTargetModel(String targetModel) {
>         this.targetModel = targetModel;
>     }
>
>     public String getName() {
>         return name;
>     }
>
>     /**
>      * A human readable name of the mapping.
>      */
>     public void setName(String name) {
>         this.name = name;
>     }
>
>     public String getMappingFile() {
>         return mappingFile;
>     }
>
>     /**
>      * The location of a Dozer configuration file. The file is loaded from
> the classpath by default,
>      * but you can use file:, classpath:, or http: to load the configuration
> from a specific location.
>      */
>     public void setMappingFile(String mappingFile) {
>         this.mappingFile = mappingFile;
>     }
>
>     public DozerBeanMapperConfiguration getMappingConfiguration() {
>         return mappingConfiguration;
>     }
>
>     /**
>      * The name of a DozerBeanMapperConfiguration bean in the Camel registry
> which should be used for configuring the Dozer mapping.
>      * This is an alternative to the mappingFile option that can be used for
> fine-grained control over how Dozer is configured.
>      * Remember to use a "#" prefix in the value to indicate that the bean
> is in the Camel registry (e.g. "#myDozerConfig").
>      */
>     public void setMappingConfiguration(DozerBeanMapperConfiguration
> mappingConfiguration) {
>         this.mappingConfiguration = mappingConfiguration;
>     }
> }
>
> Exception,
> java.lang.NullPointerException
>         at
> org.apache.camel.component.dozer.DozerProducer.process(DozerProducer.java:81)
>         at
> org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
>         at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:141)
>         at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
>         at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:460)
>         at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
>         at org.apache.camel.processor.Pipeline.process(Pipeline.java:121)
>         at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)
>         at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
>         at
> org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:62)
>         at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:141)
>         at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
>         at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:460)
>         at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
>         at org.apache.camel.processor.Pipeline.process(Pipeline.java:121)
>         at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)
>         at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
>         at
> org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:62)
>         at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:141)
>         at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
>         at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:460)
>         at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
>         at org.apache.camel.processor.Pipeline.process(Pipeline.java:121)
>         at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)
>         at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
>         at
> org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:62)
>         at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:141)
>         at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
>         at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:460)
>         at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
>         at org.apache.camel.processor.Pipeline.process(Pipeline.java:121)
>         at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)
>         at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
>         at
> org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:62)
>         at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:141)
>         at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
>         at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:460)
>         at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
>         at org.apache.camel.processor.Pipeline.process(Pipeline.java:121)
>         at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)
>         at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
>         at
> org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:123)
>         at
> org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:721)
>         at
> org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:681)
>         at
> org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:651)
>         at
> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:315)
>         at
> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:253)
>         at
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1150)
>         at
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1142)
>         at
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:1039)
>         at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>         at java.lang.Thread.run(Thread.java:745)
> [Consumer[KR.ORCHESTRATION.REQ]] EndpointMessageListener        WARN
> Execution of JMS message listener failed. Caused by:
> [org.apache.camel.RuntimeCamelException - java.lang.NullPointerException]
> org.apache.camel.RuntimeCamelException: java.lang.NullPointerException
>         at
> org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1642)
>         at
> org.apache.camel.component.jms.EndpointMessageListener$EndpointMessageListenerAsyncCallback.done(EndpointMessageListener.java:195)
>         at
> org.apache.camel.processor.CamelInternalProcessor$InternalCallback.done(CamelInternalProcessor.java:250)
>         at org.apache.camel.processor.Pipeline.process(Pipeline.java:109)
>         at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
>         at
> org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:123)
>         at
> org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:721)
>         at
> org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:681)
>         at
> org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:651)
>         at
> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:315)
>         at
> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:253)
>         at
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1150)
>         at
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1142)
>         at
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:1039)
>         at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>         at java.lang.Thread.run(Thread.java:745)
> Caused by: java.lang.NullPointerException
>         at
> org.apache.camel.component.dozer.DozerProducer.process(DozerProducer.java:81)
>         at
> org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
>         at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:141)
>         at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
>         at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:460)
>         at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
>         at org.apache.camel.processor.Pipeline.process(Pipeline.java:121)
>         at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)
>         at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
>         at
> org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:62)
>         at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:141)
>         at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
>         at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:460)
>         at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
>         at org.apache.camel.processor.Pipeline.process(Pipeline.java:121)
>         at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)
>         at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
>         at
> org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:62)
>         at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:141)
>         at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
>         at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:460)
>         at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
>         at org.apache.camel.processor.Pipeline.process(Pipeline.java:121)
>         at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)
>         at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
>         at
> org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:62)
>         at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:141)
>         at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
>         at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:460)
>         at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
>         at org.apache.camel.processor.Pipeline.process(Pipeline.java:121)
>         at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)
>         at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
>         at
> org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:62)
>         at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:141)
>         at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
>         at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:460)
>         at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
>         at org.apache.camel.processor.Pipeline.process(Pipeline.java:121)
>         at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Nullpointer-exception-while-mapping-via-dozer-tp5784052.html
> Sent from the Camel Development mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Mime
View raw message