Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-842

Event injection via constructor injection results in stacktrace.

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved (View Workflow)
    • Major
    • Resolution: Done
    • 1.1.0.Final
    • 1.1.4.Final
    • None
    • None

    Description

      /**
       * @author Mike Brock .
       */
      @ApplicationScoped
      public class HelloWorldService {
          private  Event<ResponseEvent> responseEvent;
      
          @Inject
          public HelloWorldService(Event<ResponseEvent> responseEvent) {
              this.responseEvent = responseEvent;
          }
      
          public void handleMessage(@Observes MessageEvent event) {
              System.out.println("Received Message: " + event.getMessage());
              responseEvent.fire(new ResponseEvent(event.getMessage()));
          }
      }
      

      Results in stacktrace:

      com.google.common.collect.ComputationException: org.jboss.weld.exceptions.DefinitionException: org.jboss.errai.demos.cdi.helloworld.server.org$jboss$weld$bean-flat-ManagedBean-class_org$jboss$errai$demos$cdi$helloworld$server$HelloWorldService_$$_WeldClientProxy
      	at com.google.common.collect.MapMaker$StrategyImpl.compute(MapMaker.java:602)
      	at com.google.common.collect.MapMaker$StrategyImpl.compute(MapMaker.java:462)
      	at com.google.common.collect.CustomConcurrentHashMap$ComputingImpl.get(CustomConcurrentHashMap.java:2045)
      	at org.jboss.weld.bean.proxy.ClientProxyProvider.getClientProxy(ClientProxyProvider.java:112)
      	at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:660)
      	at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:252)
      	at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:222)
      	at org.jboss.weld.manager.BeanManagerImpl.notifyObservers(BeanManagerImpl.java:614)
      	at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:607)
      	at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:601)
      	at org.jboss.errai.cdi.server.EventDispatcher.callback(EventDispatcher.java:60)
      

      Thought it was a problem in our integration at first, but then I realized the problem does not happen when field injection is used for the Event.

      Attachments

        Activity

          People

            ajustin@redhat.com Ales Justin
            cbrock_jira Mike Brock (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: