diff --git a/org.adempiere.server/src/main/server/org/compiere/server/Scheduler.java b/org.adempiere.server/src/main/server/org/compiere/server/Scheduler.java index 75cbf1e2ae..ac9875c14d 100644 --- a/org.adempiere.server/src/main/server/org/compiere/server/Scheduler.java +++ b/org.adempiere.server/src/main/server/org/compiere/server/Scheduler.java @@ -42,6 +42,7 @@ import org.compiere.model.MRole; import org.compiere.model.MScheduler; import org.compiere.model.MSchedulerLog; import org.compiere.model.MSchedulerPara; +import org.compiere.model.MSession; import org.compiere.model.MUser; import org.compiere.print.MPrintFormat; import org.compiere.process.ProcessInfo; @@ -117,6 +118,8 @@ public class Scheduler extends AdempiereServer SimpleDateFormat dateFormat4Timestamp = new SimpleDateFormat("yyyy-MM-dd"); Env.setContext(getCtx(), "#Date", dateFormat4Timestamp.format(ts)+" 00:00:00" ); // JDBC format + //Create new Session and set #AD_Session_ID to context + MSession session = MSession.get(getCtx(), true); MProcess process = new MProcess(getCtx(), scheduler.getAD_Process_ID(), null); try { @@ -136,6 +139,9 @@ public class Scheduler extends AdempiereServer { if (m_trx != null) m_trx.close(); + + session.logout(); + getCtx().remove("#AD_Session_ID"); } //