In an attempt to get the Camel Context I did the following in the scala
project. 

In application.conf I added 

akka.camel.context-provider="com.utility.MyContextProvider"

I then created a new class in the scala file. 

@Component
final class MyContextProvider extends ContextProvider {

 @Autowired() var ctx: ApplicationContext = _

  override def getContext(system: ExtendedActorSystem) = {
    println(s"Context called {$ctx}") // ctx is NULL.
    //     new SpringCamelContext(ctx)
    println(s"Context called ${WebServiceConfig.camelContext1}")

    WebServiceConfig.camelContext1 /// A static member created as a
workaround
  }

This causes an error 

Context called {null}
Context called SpringCamelContext(camel-1) with spring id application
Exception in thread "main" java.lang.IllegalStateException: Disabling JMX
can only be done when CamelContext has not been started
        at
org.apache.camel.impl.DefaultCamelContext.disableJMX(DefaultCamelContext.java:3842)
        at
akka.camel.internal.DefaultCamel.context$lzycompute(DefaultCamel.scala:35)
        at akka.camel.internal.DefaultCamel.context(DefaultCamel.scala:33)
        at akka.camel.internal.DefaultCamel.start(DefaultCamel.scala:53)
        at akka.camel.CamelExtension$.createExtension(Camel.scala:134)
        at akka.camel.CamelExtension$.createExtension(Camel.scala:128)
        at akka.actor.ActorSystemImpl.registerExtension(ActorSystem.scala:757)
        at akka.actor.ExtensionId$class.apply(Extension.scala:79)
        at akka.camel.CamelExtension$.apply(Camel.scala:128)
        at
com.aspect.manhattan.hubchannel.ctips.utility.CtipsHcaApplication.Run(CTIPSHcaApplication.scala:86)
        at
com.aspect.manhattan.hubchannel.ctips.utility.CtipsHcaApplication$.main(CTIPSHcaApplication.scala:50)
        at
com.aspect.manhattan.hubchannel.ctips.utility.CtipsHcaApplication.main(CTIPSHcaApplication.scala)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)



--
View this message in context: 
http://camel.465427.n5.nabble.com/Akka-Camel-and-Spring-Boot-tp5777000p5777002.html
Sent from the Camel Development mailing list archive at Nabble.com.

Reply via email to