You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by "Tim Stewart (JIRA)" <ib...@incubator.apache.org> on 2008/07/21 19:09:31 UTC

[jira] Created: (IBATISNET-279) Cannot run iBatis query from timer handler

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.


[jira] Closed: (IBATISNET-279) Cannot run iBatis query from timer handler

Posted by "Gilles Bayon (JIRA)" <ib...@incubator.apache.org>.
     [ https://issues.apache.org/jira/browse/IBATISNET-279?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gilles Bayon closed IBATISNET-279.
----------------------------------

       Resolution: Invalid
    Fix Version/s: DataMapper 1.6.2
         Assignee: Gilles Bayon

You can used the HybridWebThreadSessionStore 

ISqlMapper mapper = builder.Configure(...);

mapper.SessionStore = new HybridWebThreadSessionStore( sqlMapper.Id );

Set the custom session store once you have build the ISqlMapper and before you use it. 

See IBATISNET-185

> 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
>            Assignee: Gilles Bayon
>             Fix For: DataMapper 1.6.2
>
>
> 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.