3 Replies Latest reply on Nov 17, 2009 2:04 PM by gdfgd eqwe

    Problem with MDB dependent seam component when startup jboss

    Jonah Lee Newbie

      Environment: JBoss 4.2.2.GA, Seam 2.1.0.SP1,Sun JDK 1.5.014, WinXP Pro, MYSQL 5.1

      Basically, we have an MDB that listens on a JMS queue
      and it calls a SEAM component bean that performs
      some business operations. In the case where JBoss was shutdown improperly,
      there are still messages on the queue that are persisted in the
      JMS
      MESSAGES table (we're using the JDBC2 PersistenceManager).  When JBoss
      starts up, the undelivered messages are sent, triggering the MDB, but the
      dependent SEAM component is not yet ready!  Is there a way to reorder this sequence
      of events or is it a bug?  I've attached a stacktrace.




      4:10:17,109 INFO  [SessionFactoryImpl] building session factory
      14:10:17,187 WARN  [CacheFactory] read-only cache configured for mutable class: coupon_ear,coupon_jar,libanet.link.Category
      14:10:18,062 INFO  [SessionFactoryObjectFactory] Factory name: persistence.units:ear=coupon.ear,jar=coupon.jar,unitName=libanet
      14:10:18,062 INFO  [NamingHelper] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
      14:10:18,062 INFO  [SessionFactoryObjectFactory] Bound factory to JNDI name: persistence.units:ear=coupon.ear,jar=coupon.jar,unitName=libanet
      14:10:18,062 WARN  [SessionFactoryObjectFactory] InitialContext did not implement EventContext
      14:10:18,062 INFO  [NamingHelper] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
      14:10:18,171 INFO  [JmxKernelAbstraction] creating wrapper delegate for: org.jboss.ejb3.stateless.StatelessContainer
      14:10:18,171 INFO  [JmxKernelAbstraction] installing MBean: jboss.j2ee:ear=coupon.ear,jar=coupon.jar,name=paymentOrderMessageConsumer,service=EJB3 with dependencies:
      14:10:18,171 INFO  [JmxKernelAbstraction]        persistence.units:ear=coupon.ear,jar=coupon.jar,unitName=libanet
      14:10:18,171 INFO  [JmxKernelAbstraction]        persistence.units:ear=coupon.ear,jar=coupon.jar,unitName=coupon
      14:10:18,359 INFO  [EJBContainer] STARTED EJB: com.liba.link.coupon.jms.PaymentOrderMessageConsumerImpl ejbName: paymentOrderMessageConsumer
      14:10:18,390 INFO  [JmxKernelAbstraction] creating wrapper delegate for: org.jboss.ejb3.mdb.MDB
      14:10:18,390 INFO  [JmxKernelAbstraction] installing MBean: jboss.j2ee:ear=coupon.ear,jar=coupon.jar,name=PaymentOrderTopicReceiver,service=EJB3 with dependencies:
      14:10:18,390 INFO  [JmxKernelAbstraction]          jboss.j2ee:ear=coupon.ear,jar=coupon.jar,name=paymentOrderMessageConsumer,service=EJB3
      14:10:18,406 INFO  [EJBContainer] STARTED EJB: com.liba.link.coupon.jms.PaymentOrderTopicReceiver ejbName: PaymentOrderTopicReceiver
      14:10:18,437 INFO  [JmxKernelAbstraction] creating wrapper delegate for: org.jboss.ejb3.stateless.StatelessContainer
      14:10:18,437 INFO  [JmxKernelAbstraction] installing MBean: jboss.j2ee:ear=coupon.ear,jar=coupon.jar,name=WebstorePointActionImpl,service=EJB3 with dependencies:
      14:10:18,484 INFO  [EJBContainer] STARTED EJB: com.liba.link.supplier.action.WebstorePointActionImpl ejbName: WebstorePointActionImpl
      14:10:18,500 INFO  [EJB3Deployer] Deployed: file:/D:/jboss/server/default/deploy/coupon.ear/coupon.jar/
      14:10:18,546 INFO  [JmxKernelAbstraction] creating wrapper delegate for: org.jboss.ejb3.stateless.StatelessContainer
      14:10:18,546 INFO  [JmxKernelAbstraction] installing MBean: jboss.j2ee:ear=coupon.ear,jar=jboss-seam.jar,name=TimerServiceDispatcher,service=EJB3 with dependencies:
      14:10:18,562 INFO  [EJBContainer] STARTED EJB: org.jboss.seam.async.TimerServiceDispatcher ejbName: TimerServiceDispatcher
      14:10:18,609 INFO  [JmxKernelAbstraction] creating wrapper delegate for: org.jboss.ejb3.stateful.StatefulContainer
      14:10:18,609 INFO  [JmxKernelAbstraction] installing MBean: jboss.j2ee:ear=coupon.ear,jar=jboss-seam.jar,name=EjbSynchronizations,service=EJB3 with dependencies:
      14:10:18,703 INFO  [EJBContainer] STARTED EJB: org.jboss.seam.transaction.EjbSynchronizations ejbName: EjbSynchronizations
      14:10:18,750 ERROR [JmsServerSession] Unexpected error delivering message org.jboss.mq.SpyObjectMessage {
      Header { 
         jmsDestination  : QUEUE.paymentOrder
         jmsDeliveryMode : 2
         jmsExpiration   : 0
         jmsPriority     : 4
         jmsMessageID    : ID:3-12271613845001
         jmsTimeStamp    : 1227161384500
         jmsCorrelationID: null
         jmsReplyTo      : null
         jmsType         : null
         jmsRedelivered  : false
         jmsProperties   : {}
         jmsPropReadWrite: false
         msgReadOnly     : true
         producerClientId: ID:3
      }
      }
      java.lang.RuntimeException: java.lang.IllegalStateException: Attempted to invoke a Seam component outside an initialized application
               at org.jboss.ejb3.interceptor.LifecycleInterceptorHandler.postConstruct(LifecycleInterceptorHandler.java:113)
               at org.jboss.ejb3.EJBContainer.invokePostConstruct(EJBContainer.java:619)
               at org.jboss.ejb3.AbstractPool.create(AbstractPool.java:131)
               at org.jboss.ejb3.StrictMaxPool.get(StrictMaxPool.java:141)
               at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:54)
               at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
               at org.jboss.ejb3.mdb.MessagingContainer.localInvoke(MessagingContainer.java:249)
               at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.delivery(MessageInflowLocalProxy.java:268)
               at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.invoke(MessageInflowLocalProxy.java:138)
               at $Proxy130.onMessage(Unknown Source)
               at org.jboss.resource.adapter.jms.inflow.JmsServerSession.onMessage(JmsServerSession.java:178)
               at org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:891)
               at org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:170)
               at org.jboss.mq.SpySession.run(SpySession.java:323)
               at org.jboss.resource.adapter.jms.inflow.JmsServerSession.run(JmsServerSession.java:237)
               at org.jboss.resource.work.WorkWrapper.execute(WorkWrapper.java:204)
               at org.jboss.util.threadpool.BasicTaskWrapper.run(BasicTaskWrapper.java:275)
               at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:756)
               at java.lang.Thread.run(Unknown Source)
      Caused by: java.lang.IllegalStateException: Attempted to invoke a Seam component outside an initialized application
               at org.jboss.seam.contexts.Lifecycle.getApplication(Lifecycle.java:36)
               at org.jboss.seam.contexts.Lifecycle.mockApplication(Lifecycle.java:111)
               at org.jboss.seam.Seam.componentForName(Seam.java:298)
               at org.jboss.seam.intercept.SessionBeanInterceptor.postConstruct(SessionBeanInterceptor.java:102)
               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
               at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
               at java.lang.reflect.Method.invoke(Unknown Source)
               at org.jboss.ejb3.interceptor.LifecycleInvocationContextImpl.proceed(LifecycleInvocationContextImpl.java:131)
               at org.jboss.ejb3.interceptor.LifecycleInterceptorHandler.postConstruct(LifecycleInterceptorHandler.java:109)
               ... 18 more
      14:10:18,750 ERROR [JmsServerSession] Unexpected error delivering message org.jboss.mq.SpyObjectMessage {