4 Replies Latest reply on Aug 28, 2007 5:20 PM by tonylmai

    Calling Seam's component from MDB thew java.lang.IllegalStat

      Hello all,

      I am trying to call a Seam's component from a MDB and I ran into the following exceptions. Can someone tells me what it means and perhaps what could be done?

      Thanks
      -tony


      java.lang.IllegalStateException: Do not start long-running conversations in direct calls to EJBs
      at org.jboss.seam.contexts.Lifecycle.endCall(Lifecycle.java:75)
      at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:117)
      at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:53)
      at sun.reflect.GeneratedMethodAccessor321.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
      at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.aspects.tx.TxPolicy.invokeInNoTx(TxPolicy.java:66)
      at org.jboss.aspects.tx.TxInterceptor$NotSupported.invoke(TxInterceptor.java:112)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.ejb3.mdb.MessagingContainer.localInvoke(MessagingContainer.java:245)
      at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.delivery(MessageInflowLocalProxy.java:268)
      at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.invoke(MessageInflowLocalProxy.java:138)
      at $Proxy291.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:748)
      at java.lang.Thread.run(Unknown Source)






        • 1. Re: Calling Seam's component from MDB thew java.lang.Illegal
          pmuir

          Post your code.

          • 2. Re: Calling Seam's component from MDB thew java.lang.Illegal

            Hi Pete,

            Here is my Seam's component:

            @Scope(ScopeType.APPLICATION)
            @Name("wcTickerPlant")
            @Startup
            @Restrict("#{identity.loggedIn}")
            public class TickerPlant {
             private Map<String, Quote> quotesMap = new ConcurrentHashMap<String, Quote>();
             ...
            
             @Create
             public void refreshQuotes() {
             ....
             }
            
             @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
             public void updateFullQuote(FullQuote quote) {
             quotesMap.put(quote.getSymbol(), new Quote(quote));
             }
            
             ....
            }


            And my MDB

            @MessageDriven(activationConfig = {
             @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Topic")
             , @ActivationConfigProperty(propertyName="destination", propertyValue=ClientConfiguration.MARKET_DATA_TOPIC_NAME)
            // , @ActivationConfigProperty(propertyName="DLQMaxResent", propertyValue="10")
             })
            @Name("quotesListener")
            public class QuoteBroadcastListener implements javax.jms.MessageListener {
             @Logger
             private Log logger;
            
             @In("wcTickerPlant")
             private TickerPlant tickerPlant;
            
             @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
             public void onMessage(Message msg) {
             if (msg == null || !(msg instanceof ObjectMessage)) {
             return;
             }
            
             if (logger != null) {
             logger.debug("Received message as=%1", msg);
             }
             Serializable payload = null;
             try {
             payload = ((ObjectMessage) msg).getObject();
             } catch (JMSException e) {
             if (logger != null) {
             logger.fatal("Unable to obtain payload in msg. Exception=", e.getLocalizedMessage());
             }
             return;
             }
            
             // What type of object is it?
             if (payload instanceof FullQuoteBroadcastMessage) {
             FullQuoteBroadcastMessage fullQuoteMsg = (FullQuoteBroadcastMessage) payload;
             FullQuote fullQuote = fullQuoteMsg.getFullQuote();
             tickerPlant.updateFullQuote(fullQuote);
             } else if (payload instanceof ...) {
             ...
             }
             }
            }


            Let me know if you find anything wrong. Thanks again Pete.
            -tony

            • 3. Re: Calling Seam's component from MDB thew java.lang.Illegal

              Here is the stack trace:


              java.lang.IllegalStateException: Do not start long-running conversations in direct calls to EJBs
              at org.jboss.seam.contexts.Lifecycle.endCall(Lifecycle.java:75)
              at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:117)
              at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:53)
              at sun.reflect.GeneratedMethodAccessor361.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
              at java.lang.reflect.Method.invoke(Unknown Source)
              at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
              at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
              at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
              at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
              at org.jboss.aspects.tx.TxPolicy.invokeInNoTx(TxPolicy.java:66)
              at org.jboss.aspects.tx.TxInterceptor$NotSupported.invoke(TxInterceptor.java:112)
              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
              at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
              at org.jboss.ejb3.mdb.MessagingContainer.localInvoke(MessagingContainer.java:245)
              at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.delivery(MessageInflowLocalProxy.java:268)
              at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.invoke(MessageInflowLocalProxy.java:138)
              at $Proxy291.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:748)
              at java.lang.Thread.run(Unknown Source)


              Is this a Seam's related issue (bug)?

              • 4. Re: Calling Seam's component from MDB thew java.lang.Illegal

                I removed the

                @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)

                from the Seam's component and the error went away.