Search code examples
eclipseejbjava-ee-6observer-patternstateless

Eclipse @Observes in @Stateless bean compile error


I have a ListenerImpl which purpose it is to handle Events Asynchronously. to achieve this I use the following method.

    @Asynchronous
    public void handle(@Observes MonitorEvent pEvent){
       //dostuff 
    }

The class itself is annotated with @Stateless.

Now Eclipse gives the following error: handle observer method is only allowed in a managed bean class, session bean class, or an extension class.

Someone knows whats going wrong?


Solution

  • I managed to solve the problem to convert the component into an ejb-module instead of a utility module.