11 Replies Latest reply on Feb 4, 2010 7:40 AM by Nicklas Karlsson

    Weld Error when creating a Message Driven Bean

    Ian R Newbie

      Hi, I'm having some Weld issues when adding a message driven bean to my EJB project. I'm using JBoss 6.0.0 M1 and whatever Weld version is in that.


      The message driven bean does nothing - here it is:




      @MessageDriven(activationConfig = {
          @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
          @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/NotificationsQueue")})
      public class OptinNotificationProcessor
           implements MessageListener {
      
          /**
           * @see MessageListener#onMessage(Message)
           */
          public void onMessage(Message message) {
           System.out.println("Got a message");
          }
      }
      



      When I start up my application, I get the stack trace at the bottom. Any ideas as to why this might be occurring?


      Thanks,


      Ian


      11:25:52,150 INFO  [Weld/Version] WELD-000900 1.0 (0)
      11:25:52,322 ERROR [AbstractKernelController] Error installing to Create: name=vfsfile:/C:/AAA_Working/Workspaces/OptinPrototype/.metadata/.plugins/org.jboss.ide.eclipse.as.core/JBoss_5.1_Runtime_Server/deploy/Optin.ear/_WeldBootstrapBean state=Configured
      java.lang.NullPointerException
           at org.jboss.weld.ejb.InternalEjbDescriptor.<init>(InternalEjbDescriptor.java:48)
           at org.jboss.weld.ejb.EjbDescriptors.add(EjbDescriptors.java:111)
           at org.jboss.weld.ejb.EjbDescriptors.addAll(EjbDescriptors.java:166)
           at org.jboss.weld.bootstrap.BeanDeployment.<init>(BeanDeployment.java:78)
           at org.jboss.weld.bootstrap.WeldBootstrap$DeploymentVisitor.visit(WeldBootstrap.java:197)
           at org.jboss.weld.bootstrap.WeldBootstrap$DeploymentVisitor.visit(WeldBootstrap.java:174)
           at org.jboss.weld.bootstrap.WeldBootstrap.startContainer(WeldBootstrap.java:295)
           at org.jboss.weld.integration.deployer.env.helpers.BootstrapBean.initialize(BootstrapBean.java:136)
           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:150)
           at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66)
           at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(KernelControllerContextAction.java:243)
           at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:47)
           at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:111)
           at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:72)
           at org.jboss.kernel.plugins.dependency.LifecycleAction.installActionInternal(LifecycleAction.java:221)
           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:348)
           at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1633)
           at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:935)
           at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1083)
           at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:985)
           at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:775)
           at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:540)
           at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:121)
           at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:51)
           at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
           at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
           at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:179)
           at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1448)
           at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1166)
           at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1187)
           at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1107)
           at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
           at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1633)
           at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:935)
           at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1083)
           at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:985)
           at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:823)
           at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
           at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:783)
           at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:699)
           at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
           at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:371)
           at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:256)
           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: Weld Error when creating a Message Driven Bean
          Nicklas Karlsson Master

          The word on the street is that it's fixed in trunk. I think at one point the weld-spi returned null for some interfaces for the MDB descriptor (instead of a collection) and it resulted in that NPE in the InternalEjbDecscriptor constructor when iterating...

          • 2. Re: Weld Error when creating a Message Driven Bean
            Ian R Newbie

            Ok, I found a previous post where you posted a copy of what is on the trunk (somebody else had a problem with an MDB). So I'm using the file weld-core-1.0.1-20100121.211650-46.jar now. However I am now getting another problem, which doesn't seem right.


            I'm trying to access the message driven context (using @Resource private MessageDrivenContext context; to put it in the bean). However I get the following error which seems to me like a classcast error of some kind. To me it looks like it is trying to set a SessionContext to a MessageDrivenContext variable, which of course should fail.


            Any ideas? 


            Regards,


            Ian


            08:40:50,399 ERROR [FieldBeanProperty] failed to set value org.jboss.ejb3.mdb.MessageDrivenContextImpl@18c0a75 on field private javax.ejb.SessionContext org.jboss.weld.integration.ejb.SessionBeanInterceptor.sessionContext
            java.lang.IllegalArgumentException: Can not set javax.ejb.SessionContext field org.jboss.weld.integration.ejb.SessionBeanInterceptor.sessionContext to org.jboss.ejb3.mdb.MessageDrivenContextImpl
                 at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:146)
                 at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:150)
                 at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:63)
                 at java.lang.reflect.Field.set(Field.java:657)
                 at org.jboss.injection.lang.reflect.FieldBeanProperty.set(FieldBeanProperty.java:74)
                 at org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:119)
                 at org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:89)
                 at org.jboss.ejb3.interceptor.InterceptorInjector.inject(InterceptorInjector.java:49)
                 at org.jboss.ejb3.EJBContainer.createInterceptor(EJBContainer.java:328)
                 at org.jboss.ejb3.BaseContext.initialiseInterceptorInstances(BaseContext.java:112)
                 at org.jboss.ejb3.pool.AbstractPool.create(AbstractPool.java:85)
                 at org.jboss.ejb3.pool.AbstractPool.create(AbstractPool.java:73)
                 at org.jboss.ejb3.pool.StrictMaxPool.get(StrictMaxPool.java:146)
                 at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:58)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                 at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
                 at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:194)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                 at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                 at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:80)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                 at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                 at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                 at org.jboss.ejb3.interceptor.EJB3TCCLInterceptor.invoke(EJB3TCCLInterceptor.java:86)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                 at org.jboss.ejb3.mdb.MessagingContainer.localInvoke(MessagingContainer.java:282)
                 at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.delivery(MessageInflowLocalProxy.java:299)
                 at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.invoke(MessageInflowLocalProxy.java:152)
                 at $Proxy855.onMessage(Unknown Source)
                 at org.jboss.resource.adapter.jms.inflow.JmsServerSession.onMessage(JmsServerSession.java:179)
                 at org.jboss.jms.client.container.ClientConsumer.callOnMessageStatic(ClientConsumer.java:160)
                 at org.jboss.jms.client.container.SessionAspect.handleRun(SessionAspect.java:831)
                 at org.jboss.aop.advice.org.jboss.jms.client.container.SessionAspect_z_handleRun_19924817.invoke(SessionAspect_z_handleRun_19924817.java)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                 at org.jboss.jms.client.container.ClosedInterceptor.invoke(ClosedInterceptor.java:170)
                 at org.jboss.aop.advice.PerInstanceInterceptor.invoke(PerInstanceInterceptor.java:86)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                 at org.jboss.jms.client.delegate.ClientSessionDelegate.run(ClientSessionDelegate.java)
                 at org.jboss.jms.client.JBossSession.run(JBossSession.java:199)
                 at org.jboss.resource.adapter.jms.inflow.JmsServerSession.run(JmsServerSession.java:236)
                 at org.jboss.resource.work.WorkWrapper.execute(WorkWrapper.java:205)
                 at org.jboss.util.threadpool.BasicTaskWrapper.run(BasicTaskWrapper.java:260)
                 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)
            08:40:50,399 ERROR [TxPolicy] javax.ejb.EJBTransactionRolledbackException: failed to inject org.jboss.ejb3.mdb.MessageDrivenContextImpl@18c0a75 (implements [interface javax.ejb.MessageDrivenContext]) from env/org.jboss.weld.integration.ejb.SessionBeanInterceptor/sessionContext (link -> java:comp/EJBContext) into org.jboss.weld.integration.ejb.SessionBeanInterceptor.sessionContext of org.jboss.weld.integration.ejb.SessionBeanInterceptor@1ffb00d
            08:40:50,399 ERROR [JmsServerSession] Unexpected error delivering message delegator->JBossMessage[20721265055875093]:PERSISTENT, deliveryId=0
            javax.ejb.EJBTransactionRolledbackException: failed to inject org.jboss.ejb3.mdb.MessageDrivenContextImpl@18c0a75 (implements [interface javax.ejb.MessageDrivenContext]) from env/org.jboss.weld.integration.ejb.SessionBeanInterceptor/sessionContext (link -> java:comp/EJBContext) into org.jboss.weld.integration.ejb.SessionBeanInterceptor.sessionContext of org.jboss.weld.integration.ejb.SessionBeanInterceptor@1ffb00d
                 at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:115)
                 at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:130)
                 at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:194)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                 at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                 at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:80)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                 at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                 at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                 at org.jboss.ejb3.interceptor.EJB3TCCLInterceptor.invoke(EJB3TCCLInterceptor.java:86)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                 at org.jboss.ejb3.mdb.MessagingContainer.localInvoke(MessagingContainer.java:282)
                 at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.delivery(MessageInflowLocalProxy.java:299)
                 at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.invoke(MessageInflowLocalProxy.java:152)
                 at $Proxy855.onMessage(Unknown Source)
                 at org.jboss.resource.adapter.jms.inflow.JmsServerSession.onMessage(JmsServerSession.java:179)
                 at org.jboss.jms.client.container.ClientConsumer.callOnMessageStatic(ClientConsumer.java:160)
                 at org.jboss.jms.client.container.SessionAspect.handleRun(SessionAspect.java:831)
                 at org.jboss.aop.advice.org.jboss.jms.client.container.SessionAspect_z_handleRun_19924817.invoke(SessionAspect_z_handleRun_19924817.java)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                 at org.jboss.jms.client.container.ClosedInterceptor.invoke(ClosedInterceptor.java:170)
                 at org.jboss.aop.advice.PerInstanceInterceptor.invoke(PerInstanceInterceptor.java:86)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                 at org.jboss.jms.client.delegate.ClientSessionDelegate.run(ClientSessionDelegate.java)
                 at org.jboss.jms.client.JBossSession.run(JBossSession.java:199)
                 at org.jboss.resource.adapter.jms.inflow.JmsServerSession.run(JmsServerSession.java:236)
                 at org.jboss.resource.work.WorkWrapper.execute(WorkWrapper.java:205)
                 at org.jboss.util.threadpool.BasicTaskWrapper.run(BasicTaskWrapper.java:260)
                 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)
            Caused by: java.lang.IllegalArgumentException: failed to inject org.jboss.ejb3.mdb.MessageDrivenContextImpl@18c0a75 (implements [interface javax.ejb.MessageDrivenContext]) from env/org.jboss.weld.integration.ejb.SessionBeanInterceptor/sessionContext (link -> java:comp/EJBContext) into org.jboss.weld.integration.ejb.SessionBeanInterceptor.sessionContext of org.jboss.weld.integration.ejb.SessionBeanInterceptor@1ffb00d
                 at org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:139)
                 at org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:89)
                 at org.jboss.ejb3.interceptor.InterceptorInjector.inject(InterceptorInjector.java:49)
                 at org.jboss.ejb3.EJBContainer.createInterceptor(EJBContainer.java:328)
                 at org.jboss.ejb3.BaseContext.initialiseInterceptorInstances(BaseContext.java:112)
                 at org.jboss.ejb3.pool.AbstractPool.create(AbstractPool.java:85)
                 at org.jboss.ejb3.pool.AbstractPool.create(AbstractPool.java:73)
                 at org.jboss.ejb3.pool.StrictMaxPool.get(StrictMaxPool.java:146)
                 at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:58)
                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
                 at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
                 ... 32 more
            Caused by: java.lang.IllegalArgumentException: failed to set value org.jboss.ejb3.mdb.MessageDrivenContextImpl@18c0a75 on field private javax.ejb.SessionContext org.jboss.weld.integration.ejb.SessionBeanInterceptor.sessionContext
                 at org.jboss.injection.lang.reflect.FieldBeanProperty.set(FieldBeanProperty.java:100)
                 at org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:119)
                 ... 42 more
            

            • 3. Re: Weld Error when creating a Message Driven Bean
              Aslak Knutsen Newbie

              This is a bug in the Jboss 6.0.0 M1 Weld Integration. JBAS-7671


              Patch coming shortly, maven just has to finish downloading the internet. :)

              • 4. Re: Weld Error when creating a Message Driven Bean
                Ian R Newbie

                Thanks. Does that mean it's on the Weld trunk now, and how do I get access to it and the patch?


                Thanks,


                Ian

                • 5. Re: Weld Error when creating a Message Driven Bean
                  Pete Muir Master

                  It's not in yet, no (the issue is open still ;-)

                  • 6. Re: Weld Error when creating a Message Driven Bean
                    Ian R Newbie

                    Damn, guess I should have looked at the issue. Hope it gets in soon.


                    (For 80's tragics)


                    I want my....
                    I want my....
                    I want my MDBs

                    • 7. Re: Weld Error when creating a Message Driven Bean
                      Pete Muir Master

                      Ian R wrote on Feb 02, 2010 05:25:


                      Damn, guess I should have looked at the issue. Hope it gets in soon.

                      (For 80's tragics)

                      I want my....
                      I want my....
                      I want my MDBs


                      I applied the patch (mainly because you made me laugh ;-)


                      We'll hopefully integrate the fix into JBoss AS trunk in time for M2.

                      • 8. Re: Weld Error when creating a Message Driven Bean
                        Nicklas Karlsson Master

                        Pete's beatin' on his keyboard like a chimpanzee. That ain't working... ;-)

                        • 9. Re: Weld Error when creating a Message Driven Bean
                          Pete Muir Master

                          Nicklas Karlsson wrote on Feb 02, 2010 14:01:


                          Pete's beatin' on his keyboard like a chimpanzee. That ain't working... ;-)


                          :'-(

                          • 10. Re: Weld Error when creating a Message Driven Bean
                            Ian R Newbie

                            That's the way you do it..... :-)


                            Anyway, thanks for that and I'll keep an eye on the issue and the M2 release. I'm looking forward to that release - I can rid of 20-30 TODOs from my code, because of things I know going into it (mostly the same, just repeats of the same thing).

                            • 11. Re: Weld Error when creating a Message Driven Bean
                              Nicklas Karlsson Master

                              (continuing on the trend):


                              Living on the edge