2 Replies Latest reply on Apr 24, 2007 6:40 AM by Dan Liu

    orm.xml causes No active session context

    Dan Liu Apprentice

      I have a java SWT client that accesses my ejb remotely. If orm.xml is packed into my ejb.jar, I keep getting No active session context when trying to access my ejb method remotely.

      Caused by: java.lang.IllegalStateException: No active session context
       at org.jboss.seam.security.Identity.instance(Identity.java:106)
       at org.jboss.seam.security.EntitySecurityListener.postLoad(EntitySecurityListener.java:24)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.hibernate.ejb.event.ListenerCallback.invoke(ListenerCallback.java:31)
       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:33)
       at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:201)
       at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:854)
       at org.hibernate.loader.Loader.doQuery(Loader.java:729)
       at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
       at org.hibernate.loader.Loader.doList(Loader.java:2220)
       at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
       at org.hibernate.loader.Loader.list(Loader.java:2099)
       at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
       at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
       at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
       at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
       at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
       at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:66)
       at com.example.admin.bo.WebServiceHandlerImpl.downloadData(WebServiceHandlerImpl.java:136)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
       at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
       at org.jboss.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:37)
       at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:98)
       at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:53)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       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:46)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
       at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
       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.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
       at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:102)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:263)
       at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
       at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
       at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:828)
       at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:681)
       at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:358)
       at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:412)
       at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:239)
       at org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.java:190)
       at org.jboss.remoting.Client.invoke(Client.java:525)
       at org.jboss.remoting.Client.invoke(Client.java:488)
       at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:61)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:55)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:77)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:102)
       at $Proxy0.downloadSpecifiedRests(Unknown Source)
       at com.example.staff.client.gps.MenuEditorUI.refresh(MenuEditorUI.java:229)
       at com.example.staff.client.gps.MenuEditorUI.access$4(MenuEditorUI.java:221)
       at com.example.staff.client.gps.MenuEditorUI$2.keyReleased(MenuEditorUI.java:153)
       at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:128)
       at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
       at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
       at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:952)
       at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:937)
       at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:965)
       at org.eclipse.swt.widgets.Text.sendKeyEvent(Text.java:1213)
       at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:961)
       at org.eclipse.swt.widgets.Widget.wmKeyUp(Widget.java:1660)
       at org.eclipse.swt.widgets.Control.WM_KEYUP(Control.java:3571)
       at org.eclipse.swt.widgets.Control.windowProc(Control.java:3276)
       at org.eclipse.swt.widgets.Text.windowProc(Text.java:1841)
       at org.eclipse.swt.widgets.Display.windowProc(Display.java:4025)
       at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
       at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1923)
       at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2966)
       at com.example.staff.client.gps.GpsImportUI.show(GpsImportUI.java:35)
       at startup.StaffGpsOnly.main(StaffGpsOnly.java:16)
       at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:73)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:55)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:77)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:102)
       at $Proxy0.downloadSpecifiedRests(Unknown Source)
       at com.example.staff.client.gps.MenuEditorUI.refresh(MenuEditorUI.java:229)
       at com.example.staff.client.gps.MenuEditorUI.access$4(MenuEditorUI.java:221)
       at com.example.staff.client.gps.MenuEditorUI$2.keyReleased(MenuEditorUI.java:153)
       at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:128)
       at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
       at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
       at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:952)
       at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:937)
       at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:965)
       at org.eclipse.swt.widgets.Text.sendKeyEvent(Text.java:1213)
       at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:961)
       at org.eclipse.swt.widgets.Widget.wmKeyUp(Widget.java:1660)
       at org.eclipse.swt.widgets.Control.WM_KEYUP(Control.java:3571)
       at org.eclipse.swt.widgets.Control.windowProc(Control.java:3276)
       at org.eclipse.swt.widgets.Text.windowProc(Text.java:1841)
       at org.eclipse.swt.widgets.Display.windowProc(Display.java:4025)
       at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
       at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1923)
       at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2966)
       at com.example.staff.client.ImportUI.show(GpsImportUI.java:35)
       at startup.StaffGpsOnly.main(StaffGpsOnly.java:16)
      


      Any idea?

        • 1. Re: orm.xml causes No active session context
          Dan Liu Apprentice

          Sorry I should say it's cause by "EntitySecurityListener", Here is my content in orm.xml

          <?xml version="1.0" encoding="UTF-8"?>
          <entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"
           version="1.0">
          
           <persistence-unit-metadata>
           <persistence-unit-defaults>
           <entity-listeners>
           <entity-listener class="org.jboss.seam.security.EntitySecurityListener"/>
           </entity-listeners>
           </persistence-unit-defaults>
           </persistence-unit-metadata>
          
          </entity-mappings>
          


          • 2. Re: orm.xml causes No active session context
            Dan Liu Apprentice

            Has anyone had the same problem?