2 Replies Latest reply on Nov 11, 2010 5:33 AM by antibrumm.mfrey0.bluewin.ch

    Tried to pass Seam component's Session to non-Seam thread, got Exception: in thread "pool-4-thread-2" java.lang.IllegalStateException: No active  application context         at org.jboss.seam.security.EntityPermissionChecker....

    arual
      Hi, guys. I just started to learn Seam/Hibernate, came from C++/SIP world so bear with me if the questions sound naive or wasn't described in perfect J2EE terms. I am working on a project I need use raiseAsynchronousEvent() to call a POJO function, from there I need call another manager who will initialize tasks be done in a multi-thread manner, which is also a POJO. but I need send a Session instance down there, so I passed Seam component's session to the observer and to the muliti-thread manager, which leads to this exception as soon as thread manger's setup() uses the Seam session the first time:

      Exception in thread "pool-4-thread-2" java.lang.IllegalStateException: No active application context
              at org.jboss.seam.security.EntityPermissionChecker.instance(EntityPermis
      sionChecker.java:55)
              at org.jboss.seam.security.HibernateSecurityInterceptor.onLoad(Hibernate
      SecurityInterceptor.java:36)
              at org.hibernate.event.def.DefaultPreLoadEventListener.onPreLoad(Default
      PreLoadEventListener.java:41)
              at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:
      148)

      I tried using Lifecycle.beginCall()/endCall() didn't work. So my question is: is that possible that a non-Seam process uses a passed-in Seam session instance? how do I make this hibernateSecurityInterceptor happy?

      any suggestions are very much appreciated.