git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Spring boot gives null pointer in xml based camel configutaions


Hi

What version of Camel do you use?

And how do you run this in Jetty / Spring-Boot its a bit unclear what
you say what you are migrating from/to etc.
Do you package it as a .war file and drop into Jetty. And if so have
you setup any web.xml to bootstrap spring or something?

And try with newer Camel version if you have not.


On Sun, Jun 24, 2018 at 9:44 PM, Mohit Sharma <Mohit.Sharma@xxxxxxxx> wrote:
>
> Hi All,
>
> My name is Mohit and I am working with EVRY AS Norway<https://www.evry.com/> .
>
> I am trying to upgraded existing Spring application based web application running on jetty to Spring boot. I have updated dependencies (respective pom's).
>
> Now when I am running jetty, it give error for camel related configuration, ex of camel configuration which is working on spring
>
> Context file with camel configurations :
>
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans";
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:util="http://www.springframework.org/schema/util";
>        xmlns:context="http://www.springframework.org/schema/context";
>        xmlns:camel="http://camel.apache.org/schema/spring";
>        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
>                               http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
>                               http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
>                               http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd";>
>
>     <bean id="notificationService" class="com.edb.payment.pays.core.pwh.service.notification.NotificationServiceImpl"/>
>     <context:component-scan base-package="com.edb.payment.pays.core.pwh.service.notification.mapper"/>
>
>          <bean id="notificationServiceDestinationResolver"
>                class="com.edb.finance.common.spring.jms.support.WmqDestinationResolver">
>              <property name="targetClient">
>                  <util:constant static-field="com.ibm.msg.client.wmq.WMQConstants.WMQ_TARGET_DEST_MQ"/>
>              </property>
>              <property name="encoding">
>                  <util:constant static-field="com.ibm.msg.client.wmq.WMQConstants.WMQ_ENCODING_NATIVE"/>
>              </property>
>              <property name="ccsid" value="${notification.internal.mq.ccsid:1208}"/>
>              <property name="baseQueueManagerName" value="${nmq.mq.queueManager}"/>
>          </bean>
>
>          <camel:camelContext id="notificationServiceCamelContext" useMDCLogging="true">
>
>              <camel:endpoint id="notificationServiceQueue" uri="jms:queue:{{notification.internal.mq.queueName}}?connectionFactory=#NMQServiceCacheConnectionFactory&amp;destinationResolver=#notificationServiceDestinationResolver&amp;disableTimeToLive=true&amp;deliveryPersistent=true&amp;explicitQosEnabled=true&amp;disableReplyTo=true&amp;exchangePattern=InOnly"/>
>
>              <camel:route id="cpsAdviceStatusReportServiceRoute">
>                  <camel:from uri="seda:notificationRoute"/>
>                  <camel:convertBodyTo type="com.evry.notification.message.v1.NotificationMessage"/>
>                  <camel:marshal>
>                      <camel:jaxb prettyPrint="true" encoding="{{file.encoding.utf}}"
>                                  contextPath="com.evry.notification.message.v1"/>
>                  </camel:marshal>
>                  <camel:convertBodyTo type="java.lang.String"/>
>                  <camel:log logName="MESSAGE_TRACE" loggingLevel="INFO"
>                             message="NOTIFICATION_SERVICE: headers= ${headers}, body= ${body}"/>
>                  <camel:to ref="notificationServiceQueue"/>
>              </camel:route>
>
>          </camel:camelContext>
>
> </beans>
>
> Error as :
>
> Error creating bean with name 'notificationService' defined in URL [file:/D:/mohit/code/pin-server/pays-core/pays-core-pi-service/target/classes/spring/pwh-notification-service-context.xml]: Initialization of bean failed; nested exception is org.apache.camel.spring.GenericBeansException: Error post processing bean: notificationService; nested exception is java.lang.NullPointerException
>     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:564)
>     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
>     at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312)
>     at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
>     at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308)
>     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
>     at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208)
>     at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138)
>     at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066)
>     at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:835)
>     at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741)
>     ... 184 more
> Caused by: org.apache.camel.spring.GenericBeansException: Error post processing bean: notificationService; nested exception is java.lang.NullPointerException
>     at org.apache.camel.spring.CamelBeanPostProcessor.postProcessBeforeInitialization(CamelBeanPostProcessor.java:159)
>     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:409)
>     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1626)
>     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
>     ... 194 more
> Caused by: java.lang.NullPointerException
>     at org.apache.camel.impl.CamelPostProcessorHelper.matchContext(CamelPostProcessorHelper.java:85)
>     at org.apache.camel.impl.DefaultCamelBeanPostProcessor$1.doWith(DefaultCamelBeanPostProcessor.java:185)
>     at org.apache.camel.util.ReflectionHelper.doWithFields(ReflectionHelper.java:74)
>     at org.apache.camel.impl.DefaultCamelBeanPostProcessor.injectFields(DefaultCamelBeanPostProcessor.java:167)
>     at org.apache.camel.impl.DefaultCamelBeanPostProcessor.postProcessBeforeInitialization(DefaultCamelBeanPostProcessor.java:82)
>     at org.apache.camel.spring.CamelBeanPostProcessor.postProcessBeforeInitialization(CamelBeanPostProcessor.java:153)
>     ... 197 more
> [INFO] Started ServerConnector@6847dfe8{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}<mailto:ServerConnector@6847dfe8%7bHTTP/1.1,%5bhttp/1.1%5d%7d%7b0.0.0.0:8080%7d>
> [INFO] Started @96732ms
> [INFO] Started Jetty Server
>
> Process finished with exit code -1
>
>
> Can please suggest me is there any problem with spring boot and this xml based configurations ? or do we need to take care something else as well ??
>
> I have tried number of ways to fix this but nothing works .. so I decided to ask you , sorry for trouble , hope I will get some suggestions here.
>
> Also I tried to subscribe for your groups but that failed.
>
>
> Regards,
> Mohit Sharma
>
>
>
> Sensitivity: Internal



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