Uploaded image for project: 'Seam 2'
  1. Seam 2
  2. JBSEAM-1114

Disable EntitySecurityListener problem in unit tests

    Details

    • Type: Feature Request
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Done
    • Affects Version/s: 1.2.0.GA
    • Fix Version/s: 1.3.0.ALPHA
    • Component/s: None
    • Labels:
      None
    • Environment:

      Windows XP SP2, JBoss AS EJB3 profile 4.0.5.GA

      Description

      When putting to orm.xml config for EntitySecurityListener
      <persistence-unit-metadata>
      <persistence-unit-defaults>
      <entity-listeners>
      <entity-listener class="org.jboss.seam.security.EntitySecurityListener"/>
      </entity-listeners>
      </persistence-unit-defaults>
      </persistence-unit-metadata>

      and trying to run unit tests the following exception is thrown

      java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
      at org.hibernate.ejb.event.ListenerCallback.invoke(ListenerCallback.java:33)
      at org.hibernate.ejb.event.EntityCallbackHandler.callback(EntityCallbackHandler.java:78)
      at org.hibernate.ejb.event.EntityCallbackHandler.postLoad(EntityCallbackHandler.java:71)
      at org.hibernate.ejb.event.EJB3PostLoadEventListener.onPostLoad(EJB3PostLoadEventListener.java:35)
      at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:201)
      at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:842)
      at org.hibernate.loader.Loader.doQuery(Loader.java:717)
      at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
      at org.hibernate.loader.Loader.loadEntity(Loader.java:1785)
      at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:48)
      at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:42)
      at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:2821)
      at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.jav
      a:370)
      at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:351)
      at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:122)
      at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:178)
      at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:86)
      at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:871)
      at org.hibernate.impl.SessionImpl.get(SessionImpl.java:808)
      at org.hibernate.impl.SessionImpl.get(SessionImpl.java:801)
      at org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:155)
      at pl.alternativ.med.pacjent.DeklaracjaPOZUnitTest.utworz(DeklaracjaPOZUnitTest.java:78)
      at org.hibernate.ejb.event.ListenerCallback.invoke(ListenerCallback.java:30)
      ... 42 more
      Caused by: java.lang.IllegalStateException: No active session context
      at org.jboss.seam.security.Identity.instance(Identity.java:108)
      at org.jboss.seam.security.EntitySecurityListener.postLoad(EntitySecurityListener.java:24)
      ... 47 more
      ... Removed 26 stack frames

      Without EntitySecurityListener config in orm.xml tests runs fine.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                shane.bryzak Shane Bryzak
                Reporter:
                artur.chyzy Artur Chyzy
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: