6 Replies Latest reply on Feb 19, 2010 2:56 PM by jaikiran pai

    Session Beans and Weld

    Juergen Zimmermann Master

      Using JBossAS 6.0.0.M2 a stateless session bean shall access a Weld bean. Basically I'm thinking of:

       

      @Stateless
      public class Slsb {
         @PersistenceContext
         private EntityManager em;

         @Named
         private MyDao dao;
         ...
      }

       

      @Named
      public class MyDao {
         @PersistenceContext
         private EntityManager em;
         ...
      }

       

      MyDao shall reuse the EntityManager of Slsb, and transaction shall be started in methods of Slsb. However, this doesn't work and I get a stacktrace (and no "previous" errors):

       

      14:10:58,012 WARN  [org.jboss.weld.Servlet] WELD-000700 Not starting Weld/Servlet integration as Weld failed to initialize
      14:10:58,118 WARN  [org.jboss.system.server.profileservice.hotdeploy.HDScanner] Failed to process changes: org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):

      DEPLOYMENTS MISSING DEPENDENCIES:
        Deployment "jboss.j2ee:ear=hska.ear,jar=hskaEJB.jar,name=Bestellverwaltung,service=EJB3" is missing the following dependencies:
          Dependency "<UNKNOWN jboss.j2ee:ear=hska.ear,jar=hskaEJB.jar,name=Bestellverwaltung,service=EJB3>" (should be in state "Installed", but is actually in state "** UNRESOLVED Demands 'jndi:hska/BestellverwaltungDao/no-interface' **")
        Deployment "jboss.j2ee:ear=hska.ear,jar=hskaEJB.jar,name=Bestellverwaltung,service=EJB3_endpoint" is missing the following dependencies:
          Dependency "jboss.j2ee:ear=hska.ear,jar=hskaEJB.jar,name=Bestellverwaltung,service=EJB3" (should be in state "Installed", but is actually in state "PreInstall")
        Deployment "jboss.j2ee:ear=hska.ear,jar=hskaEJB.jar,name=BestellverwaltungDao,service=EJB3" is missing the following dependencies:
          Dependency "<UNKNOWN jboss.j2ee:ear=hska.ear,jar=hskaEJB.jar,name=BestellverwaltungDao,service=EJB3>" (should be in state "Installed", but is actually in state "** UNRESOLVED Demands 'Class:de.hska.kundenverwaltung.db.KundenverwaltungDao' **")
        Deployment "jboss.j2ee:ear=hska.ear,jar=hskaEJB.jar,name=BestellverwaltungDao,service=EJB3_endpoint" is missing the following dependencies:
          Dependency "jboss.j2ee:ear=hska.ear,jar=hskaEJB.jar,name=BestellverwaltungDao,service=EJB3" (should be in state "Installed", but is actually in state "PreInstall")
        Deployment "jboss.j2ee:ear=hska.ear,jar=testHskaEJB.jar,name=BestellverwaltungTestBean,service=EJB3" is missing the following dependencies:
          Dependency "<UNKNOWN jboss.j2ee:ear=hska.ear,jar=testHskaEJB.jar,name=BestellverwaltungTestBean,service=EJB3>" (should be in state "Installed", but is actually in state "** UNRESOLVED Demands 'jndi:hska/Bestellverwaltung/no-interface' **")
        Deployment "jboss.j2ee:ear=hska.ear,jar=testHskaEJB.jar,name=BestellverwaltungTestBean,service=EJB3_endpoint" is missing the following dependencies:
          Dependency "jboss.j2ee:ear=hska.ear,jar=testHskaEJB.jar,name=BestellverwaltungTestBean,service=EJB3" (should be in state "Installed", but is actually in state "PreInstall")
        Deployment "vfsfile:/C:/Users/Public/Documents/eclipse-workspace-swe2/.metadata/.plugins/org.jboss.ide.eclipse.as.core/JBoss_6.0_Runtime_Server1266414248806/deploy/hska.ear/_WBInjector" is missing the following dependencies:
          Dependency "vfsfile:/C:/Users/Public/Documents/eclipse-workspace-swe2/.metadata/.plugins/org.jboss.ide.eclipse.as.core/JBoss_6.0_Runtime_Server1266414248806/deploy/hska.ear/_WeldBootstrapBean" (should be in state "Installed", but is actually in state "Create")
        Deployment "vfsfile:/C:/Users/Public/Documents/eclipse-workspace-swe2/.metadata/.plugins/org.jboss.ide.eclipse.as.core/JBoss_6.0_Runtime_Server1266414248806/deploy/hska.ear/_WeldBootstrapBean" is missing the following dependencies:
          Dependency "jboss.j2ee:ear=hska.ear,jar=testHskaEJB.jar,name=BestellverwaltungTestBean,service=EJB3" (should be in state "Start", but is actually in state "PreInstall")
          Dependency "jboss.j2ee:ear=hska.ear,jar=hskaEJB.jar,name=Bestellverwaltung,service=EJB3" (should be in state "Start", but is actually in state "PreInstall")
          Dependency "jboss.j2ee:ear=hska.ear,jar=hskaEJB.jar,name=BestellverwaltungDao,service=EJB3" (should be in state "Start", but is actually in state "PreInstall")
        Deployment "vfsfile:/C:/Users/Public/Documents/eclipse-workspace-swe2/.metadata/.plugins/org.jboss.ide.eclipse.as.core/JBoss_6.0_Runtime_Server1266414248806/deploy/hska.ear/hskaEJB.jar/$Bestellverwaltung" is missing the following dependencies:
          Dependency "jboss.j2ee:ear=hska.ear,jar=hskaEJB.jar,name=Bestellverwaltung,service=EJB3" (should be in state "Described", but is actually in state "PreInstall")
        Deployment "vfsfile:/C:/Users/Public/Documents/eclipse-workspace-swe2/.metadata/.plugins/org.jboss.ide.eclipse.as.core/JBoss_6.0_Runtime_Server1266414248806/deploy/hska.ear/hskaEJB.jar/$BestellverwaltungDao" is missing the following dependencies:
          Dependency "jboss.j2ee:ear=hska.ear,jar=hskaEJB.jar,name=BestellverwaltungDao,service=EJB3" (should be in state "Described", but is actually in state "PreInstall")

      DEPLOYMENTS IN ERROR:
        Deployment "<UNKNOWN jboss.j2ee:ear=hska.ear,jar=hskaEJB.jar,name=Bestellverwaltung,service=EJB3>" is in error due to the following reason(s): ** UNRESOLVED Demands 'jndi:hska/BestellverwaltungDao/no-interface' **
        Deployment "<UNKNOWN jboss.j2ee:ear=hska.ear,jar=testHskaEJB.jar,name=BestellverwaltungTestBean,service=EJB3>" is in error due to the following reason(s): ** UNRESOLVED Demands 'jndi:hska/Bestellverwaltung/no-interface' **
        Deployment "<UNKNOWN jboss.j2ee:ear=hska.ear,jar=hskaEJB.jar,name=BestellverwaltungDao,service=EJB3>" is in error due to the following reason(s): ** UNRESOLVED Demands 'Class:de.hska.kundenverwaltung.db.KundenverwaltungDao' **

      at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:1198)
      at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:1144)
      at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:848)
      at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.checkComplete(MainDeployerAdapter.java:128)
      at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:416)
      at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:294)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
      at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
      at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:619)

        • 1. Re: Session Beans and Weld
          Juergen Zimmermann Master
          Typo: The first @Named should be @Inject
          • 2. Re: Session Beans and Weld
            jaikiran pai Master

            You seem to be doing a CDI @Inject in a SLSB with a no-interface view. AFAIK, support for CDI in a no-interface view SLSB isn't available in 6.0.0.M2. You might want to ask this in the Weld forums.

            • 3. Re: Session Beans and Weld
              Juergen Zimmermann Master

              I had to change @PersistenceContext to @PersistenceContext(unitName="myPersistenceUnit").

               

              But now I get the following NPE. Should I file a JIRA issue for EJBTHREE ?

               

              10:11:39,203 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] Error installing to Start: name=vfsfile:/C:/Users/Public/Documents/eclipse-workspace-swe2/.metadata/.plugins/org.jboss.ide.eclipse.as.core/JBoss_6.0_Runtime_Server1266414248806/deploy/hska.ear/_WeldBootstrapBean state=Create:

              java.lang.NullPointerException

              at org.jboss.ejb3.nointerface.impl.view.factory.JavassistNoInterfaceViewFactory$NoInterfaceViewProxyFactoryClassLoaderProvider.get(

              JavassistNoInterfaceViewFactory.java:114)

              at javassist.util.proxy.ProxyFactory.getClassLoader(

              ProxyFactory.java:426)

              at javassist.util.proxy.ProxyFactory.createClass(

              ProxyFactory.java:270)

              at org.jboss.weld.util.Proxies.createProxyClass(

              Proxies.java:187)

              at org.jboss.weld.util.Proxies.createProxy(

              Proxies.java:154)

              at org.jboss.weld.bean.builtin.ee.AbstractEEBean.<init>(

              AbstractEEBean.java:53)

              at org.jboss.weld.bean.builtin.ee.UserTransactionBean.<init>(

              UserTransactionBean.java:66)

              at org.jboss.weld.bootstrap.BeanDeployment.deployBeans(

              BeanDeployment.java:140)

              at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(

              WeldBootstrap.java:377)

              at org.jboss.weld.integration.deployer.env.helpers.BootstrapBean.boot(

              BootstrapBean.java:121)

              at sun.reflect.NativeMethodAccessorImpl.invoke0(

              Native Method)

              at sun.reflect.NativeMethodAccessorImpl.invoke(

              NativeMethodAccessorImpl.java:39)

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(

              DelegatingMethodAccessorImpl.java:25)

              at java.lang.reflect.Method.invoke(

              Method.java:597)

              at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(

              ReflectionUtils.java:59)

              at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(

              ReflectMethodInfoImpl.java:151)

              at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(

              BasicMethodJoinPoint.java:66)

              at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(

              KernelControllerContextAction.java:257)

              at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(

              ExecutionWrapper.java:47)

              at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(

              KernelControllerContextAction.java:125)

              at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(

              KernelControllerContextAction.java:72)

              at org.jboss.kernel.plugins.dependency.LifecycleAction.installActionInternal(

              LifecycleAction.java:202)

              at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(

              InstallsAwareAction.java:54)

              at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(

              InstallsAwareAction.java:42)

              at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(

              SimpleControllerContextAction.java:62)

              at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(

              AccessControllerContextAction.java:71)

              at org.jboss.dependency.plugins.AbstractControllerContextActions.install(

              AbstractControllerContextActions.java:51)

              at org.jboss.dependency.plugins.AbstractControllerContext.install(

              AbstractControllerContext.java:378)

              at org.jboss.dependency.plugins.AbstractController.install(

              AbstractController.java:2029)

              at org.jboss.dependency.plugins.AbstractController.incrementState(

              AbstractController.java:1050)

              at org.jboss.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(

              AbstractController.java:1289)

              at org.jboss.dependency.plugins.AbstractController.resolveContexts(

              AbstractController.java:1213)

              at org.jboss.dependency.plugins.AbstractController.resolveContexts(

              AbstractController.java:1107)

              at org.jboss.dependency.plugins.AbstractController.change(

              AbstractController.java:918)

              at org.jboss.dependency.plugins.AbstractController.change(

              AbstractController.java:633)

              at org.jboss.system.ServiceController.doChange(

              ServiceController.java:671)

              at org.jboss.system.ServiceController.start(

              ServiceController.java:443)

              at org.jboss.system.deployers.ServiceDeployer.start(

              ServiceDeployer.java:189)

              at org.jboss.system.deployers.ServiceDeployer.deploy(

              ServiceDeployer.java:102)

              at org.jboss.system.deployers.ServiceDeployer.deploy(

              ServiceDeployer.java:49)

              at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(

              AbstractSimpleRealDeployer.java:62)

              at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(

              AbstractRealDeployer.java:55)

              at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(

              DeployerWrapper.java:179)

              at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(

              DeployersImpl.java:1660)

              at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(

              DeployersImpl.java:1378)

              at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(

              DeployersImpl.java:1399)

              at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(

              DeployersImpl.java:1431)

              at org.jboss.deployers.plugins.deployers.DeployersImpl.install(

              DeployersImpl.java:1319)

              at org.jboss.dependency.plugins.AbstractControllerContext.install(

              AbstractControllerContext.java:378)

              at org.jboss.dependency.plugins.AbstractController.install(

              AbstractController.java:2029)

              at org.jboss.dependency.plugins.AbstractController.incrementState(

              AbstractController.java:1050)

              at org.jboss.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(

              AbstractController.java:1289)

              at org.jboss.dependency.plugins.AbstractController.resolveContexts(

              AbstractController.java:1213)

              at org.jboss.dependency.plugins.AbstractController.resolveContexts(

              AbstractController.java:1107)

              at org.jboss.dependency.plugins.AbstractController.change(

              AbstractController.java:918)

              at org.jboss.dependency.plugins.AbstractController.change(

              AbstractController.java:633)

              at org.jboss.deployers.plugins.deployers.DeployersImpl.process(

              DeployersImpl.java:898)

              at org.jboss.deployers.plugins.main.MainDeployerImpl.process(

              MainDeployerImpl.java:677)

              at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(

              MainDeployerAdapter.java:117)

              at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(

              HDScanner.java:409)

              at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(

              HDScanner.java:294)

              at java.util.concurrent.Executors$RunnableAdapter.call(

              Executors.java:441)

              at java.util.concurrent.FutureTask$Sync.innerRunAndReset(

              FutureTask.java:317)

              at java.util.concurrent.FutureTask.runAndReset(

              FutureTask.java:150)

              at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(

              ScheduledThreadPoolExecutor.java:98)

              at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(

              ScheduledThreadPoolExecutor.java:181)

              at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(

              ScheduledThreadPoolExecutor.java:205)

              at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(

              ThreadPoolExecutor.java:886)

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(

              ThreadPoolExecutor.java:908)

              at java.lang.Thread.run(

              Thread.java:619)

              • 4. Re: Session Beans and Weld
                jaikiran pai Master

                Juergen.Zimmermann wrote:

                 

                 

                 

                But now I get the following NPE. Should I file a JIRA issue for EJBTHREE ?

                 

                Looking at the stacktrace, it appears to be originating from weld bootstrap and ultimately ending up in the nointerface view EJB3 integration layer. Please create a JIRA in EJBTHREE. I'll take a look.

                • 6. Re: Session Beans and Weld
                  jaikiran pai Master

                  Thanks for filing the JIRA. I'll take a look later this weekend/Monday.