Hi Les, Sorry for my late reply. I use in memory session store. 1). I don't think subject session expires, because i use embedded spring batch monitoring in my application , and i saw if the job failed with error messages that i send before. I monitor job in same application and user. 2) Maybe this is the root caused. But i have several jobs with high resources usage without any problem.
I still don't have any idea, why a job get an invalid session and another job get a valid session. Do you have any idea how to trace this problem? Thanks On Tue, Jan 22, 2013 at 5:18 AM, Les Hazlewood <[email protected]>wrote: > This will happen if: > > 1) The Subject's session expires or > 2) Something removes or evicts the session record from your session store > (e.g. a cache-based store trying to reclaim space). For example, if you're > using a memory-only session store, you have to ensure that the store does > not run out of space and evict old Session instances. > > For example, if you enable a CacheManager backed by a memory-only store > (e.g. Memcache), you have to ensure that the cache has enough memory to > retain all sessions such that they're not evicted before their > expiration/TTL. > > What storage mechanism are you using to store sessions? > > Cheers, > > -- > Les Hazlewood | @lhazlewood > CTO, Stormpath | http://stormpath.com | @goStormpath | 888.391.5282 > Stormpath wins GigaOM Structure Launchpad Award! http://bit.ly/MvZkMk > > On Fri, Jan 18, 2013 at 2:47 AM, andibaso <[email protected]> wrote: > >> Hi All, >> >> I am working with spring batch and shiro. I save several user information >> in shiro session. After login, i can execute several job before the >> exception below happen. I don't think this is caused by session timeout >> because i set session timeout up to 24 hours. *BusinessRuleEvaluator *is >> just simple class that implements *MethodBeforeAdvice, >> AfterReturningAdvice*, and call to UserUtil.getCurrentUser >> * >> * public synchronized static CoreUser getCurrentUser() { >> >> Subject subject = SecurityUtils.getSubject(); >> >> Session session = (subject == null) ? null : subject.getSession(); >> if (session != null) { >> CoreUser coreUser = (CoreUser) >> session.getAttribute(Constants.CORE_USER); >> return coreUser; >> } else { >> return null; >> } >> } >> * >> * >> And this is my application config >> >> *<aop:config> >> <aop:advisor id="businessRule" >> advice-ref="businessRuleEvaluator" pointcut="execution(* >> *..dao.*Dao.*(..))" order="1"/> >> </aop:config> >> * >> >> >> And this is the exception message : >> >> ERROR - AbstractJob.execute(318) | Encountered fatal error executing job >> org.apache.shiro.session.UnknownSessionException: There is no session >> with id [01e5744d-dd8d-4a3b-8508-5412dc38c618] >> at >> org.apache.shiro.session.mgt.eis.AbstractSessionDAO.readSession(AbstractSessionDAO.java:170) >> at >> org.apache.shiro.session.mgt.DefaultSessionManager.retrieveSessionFromDataSource(DefaultSessionManager.java:236) >> at >> org.apache.shiro.session.mgt.DefaultSessionManager.retrieveSession(DefaultSessionManager.java:222) >> at >> org.apache.shiro.session.mgt.AbstractValidatingSessionManager.doGetSession(AbstractValidatingSessionManager.java:118) >> at >> org.apache.shiro.session.mgt.AbstractNativeSessionManager.lookupSession(AbstractNativeSessionManager.java:105) >> at >> org.apache.shiro.session.mgt.AbstractNativeSessionManager.lookupRequiredSession(AbstractNativeSessionManager.java:109) >> at >> org.apache.shiro.session.mgt.AbstractNativeSessionManager.getAttribute(AbstractNativeSessionManager.java:206) >> at >> org.apache.shiro.session.mgt.DelegatingSession.getAttribute(DelegatingSession.java:141) >> at >> org.apache.shiro.session.ProxiedSession.getAttribute(ProxiedSession.java:121) >> at com.anabatic.egl.util.UserUtil.getCurrentUser(UserUtil.java:49) >> at >> com.anabatic.egl.security.BusinessRuleEvaluator.afterReturning(BusinessRuleEvaluator.java:62) >> at >> org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor.invoke(AfterReturningAdviceInterceptor.java:51) >> at >> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) >> at >> org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:50) >> at >> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) >> at >> org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90) >> at >> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) >> at >> org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:622) >> at >> com.anabatic.egl.dao.impl.DataDefinitionDaoImpl$$EnhancerByCGLIB$$ee849b92.get(<generated>) >> at sun.reflect.GeneratedMethodAccessor252.invoke(Unknown Source) >> at >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) >> at java.lang.reflect.Method.invoke(Method.java:597) >> at >> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318) >> at >> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:196) >> at $Proxy75.get(Unknown Source) >> at >> com.anabatic.egl.batch.listener.LedgerTransactionStagingJobListener.beforeJob(LedgerTransactionStagingJobListener.java:36) >> at >> org.springframework.batch.core.listener.CompositeJobExecutionListener.beforeJob(CompositeJobExecutionListener.java:71) >> at >> org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:290) >> at >> org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:120) >> at >> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) >> at >> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) >> at java.lang.Thread.run(Thread.java:662) >> >> Does anyone have any idea about this is problem?. And FYI, this is not >> happen if i restart tomcat before execute that job, and this is only >> happen if *BusinessRuleEvaluator *is invoked. Another program >> call*UserUtil.getCurrentUser >> *without any problem >> >> Thanks. >> -- >> BR, >> ab.annas >> >> > -- Salam, ab.annas
