Cannot run iBatis query from timer handler
------------------------------------------

                 Key: IBATISNET-279
                 URL: https://issues.apache.org/jira/browse/IBATISNET-279
             Project: iBatis for .NET
          Issue Type: Improvement
          Components: DataMapper
         Environment: .NET 3.5, Windows 2003 Server
            Reporter: Tim Stewart


I'm running an iBatis query within a Timer's Elapsed handler and I'm getting 
the following exception:

 IBatisNet.Common.Exceptions.IBatisNetException was unhandled by user code
  Message="WebSessionStore: Could not obtain reference to HttpContext"
  Source="IBatisNet.DataMapper"
  StackTrace:
       at 
IBatisNet.DataMapper.SessionStore.WebSessionStore.ObtainSessionContext()
       at IBatisNet.DataMapper.SessionStore.WebSessionStore.get_LocalSession()
       at IBatisNet.DataMapper.SqlMapper.QueryForList[T](String statementName, 
Object parameterObject)
       :
       :
       at System.Timers.Timer.MyTimerCallback(Object state)
  InnerException

After looking through the code, I found two places where this exception is 
thrown.  Both look like:

  private static HttpContext ObtainSessionContext()
  {
   HttpContext currentContext = HttpContext.Current;
 
   if (currentContext == null)
   {
    throw new IBatisNetException("WebSessionStore: Could not obtain reference 
to HttpContext");
   }
   return currentContext;
  }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to