A NullPointerException occurs in setupCamelContext method after Camel upgrade from 2.X to 3.2

34 views Asked by At

I am getting a NullPointerException in my application after Apache Camel upgrade from 2.x to 3.2

Bean definition is as follows in Application class.

@Override
    protected void setupCamelContext(CamelContext camelContext) throws Exception {
        camelContext.getManagementStrategy().addEventNotifier(new CamelEventNotifier());
    }

Once debug I can see camelContext != NULL, But camelContext.getManagementStrategy() == NULL

Please help me to resolve this.

Error details:

Caused by:
org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.camel.CamelContext]: Factory method 'camelContext' threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
... 161 more

Caused by:
java.lang.NullPointerException
at *.Application.setupCamelContext(Application.java:128)
at org.apache.camel.spring.javaconfig.CamelConfiguration.camelContext(CamelConfiguration.java:163)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
... 162 more
0

There are 0 answers