You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Michael Rambichler (Jira)" <ji...@apache.org> on 2022/01/28 08:08:00 UTC

[jira] (CAMEL-17492) CamelBeanPostProcessor fails if @Producer is used in EventNotifier

    [ https://issues.apache.org/jira/browse/CAMEL-17492 ]


    Michael Rambichler deleted comment on CAMEL-17492:
    --------------------------------------------

was (Author: rambichler):
Hi [~davsclaus] the NPE is fixed. But CamelContext Autoconfigure does not spin ab the SPI ServiceEventNotifier bean. Can you please reopen the bug.

> CamelBeanPostProcessor fails if @Producer is used in EventNotifier
> ------------------------------------------------------------------
>
>                 Key: CAMEL-17492
>                 URL: https://issues.apache.org/jira/browse/CAMEL-17492
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core, camel-spring-boot
>    Affects Versions: 3.12.0, 3.13.0, 3.14.0
>            Reporter: Michael Rambichler
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 3.14.1, 3.15.0
>
>
> If you use a @Produce annotation in an EventNotifier Camel fails at startup.
> *Reproducable with:* Custom EventNotifier in a plain Camel + Springboot Routebuilder.
> I have reproduced it with the spring boot example: [https://github.com/apache/camel-spring-boot-examples/tree/main/spring-boot] and added the EventNotifier below.
>  
> Fails since Camel > 3.11
>  
> Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error post processing bean: testEventNotifier; nested exception is java.lang.NullPointerException
> ....
> Caused by: org.springframework.beans.factory.BeanCreationException: Error post processing bean: testEventNotifier; nested exception is java.lang.NullPointerException
> at org.apache.camel.spring.spi.CamelBeanPostProcessor.postProcessBeforeInitialization(CamelBeanPostProcessor.java:160) ~[camel-spring-3.14.0.jar:3.14.0]
> at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:440) ~[spring-beans-5.3.14.jar:5.3.14]
> at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1796) ~[spring-beans-5.3.14.jar:5.3.14]
> at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620) ~[spring-beans-5.3.14.jar:5.3.14]
> ... 122 common frames omitted
>  
>  
> *Example*
> [https://github.com/apache/camel-spring-boot-examples/tree/main/spring-boot] and added the EventNotifier below.
> {{TestEventNotifier.java}}
>  
> {{@Component}}
> {{public class TestEventNotifier extends EventNotifierSupport {}}
> {{   @Produce("stream:out")}}
> {{   TestProducer producer;}}
> {{   @Override}}
> {{   public void notify(CamelEvent event) throws Exception {}}
> {{      System.err.println(event);}}
> {{      //producer.publish("some notification");}}
> {{   }}}
> {{}}}
> {{---------------------------------------------------}}
> {{TestProducer.java:}}
> {{import org.apache.camel.InOnly;}}
> {{@InOnly}}
> {{public interface TestProducer {}}
> {{   void publish(String event);}}
> {{}}}
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)