0 Replies Latest reply on Dec 20, 2010 4:30 AM by tiefen

    Prolem with Singletons Startup and CDI

    tiefen

      Hey folks,


      got a little problem regarding Singleton EJBs and using CDI.
      Actually nothing fancy, I just have a Singleton bean that obsereves Registration events and one Singleton bean that should fire a Registration event after creation and after the container was started.


      I have tried the same with pure Singleton EJBs that inject the RegistrationBean and than register themselves, but now i want to do the same with CDI and events :)


      The application is deployed as a WAR, and i have a beans.xml and a ejb-jar.xml. I have tried several combinations of annotations, with and without local interface etc ...
      However, unfortunatly the deployment fails:


      10:03:40,022 ERROR [org.jboss.profileservice.bootstrap] Failed to load profile:: org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):
      
      DEPLOYMENTS MISSING DEPENDENCIES:
        Deployment "auto-timer-initializer:vfs:///C:/Users/xihhox/Desktop/jboss-6.0.0.20100911-M5/server/default/deploy/webdesigner.war$RegistryWeldBean" is missing the following dependencies:
          Dependency "jboss.j2ee:jar=webdesigner.war,name=RegistryWeldBean,service=EJB3" (should be in state "Installed", but is actually in state "Create")
        Deployment "auto-timer-initializer:vfs:///C:/Users/xihhox/Desktop/jboss-6.0.0.20100911-M5/server/default/deploy/webdesigner.war$WeldPluginBean" is missing the following dependencies:
          Dependency "jboss.j2ee:jar=webdesigner.war,name=WeldPluginBean,service=EJB3" (should be in state "Installed", but is actually in state "PreInstall")
        Deployment "jboss.j2ee:jar=webdesigner.war,name=RegistryWeldBean,service=EJB3" is missing the following dependencies:
          Dependency "vfs:///C:/Users/xihhox/Desktop/jboss-6.0.0.20100911-M5/server/default/deploy/webdesigner.war_WeldBootstrapBean" (should be in state "Start", but is actually in state "Create")
        Deployment "jboss.j2ee:jar=webdesigner.war,name=RegistryWeldBean,service=EJB3_endpoint" is missing the following dependencies:
          Dependency "jboss.j2ee:jar=webdesigner.war,name=RegistryWeldBean,service=EJB3" (should be in state "Installed", but is actually in state "Create")
        Deployment "jboss.j2ee:jar=webdesigner.war,name=WeldPluginBean,service=EJB3" is missing the following dependencies:
          Dependency "<UNKNOWN jboss.j2ee:jar=webdesigner.war,name=WeldPluginBean,service=EJB3>" (should be in state "Installed", but is actually in state "** UNRESOLVED Demands 'jboss.j2ee:jar=webdesigner.war,name=RegistryWeldBean,service=EJB3' **")
          Dependency "<UNKNOWN jboss.j2ee:jar=webdesigner.war,name=WeldPluginBean,service=EJB3>" (should be in state "Installed", but is actually in state "** UNRESOLVED Demands 'jndi:RegistryWeldBean/local' **")
        Deployment "jboss.j2ee:jar=webdesigner.war,name=WeldPluginBean,service=EJB3_endpoint" is missing the following dependencies:
          Dependency "jboss.j2ee:jar=webdesigner.war,name=WeldPluginBean,service=EJB3" (should be in state "Installed", but is actually in state "PreInstall")
        Deployment "jboss.web.deployment:war=/webdesigner" is missing the following dependencies:
          Dependency "vfs:///C:/Users/xihhox/Desktop/jboss-6.0.0.20100911-M5/server/default/deploy/webdesigner.war_WeldBootstrapBean" (should be in state "Start", but is actually in state "Create")
        Deployment "jndibinder:RegistryWeldBean/local" is missing the following dependencies:
          Dependency "<UNKNOWN jndibinder:RegistryWeldBean/local>" (should be in state "Installed", but is actually in state "** UNRESOLVED Demands 'jboss.j2ee:jar=webdesigner.war,name=RegistryWeldBean,service=EJB3' **")
        Deployment "jndibinder:RegistryWeldBean/local-at.pidas.webdesigner.registry.cdi.RegistryWeld" is missing the following dependencies:
          Dependency "<UNKNOWN jndibinder:RegistryWeldBean/local-at.pidas.webdesigner.registry.cdi.RegistryWeld>" (should be in state "Installed", but is actually in state "** UNRESOLVED Demands 'jboss.j2ee:jar=webdesigner.war,name=RegistryWeldBean,service=EJB3' **")
        Deployment "jndibinder:WeldPluginBean/local" is missing the following dependencies:
          Dependency "<UNKNOWN jndibinder:WeldPluginBean/local>" (should be in state "Installed", but is actually in state "** UNRESOLVED Demands 'jboss.j2ee:jar=webdesigner.war,name=WeldPluginBean,service=EJB3' **")
        Deployment "jndibinder:WeldPluginBean/local-at.pidas.webdesigner.registry.cdi.WeldPlugin" is missing the following dependencies:
          Dependency "<UNKNOWN jndibinder:WeldPluginBean/local-at.pidas.webdesigner.registry.cdi.WeldPlugin>" (should be in state "Installed", but is actually in state "** UNRESOLVED Demands 'jboss.j2ee:jar=webdesigner.war,name=WeldPluginBean,service=EJB3' **")
        Deployment "vfs:///C:/Users/xihhox/Desktop/jboss-6.0.0.20100911-M5/server/default/deploy/webdesigner.war_WBInjector" is missing the following dependencies:
          Dependency "vfs:///C:/Users/xihhox/Desktop/jboss-6.0.0.20100911-M5/server/default/deploy/webdesigner.war_WeldBootstrapBean" (should be in state "Installed", but is actually in state "Create")
        Deployment "vfs:///C:/Users/xihhox/Desktop/jboss-6.0.0.20100911-M5/server/default/deploy/webdesigner.war_WeldBootstrapBean" is missing the following dependencies:
          Dependency "jboss.j2ee:jar=webdesigner.war,name=WeldPluginBean,service=EJB3" (should be in state "Create", but is actually in state "PreInstall")
      
      DEPLOYMENTS IN ERROR:
        Deployment "<UNKNOWN jboss.j2ee:jar=webdesigner.war,name=WeldPluginBean,service=EJB3>" is in error due to the following reason(s): ** UNRESOLVED Demands 'jboss.j2ee:jar=webdesigner.war,name=RegistryWeldBean,service=EJB3' **, ** UNRESOLVED Demands 'jndi:RegistryWeldBean/local' **
        Deployment "<UNKNOWN jndibinder:WeldPluginBean/local-at.pidas.webdesigner.registry.cdi.WeldPlugin>" is in error due to the following reason(s): ** UNRESOLVED Demands 'jboss.j2ee:jar=webdesigner.war,name=WeldPluginBean,service=EJB3' **
        Deployment "<UNKNOWN jndibinder:RegistryWeldBean/local>" is in error due to the following reason(s): ** UNRESOLVED Demands 'jboss.j2ee:jar=webdesigner.war,name=RegistryWeldBean,service=EJB3' **
        Deployment "<UNKNOWN jndibinder:RegistryWeldBean/local-at.pidas.webdesigner.registry.cdi.RegistryWeld>" is in error due to the following reason(s): ** UNRESOLVED Demands 'jboss.j2ee:jar=webdesigner.war,name=RegistryWeldBean,service=EJB3' **
        Deployment "<UNKNOWN jndibinder:WeldPluginBean/local>" is in error due to the following reason(s): ** UNRESOLVED Demands 'jboss.j2ee:jar=webdesigner.war,name=WeldPluginBean,service=EJB3' **
      
           at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:1228) [:2.2.0.Alpha7]
           at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:905) [:2.2.0.Alpha7]
           at org.jboss.system.server.profileservice.deployers.MainDeployerPlugin.checkComplete(MainDeployerPlugin.java:87) [:6.0.0.20100911-M5]
           at org.jboss.profileservice.deployment.ProfileDeployerPluginRegistry.checkAllComplete(ProfileDeployerPluginRegistry.java:118) [:0.1.0.Alpha1]
           at org.jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:133) [:6.0.0.20100911-M5]
           at org.jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:56) [:6.0.0.20100911-M5]
           at org.jboss.bootstrap.impl.base.server.AbstractServer.startBootstraps(AbstractServer.java:827) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]
           at org.jboss.bootstrap.impl.base.server.AbstractServer$StartServerTask.run(AbstractServer.java:417) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]
           at java.lang.Thread.run(Unknown Source) [:1.6.0_22]
      



      The Registration - Observer


      import javax.annotation.PostConstruct;
      import javax.ejb.Singleton;
      import javax.ejb.Startup;
      import javax.enterprise.context.ApplicationScoped;
      import javax.enterprise.event.Observes;
      
      import org.apache.log4j.Logger;
      
      @ApplicationScoped
      @Singleton
      @Startup
      public class RegistryWeldBean implements RegistryWeld {
      
           Logger logger = Logger.getLogger(this.getClass());
           private final String bla = " +++++++++++++++++ ";
           
           public RegistryWeldBean(){
           }
           
           /* (non-Javadoc)
            * @see at.pidas.webdesigner.registry.cdi.RegistryWeld#init()
            */
           @Override
           @PostConstruct
           public void init(){
                logMessage("init");
           }
           
           public void onAnyRegistration(@Observes Registration registration){
                logMessage("Event occured");
                logMessage(registration.getDisplayName());
           }
      



      The Bean that wants to register and fires the event:


      import javax.annotation.PostConstruct;
      import javax.ejb.DependsOn;
      import javax.ejb.Singleton;
      import javax.ejb.Startup;
      import javax.enterprise.context.ApplicationScoped;
      import javax.enterprise.event.Event;
      import javax.inject.Inject;
      
      @DependsOn("RegistryWeldBean")
      @Singleton
      @Startup
      @ApplicationScoped
      public class WeldPluginBean implements WeldPlugin {
           
           @Inject Event<Registration> registrationEvent;
           
           public WeldPluginBean(){
                
           }
           
           /* (non-Javadoc)
            * @see at.pidas.webdesigner.registry.cdi.WeldPlugin#registerPlugin()
            */
           @Override
           @PostConstruct
           public void registerPlugin(){
                Registration regi = new Registration("test", "x.y.displayName");
                registrationEvent.fire(regi);
           }
           
      }
      
      



      Hopefully someone can help, thx!


      Kind regards