6 Replies Latest reply on Oct 26, 2006 1:37 PM by monkeyden

    Application scope SFSB

    monkeyden

      I am using an APPLICATION scope Seam component (SFSB) to manage some configuration data:

      @Stateful
      @Name("appConfig")
      @Scope(APPLICATION)
      
      public class ConfigurationManagerBean implements ConfigurationManager, Serializable {
       ...
      }


      I'm using this componet within several other Seam components. Can I be sure that there is a single instance in service or is there something else I need to do? Will hashCode() on the tell me, or does that just give me the hashCode of the reference I'm holding?

        • 1. Re: Application scope SFSB
          gavin.king

          There will be one instance, but make sure you add an @Synchronized annotation, since SFSBs do not support concurrent calls.

          • 2. Re: Application scope SFSB
            monkeyden

            In which jar is that located? I don't see it in 1.0.1.

            • 3. Re: Application scope SFSB
              monkeyden

              Looks like a nightly build. Appears to be new as of your comment on 10/12.

              http://jira.jboss.org/jira/browse/JBSEAM-95

              • 4. Re: Application scope SFSB
                monkeyden

                Couple questions:

                1. It appears that I can't get the @Synchronized annotation without upgrading to Seam 1.1BETA. Is JBossAS 4.0.5 required for Seam 1.1BETA?

                2. Gavin, you wrote in another thread that an APPLICATION scoped Seam component must be a JavaBean, not a SessionBean. I assume this is due to the "no concurrent method calls rule." Is this not true when using the new @Synchronized annotation?

                • 5. Re: Application scope SFSB
                  gavin.king

                  (1) No, it can work in 4.0.4, afaik.
                  (2) It should be safe if you use @Synchronized

                  • 6. Re: Application scope SFSB
                    monkeyden

                    (2) Does it go on the interface or the implementation?

                    After trying (1), I received this exception. It seems pretty innocuous though.

                    13:08:37,297 DEBUG [JDBCStateManager] Starting jboss.mq:service=StateManager
                    13:08:37,453 DEBUG [JDBCStateManager] Started jboss.mq:service=StateManager
                    13:08:37,453 DEBUG [PersistenceManager] Starting jboss.mq:service=PersistenceManager
                    13:08:37,453 DEBUG [PersistenceManager] Creating Schema
                    13:08:37,469 DEBUG [PersistenceManager] Could not create table with SQL: CREATE CACHED TABLE JMS_MESSAGES ( MESSAGEID INTEGER NOT NULL, DESTINATION VARCHAR(255) NOT NULL, TXID INTEGER, TXOP CHAR(1), MESSAGEBLOB OBJECT, PRIMARY KEY (MESSAGEID, DESTINATION) )
                    java.sql.SQLException: Table already exists: JMS_MESSAGES in statement [CREATE CACHED TABLE JMS_MESSAGES]
                     at org.hsqldb.jdbc.Util.throwError(Lorg.hsqldb.Result;)V(Unknown Source)
                     at org.hsqldb.jdbc.jdbcPreparedStatement.executeUpdate()I(Unknown Source)
                     at org.jboss.resource.adapter.jdbc.CachedPreparedStatement.executeUpdate(CachedPreparedStatement.java:95)
                     at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:251)
                     at org.jboss.mq.pm.jdbc2.PersistenceManager.createSchema(PersistenceManager.java:259)
                     at org.jboss.mq.pm.jdbc2.PersistenceManager.startService(PersistenceManager.java:1563)
                     at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
                     at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
                     at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown Source)
                     at java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;I)Ljava.lang.Object;(Unknown Source)
                     at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
                     at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
                     at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
                     at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
                     at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
                     at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
                     at $Proxy0.start()V(Unknown Source)
                     at org.jboss.system.ServiceController.start(ServiceController.java:417)
                     at org.jboss.system.ServiceController.start(ServiceController.java:435)
                     at org.jboss.system.ServiceController.start(ServiceController.java:435)
                     at org.jboss.system.ServiceController.start(ServiceController.java:435)
                     at org.jboss.system.ServiceController.start(ServiceController.java:435)
                     at org.jboss.system.ServiceController.start(ServiceController.java:435)
                     at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown Source)
                     at java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;I)Ljava.lang.Object;(Unknown Source)
                     at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
                    13:08:37,469 DEBUG [PersistenceManager] Could not create table with SQL: CREATE CACHED TABLE JMS_TRANSACTIONS ( TXID INTEGER, PRIMARY KEY (TXID) )
                    java.sql.SQLException: Table already exists: JMS_TRANSACTIONS in statement [CREATE CACHED TABLE JMS_TRANSACTIONS]
                     at org.hsqldb.jdbc.Util.throwError(Lorg.hsqldb.Result;)V(Unknown Source)
                     at org.hsqldb.jdbc.jdbcPreparedStatement.executeUpdate()I(Unknown Source)
                     at org.jboss.resource.adapter.jdbc.CachedPreparedStatement.executeUpdate(CachedPreparedStatement.java:95)
                     at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:251)
                     at org.jboss.mq.pm.jdbc2.PersistenceManager.createSchema(PersistenceManager.java:331)
                     at org.jboss.mq.pm.jdbc2.PersistenceManager.startService(PersistenceManager.java:1563)
                     at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
                     at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
                     at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown Source)
                     at java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;I)Ljava.lang.Object;(Unknown Source)
                     at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
                     at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
                     at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
                     at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
                     at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
                     at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
                     at $Proxy0.start()V(Unknown Source)
                     at org.jboss.system.ServiceController.start(ServiceController.java:417)
                     at org.jboss.system.ServiceController.start(ServiceController.java:435)
                     at org.jboss.system.ServiceController.start(ServiceController.java:435)
                     at org.jboss.system.ServiceController.start(ServiceController.java:435)
                     at org.jboss.system.ServiceController.start(ServiceController.java:435)
                     at org.jboss.system.ServiceController.start(ServiceController.java:435)
                     at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown Source)
                     at java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;I)Ljava.lang.Object;(Unknown Source)
                     at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
                    13:08:37,469 DEBUG [PersistenceManager] Resolving uncommited TXS
                    13:08:37,531 DEBUG [PersistenceManager] Started jboss.mq:service=PersistenceManager
                    13:08:37,547 DEBUG [DestinationManager] Starting jboss.mq:service=DestinationManager
                    13:08:37,547 DEBUG [DestinationManager] Started jboss.mq:service=DestinationManager