Over time yes, right now we just want a working MVP with as few changes as possible to get it bootified, then make it more bootiful, and in that respect we have the question I posted in the last mail.
Den ons. 27. jun. 2018 kl. 20:46 skrev Mark Nuttall <mknutt...@gmail.com>: > Can you switch to Java routes instead XML? I am deploying Spring Boot Camel > Java routes as war's with no issues. > > On Wed, Jun 27, 2018 at 2:09 PM, David Karlsen <davidkarl...@gmail.com> > wrote: > > > No - it is not wrong to create .war's: > > https://docs.spring.io/spring-boot/docs/1.5.14.RELEASE/ > > reference/htmlsingle/#howto-create-a-deployable-war-file > > - but not the most common deployment model. > > > > Anyway - we're drifting away from the original problem which is the NPE > in > > the CamelBeanPostProcessor.postProcessBeforeInitialization( > > CamelBeanPostProcessor.java:159). > > > > There seems to be others that have the very same problem: > > https://medium.freecodecamp.org/configure-multiple-camel- > > context-in-spring-boot-application-d3a16396266 > > > > From http://camel.apache.org/spring-boot.html, "Adding XML Routes", > > there > > seems to possible to load xml-based routes from a common place - but > these > > are *routes* not contexts. > > This is a vanilla spring+camel app which is being migrated to boot+camel > > > > Is it safe to say that multiple *Camel Contexts* is not supported when > > using boot? Is it by design or should an issue be opened? > > The way to migrate this is maybe to try to remove the camel context > parts, > > and be left with the xml-based routes and follow the pattern in "Adding > XML > > routes" as described above? > > > > > > Den ons. 27. jun. 2018 kl. 17:18 skrev Doug Douglass < > > douglass.d...@gmail.com>: > > > > > On Wed, Jun 27, 2018 at 12:18 AM Claus Ibsen <claus.ib...@gmail.com> > > > wrote: > > > > > > > Hi > > > > > > > > Its a bit confusing what you do. Are you really packaging spring-boot > > > > inside a WAR file and then deploying that to Jetty? > > > > If so this is wrong. Spring Boot is a standalone runtime which you > > > > should not embed in others. > > > > > > > > > > While perhaps not directly related to the users NPE problem... > > > > > > It is not "wrong" to package a Spring Boot-based app as a WAR and > deploy > > to > > > a container, though it certainly isn't the usual way. > > > > > > On a recent project (ended last year) using Spring Boot 1.5.4.RELEASE > and > > > Camel 2.19.1, the deployment environment dictated WARs deployed to > Tomcat > > > servers. This required changing the packaging in the POM to war, > setting > > > the spring-boot-starter-tomcat dependency to provided so as not to > > include > > > conflicting tomcat classes in the WARs, and modifying the application > > > classes as follows: > > > > > > @SpringBootApplication > > > public class MyApplication > > > extends SpringBootServletInitializer { > > > public static void main(String[] args) { > > > ApplicationContext applicationContext = new SpringApplication( > > MyApplication > > > .class).run(args); > > > CamelSpringBootApplicationController applicationController = > > > applicationContext.getBean(CamelSpringBootApplicationController.class); > > > applicationController.run(); > > > } > > > > > > @Override > > > protected SpringApplicationBuilder > > > configure(SpringApplicationBuilder builder) { > > > builder.sources(MyApplication.class); > > > return builder; > > > } > > > > > > ... > > > } > > > > > > The main method allows running the application from Eclipse/STS or the > > > spring-boot maven plugin. Extending SpringBootServletInitializer and > > > overriding configure() allows the app to initialize correctly when > > deployed > > > to a container. Note that all the applications used Java config for > both > > > Spring and Camel routes. > > > > > > YMMV if using Spring Boot 2 > > > > > > > > > > > > > > On Sun, Jun 24, 2018 at 9:44 PM, Mohit Sharma <mohit.sha...@evry.com > > > > > > 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=#NMQServiceCacheConnectionFacto > > ry&destinationResolver=#notificationServiceDestinationResolver& > > disableTimeToLive=true&deliveryPersistent=true& > > explicitQosEnabled=true&disableReplyTo=true& > > 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.AbstractAutowireCapableBeanFac > > tory.doCreateBean(AbstractAutowireCapableBeanFactory.java:564) > > > > > at > > > > > > > > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac > > tory.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.AbstractAutowireCapableBeanFac > > tory.applyBeanPostProcessorsBeforeInitialization( > > AbstractAutowireCapableBeanFactory.java:409) > > > > > at > > > > > > > > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac > > tory.initializeBean(AbstractAutowireCapableBeanFactory.java:1626) > > > > > at > > > > > > > > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac > > tory.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 > > > > > > > > > > > > > -- > > -- > > David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen > > > -- -- David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen