2 Replies Latest reply on Sep 3, 2012 7:42 AM by miragpl

    Firing weld event from MBean

    miragpl Newbie

      Hi, I got following setup:

       

      1. separate jar with deployed JMX service that offers "register" method (then all registered objects receives asynchronous notifications)

       

      2. second project where I would like to create a singleton bean that receives the notification from mentioned JMX service and fires a weld event.

       

      Unfortunately whenever my singleton receives a notification and tries to fire an event I got following exception:

       

      3:55:38,539 ERROR [STDERR] Exception in thread "Thread-24" java.lang.IllegalStateException: Singleton not set for BaseClassLoader@df3bd5{vfs:///D:/dev/java/tools/servers/jboss-6.1.0.Final/server/default/deploy/my-jboss-beans.xml}

        13:55:38,540 ERROR [STDERR]           at org.jboss.weld.integration.provider.JBossSingletonProvider$TopLevelSingleton.get(JBossSingletonProvider.java:51)

        13:55:38,540 ERROR [STDERR]           at org.jboss.weld.Container.instance(Container.java:58)

        13:55:38,540 ERROR [STDERR]           at org.jboss.weld.resolution.ResolvableBuilder.checkQualifier(ResolvableBuilder.java:209)

        13:55:38,540 ERROR [STDERR]           at org.jboss.weld.resolution.ResolvableBuilder.addQualifier(ResolvableBuilder.java:174)

        13:55:38,541 ERROR [STDERR]           at org.jboss.weld.resolution.ResolvableBuilder.addQualifiers(ResolvableBuilder.java:202)

        13:55:38,541 ERROR [STDERR]           at org.jboss.weld.manager.BeanManagerImpl.resolveObserverMethods(BeanManagerImpl.java:477)

        13:55:38,541 ERROR [STDERR]           at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:628)

        13:55:38,541 ERROR [STDERR]           at org.jboss.weld.event.EventImpl.fire(EventImpl.java:75)

       

      When I fire an event straight from my singleton bean (for example directly in @PostConstruct method everything works fine).

      I would appreciate any hints how to solve this mystery

      I'm using jboss 6.1-Final.

       

      Cheers,

      mirag