title: Running Vaadin CDI App on Wildfly causes NullpointerException
body: <p>I'm trying to get a minimum Vaadin 7.1.12 app running spitting out a string from a session bean injected via CDI, on Wildfly (final version)</p>
  
  <hr>
  
  <p>EDIT: Problem solved - should have injected my gui component instead of using 'new'. See bottom of post for details</p>
  
  <hr>
  
  <p>This is just a helloworld/poc project with one ui-button and an event-handler calling a method in a stateless sessionbean. It basically works until the handler is invoked, then I get a NPE because the bean has not been initialized. (You can see the whole log at the bottom, it's not nicely formatted :o).</p>
  
  <p>I have two Maven projects, a service-project and a web project, both modules of a parent pom. I have bean.xml (in META-INF of service project and WEB-INF of web project), but no web.xml or ejb-jar.xml or any other xml-config-file.</p>
  
  <p>Using wildfly maven plugin for deployment, everything running on Java 8 </p>
  
  <p>The service project just contains one really simple Session bean:</p>
  
  <pre><code>package com.xy.zzy.service.session;
  
  import javax.ejb.Stateless;
  
  @Stateless
  public class Pingu {
  
      public String ping() {
          return "Pingu is alive!";
      }  
  }
  </code></pre>
  
  <p>The web project contains a simple UI. </p>
  
  <pre><code>package com.xy.zzy;
  
  import com.vaadin.cdi.CDIUI;
  import com.vaadin.server.Constants;
  import com.vaadin.server.VaadinRequest;
  import com.vaadin.server.VaadinServlet;
  import com.vaadin.server.VaadinSession;
  import com.vaadin.ui.UI;
  import javax.servlet.annotation.WebInitParam;
  import javax.servlet.annotation.WebServlet;
  
  
  @CDIUI
  public class MyVaadinUI extends UI {
  
      @WebServlet(urlPatterns = "/*", initParams = { 
          @WebInitParam(name = VaadinSession.UI_PARAMETER,
          value = "com.xy.zzy.MyVaadinUI"), 
          @WebInitParam(name = Constants.PARAMETER_WIDGETSET, 
          value =     "com.xy.zzy.AppWidgetSet"), 
          @WebInitParam(name = Constants.SERVLET_PARAMETER_UI_PROVIDER, 
          value =     "com.vaadin.cdi.CDIUIProvider") 
          })
      public static class UIApplicationServlet extends VaadinServlet {}
  
      @Override
      protected void init(VaadinRequest request) {
          setContent(new MyCompositeEvents());
      }
  
  }
  </code></pre>
  
  <p>Finally, the actual useage of the Pingu EJB in MyCompositeEvent (this is a subclass of a UI component generated by the eclipse vaadin plugin, and it just displays a button.</p>
  
  <pre><code>package com.xy.zzy;
  
  import com.xy.zzy.service.session.Pingu;
  import com.vaadin.ui.Button;
  import javax.inject.Inject;
  
  public class MyCompositeEvents extends MyComposite {
  
  @Inject Pingu pingu;
  
  @Override
  void doInitialize() {
      button_1.addClickListener(new Button.ClickListener() {
          @Override
          public void buttonClick(Button.ClickEvent clickEvent) {
  button_1.setCaption(pingu.ping());
  
          }
      });
  }
  }
  </code></pre>
  
  <p>In the parent pom.xml I'm pulling in</p>
  
  <pre><code>    &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.enterprise&lt;/groupId&gt;
          &lt;artifactId&gt;cdi-api&lt;/artifactId&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.inject&lt;/groupId&gt;
          &lt;artifactId&gt;javax.inject&lt;/artifactId&gt;    
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt; 
      &lt;dependency&gt;
          &lt;groupId&gt;javax.annotation&lt;/groupId&gt;
          &lt;artifactId&gt;javax.annotation-api&lt;/artifactId&gt;
          &lt;version&gt;1.2&lt;/version&gt;      
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;         
      &lt;dependency&gt;
          &lt;groupId&gt;org.jboss.spec.javax.annotation&lt;/groupId&gt;
          &lt;artifactId&gt;jboss-annotations-api_1.2_spec&lt;/artifactId&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.jboss.spec.javax.ejb&lt;/groupId&gt;
          &lt;artifactId&gt;jboss-ejb-api_3.2_spec&lt;/artifactId&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  </code></pre>
  
  <p>service pom (hibernate for entities when the basic cdi injection works):</p>
  
  <pre><code>    &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate.javax.persistence&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-jpa-2.1-api&lt;/artifactId&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.jboss.spec.javax.ejb&lt;/groupId&gt;
          &lt;artifactId&gt;jboss-ejb-api_3.2_spec&lt;/artifactId&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.jboss.spec.javax.transaction&lt;/groupId&gt;
          &lt;artifactId&gt;jboss-transaction-api_1.2_spec&lt;/artifactId&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-validator&lt;/artifactId&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
          &lt;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
                  &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
  
  &lt;/dependencies&gt;
  </code></pre>
  
  <p>and the web pom:</p>
  
  <pre><code>    &lt;dependencies&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;com.vaadin&lt;/groupId&gt;
          &lt;artifactId&gt;vaadin-server&lt;/artifactId&gt;
          &lt;version&gt;${vaadin.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.vaadin&lt;/groupId&gt;
          &lt;artifactId&gt;vaadin-client-compiled&lt;/artifactId&gt;
          &lt;version&gt;${vaadin.version}&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;com.vaadin&lt;/groupId&gt;
          &lt;artifactId&gt;vaadin-client&lt;/artifactId&gt;
          &lt;version&gt;${vaadin.version}&lt;/version&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.vaadin&lt;/groupId&gt;
          &lt;artifactId&gt;vaadin-push&lt;/artifactId&gt;
          &lt;version&gt;${vaadin.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.vaadin&lt;/groupId&gt;
          &lt;artifactId&gt;vaadin-themes&lt;/artifactId&gt;
          &lt;version&gt;${vaadin.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.vaadin&lt;/groupId&gt;
          &lt;artifactId&gt;vaadin-cdi&lt;/artifactId&gt;
          &lt;version&gt;1.0.0.alpha1&lt;/version&gt;
          &lt;type&gt;jar&lt;/type&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
          &lt;artifactId&gt;javax.servlet-api&lt;/artifactId&gt;
          &lt;version&gt;3.0.1&lt;/version&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.xy.zzy&lt;/groupId&gt;
          &lt;artifactId&gt;xyzzy-service&lt;/artifactId&gt;
          &lt;version&gt;1.0.0-SNAPSHOT&lt;/version&gt;
          &lt;type&gt;ejb&lt;/type&gt;
  
      &lt;/dependency&gt;
  
  &lt;/dependencies&gt;
  </code></pre>
  
  <p>This is what happens when the session bean is invoked (NPE):</p>
  
  <pre><code>13:16:52,165 INFO  [org.jboss.as.repository] (management-handler-thread - 17) JBAS014900: Content added at location /Users/xyzzy/Local/wildfly-8.0.0.Final/standalone/data/content/2d/7a1b2b61aca1ab04c8c64a48929d6fa5932084/content
  13:16:52,166 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-6) JBAS015876: Starting deployment of "xyzzy-web.war" (runtime-name: "xyzzy-web.war")
  13:16:52,724 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015877: Stopped deployment xyzzy-web.war (runtime-name: xyzzy-web.war) in 557ms
  13:16:52,725 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015876: Starting deployment of "xyzzy-web.war" (runtime-name: "xyzzy-web.war")
  13:16:53,197 INFO  [org.jboss.weld.deployer] (MSC service thread 1-2) JBAS016002: Processing weld deployment xyzzy-web.war
  13:16:53,200 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-2) JNDI bindings for session bean named Pingu in deployment unit deployment "xyzzy-web.war" are as follows:
  
      java:global/xyzzy-web/Pingu!com.xy.zzy.service.session.Pingu
      java:app/xyzzy-web/Pingu!com.xy.zzy.service.session.Pingu
      java:module/Pingu!com.xy.zzy.service.session.Pingu
      java:global/xyzzy-web/Pingu
      java:app/xyzzy-web/Pingu
      java:module/Pingu
  
  13:16:53,212 INFO  [org.jboss.weld.deployer] (MSC service thread 1-16) JBAS016005: Starting Services for CDI deployment: xyzzy-web.war
  13:16:53,216 INFO  [org.jboss.weld.deployer] (MSC service thread 1-11) JBAS016008: Starting weld service for deployment xyzzy-web.war
  13:16:53,379 INFO  [com.vaadin.cdi.internal.VaadinExtension] (MSC service thread 1-12) UIScopedContext registered
  13:16:53,442 INFO  [com.vaadin.cdi.internal.ContextDeployer] (MSC service thread 1-14) Initializing web context for path /xyzzy-web
  13:16:53,442 INFO  [com.vaadin.cdi.internal.ContextDeployer] (MSC service thread 1-14) Discovering Vaadin UIs...
  13:16:53,443 INFO  [com.vaadin.cdi.internal.ContextDeployer] (MSC service thread 1-14) 1 beans inheriting from UI discovered!
  13:16:53,443 INFO  [com.vaadin.cdi.internal.ContextDeployer] (MSC service thread 1-14) Vaadin UI com.xy.zzy.MyVaadinUI is marked as @CDIUI without context path, this UI is accessible from context root of deployment
  13:16:53,443 INFO  [com.vaadin.cdi.internal.ContextDeployer] (MSC service thread 1-14) Available Vaadin UIs for CDI deployment []
  13:16:53,444 WARNING [com.vaadin.cdi.internal.ContextDeployer] (MSC service thread 1-14) Vaadin related servlet is defined in deployment descriptor, automated deployment of VaadinCDIServlet is now disabled
  13:16:53,444 INFO  [com.vaadin.cdi.internal.ContextDeployer] (MSC service thread 1-14) Done deploying Vaadin UIs
  13:16:53,445 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-14) JBAS017534: Registered web context: /xyzzy-web
  13:16:53,461 INFO  [org.jboss.as.server] (management-handler-thread - 17) JBAS018562: Redeployed "xyzzy-web.war"
  13:16:53,461 INFO  [org.jboss.as.server] (management-handler-thread - 17) JBAS018565: Replaced deployment "xyzzy-web.war" with deployment "xyzzy-web.war"
  13:16:53,462 INFO  [org.jboss.as.repository] (management-handler-thread - 17) JBAS014901: Content removed from location /Users/martin/Local/wildfly-8.0.0.Final/standalone/data/content/81/50420b5c937c94c75d3c543ad8b6560901f198/content
  13:29:36,571 WARNING [com.vaadin.server.DefaultDeploymentConfiguration] (default task-13) 
  =================================================================
  Vaadin is running in DEBUG MODE.
  Add productionMode=true to web.xml to disable debug features.
  To show debug window, add ?debug to your application URL.
  =================================================================
  13:29:36,594 INFO  [org.atmosphere.cpr.AtmosphereFramework] (default task-13) Installed AtmosphereHandler com.vaadin.server.communication.PushHandler mapped to context-path: /*
  13:29:36,621 INFO  [org.atmosphere.cpr.AtmosphereFramework] (default task-13) Auto detecting WebSocketHandler in /WEB-INF/classes/
  13:29:36,622 INFO  [org.atmosphere.cpr.AtmosphereFramework] (default task-13) Installed WebSocketProtocol org.atmosphere.websocket.protocol.SimpleHttpProtocol 
  13:29:36,624 INFO  [org.atmosphere.cpr.AtmosphereFramework] (default task-13) Atmosphere is using async support: org.atmosphere.container.Servlet30CometSupport running under container: WildFly 8.0.0.Final - 1.0.0.Final using javax.servlet/3.0
  13:29:36,627 INFO  [org.atmosphere.cpr.AtmosphereFramework] (default task-13) Installed Default AtmosphereInterceptor [Android Interceptor Support, SSE Interceptor Support, JSONP Interceptor Support, Long-Polling Padding Interceptor Support, Atmosphere JavaScript Protocol, Browser disconnection detection]. Set org.atmosphere.cpr.AtmosphereInterceptor.disableDefaults in your xml to disable them.
  13:29:36,627 WARNING [org.atmosphere.cpr.AtmosphereFramework] (default task-13) No BroadcasterCache configured. Broadcasted message between client reconnection will be LOST. It is recommended to configure the org.atmosphere.cache.UUIDBroadcasterCache
  13:29:36,627 INFO  [org.atmosphere.cpr.AtmosphereFramework] (default task-13) Shared ExecutorService supported: true
  13:29:36,627 INFO  [org.atmosphere.cpr.AtmosphereFramework] (default task-13) HttpSession supported: true
  13:29:36,628 INFO  [org.atmosphere.cpr.AtmosphereFramework] (default task-13) Using BroadcasterFactory: org.atmosphere.cpr.DefaultBroadcasterFactory
  13:29:36,628 INFO  [org.atmosphere.cpr.AtmosphereFramework] (default task-13) Using WebSocketProcessor: org.atmosphere.websocket.DefaultWebSocketProcessor
  13:29:36,628 INFO  [org.atmosphere.cpr.AtmosphereFramework] (default task-13) Using Broadcaster: org.atmosphere.cpr.DefaultBroadcaster
  13:29:36,628 INFO  [org.atmosphere.cpr.AtmosphereFramework] (default task-13) Atmosphere Framework 1.0.18.vaadin3 started.
  13:29:36,628 INFO  [org.atmosphere.cpr.AtmosphereFramework] (default task-13) Installed AtmosphereInterceptor  Track Message Size Interceptor using |. 
  13:29:36,772 INFO  [com.vaadin.cdi.internal.BeanStoreContainer] (default task-5) New BeanStoreContainer created
  13:29:37,685 ERROR [stderr] (default task-10) Kooo
  13:29:37,688 SEVERE [com.vaadin.server.DefaultErrorHandler] (default task-10) : com.vaadin.server.ServerRpcManager$RpcInvocationException: Unable to invoke method click in com.vaadin.shared.ui.button.ButtonServerRpc
      at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:170) [vaadin-server-7.1.12.jar:7.1.12]
      at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:118) [vaadin-server-7.1.12.jar:7.1.12]
      at com.vaadin.server.communication.ServerRpcHandler.handleBurst(ServerRpcHandler.java:207) [vaadin-server-7.1.12.jar:7.1.12]
      at com.vaadin.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:111) [vaadin-server-7.1.12.jar:7.1.12]
      at com.vaadin.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:91) [vaadin-server-7.1.12.jar:7.1.12]
      at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:37) [vaadin-server-7.1.12.jar:7.1.12]
      at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1382) [vaadin-server-7.1.12.jar:7.1.12]
      at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:238) [vaadin-server-7.1.12.jar:7.1.12]
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]
      at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
      at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
      at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
      at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
      at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:113) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
      at io.undertow.security.handlers.AuthenticationCallHandler.handleRequest(AuthenticationCallHandler.java:52) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
      at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
      at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:61) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
      at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
      at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
      at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
      at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:240) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
      at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
      at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:73) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
      at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:146) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
      at io.undertow.server.Connectors.executeRootHandler(Connectors.java:168) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
      at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:687) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0]
      at java.lang.Thread.run(Thread.java:744) [rt.jar:1.8.0]
  Caused by: java.lang.reflect.InvocationTargetException
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0]
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [rt.jar:1.8.0]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0]
      at java.lang.reflect.Method.invoke(Method.java:483) [rt.jar:1.8.0]
      at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:168) [vaadin-server-7.1.12.jar:7.1.12]
      ... 32 more
  Caused by: com.vaadin.event.ListenerMethod$MethodException: Invocation of method buttonClick in com.xy.zzy.MyCompositeEvents$1 failed.
      at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:528) [vaadin-server-7.1.12.jar:7.1.12]
      at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:198) [vaadin-server-7.1.12.jar:7.1.12]
      at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:161) [vaadin-server-7.1.12.jar:7.1.12]
      at com.vaadin.server.AbstractClientConnector.fireEvent(AbstractClientConnector.java:969) [vaadin-server-7.1.12.jar:7.1.12]
      at com.vaadin.ui.Button.fireClick(Button.java:368) [vaadin-server-7.1.12.jar:7.1.12]
      at com.vaadin.ui.Button$1.click(Button.java:57) [vaadin-server-7.1.12.jar:7.1.12]
      ... 37 more
  Caused by: java.lang.NullPointerException
      at com.xy.zzy.MyCompositeEvents$1.buttonClick(MyCompositeEvents.java:21) [classes:]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0]
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [rt.jar:1.8.0]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0]
      at java.lang.reflect.Method.invoke(Method.java:483) [rt.jar:1.8.0]
      at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:508) [vaadin-server-7.1.12.jar:7.1.12]
      ... 42 more
  </code></pre>
  
  <p>SOLUTION:</p>
  
  <p>Found another answer that put me on the right track here: <a href="https://stackoverflow.com/questions/12552179/vaadin-cdi-inject-is-null-after-referencing?rq=1">Vaadin: CDI Inject is null after referencing</a></p>
  
  <p>I just needed to inject my gui-component as well as the ejb, instead of creating it with new.</p>
  
  <p>Changing</p>
  
  <pre><code>@Override
  protected void init(VaadinRequest request) {
      setContent(new MyCompositeEvents());
  }
  </code></pre>
  
  <p>to</p>
  
  <pre><code>@Inject MyComopsiteEvents mce;
  @Override
  protected void init(VaadinRequest request) {
      setContent(mce);
  }
  </code></pre>
  
  <p>did the trick. Noob-problem i guess, but this is my first attempt to use cdi with vaadin.</p>
  
  <p>Seems I'm not allowed to answer my own question, so feel free to copy this into an answer-posting :-)</p>