<sqlMapConfig
  xmlns="http://ibatis.apache.org/dataMapper"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <!-- 配置参数 -->
  <settings>
    <setting useEmbedStatementParams="false"/>
    <setting cacheModelsEnabled="true"/>
  </settings>
  <!-- 配置数据库驱动文件 -->
  <providers resource="providers.config"/>  <!-- 配置数据源 -->
  <database>
    <provider name="sqlServer2005"/>
    <dataSource name="mysql2005connection"
                connectionString="server=.;uid=sa;pwd=sa;database=ibatistest"/>
  </database></sqlMapConfig>
“/”应用程序中的服务器错误。
--------------------------------------------------------------------------------未将对象引用设置到对象的实例。 
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.NullReferenceException: 未将对象引用设置到对象的实例。源错误: 
行 18:         protected void Button1_Click(object sender, EventArgs e)
行 19:         {
行 20:             SqlMapper map =Mapper.Instance();
行 21:         }
行 22:     }
 源文件: D:\netMvc\ibatis\事例代码\ibatis\Solution1\Web.Ui\Default.aspx.cs    行: 20 堆栈跟踪: 
[NullReferenceException: 未将对象引用设置到对象的实例。]
   IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.ParseGlobalProperties(XmlNode xmlContext) +91
   IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Initialize() +988
   IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Build(XmlDocument document, Boolean useConfigFileWatcher) +75
   IBatisNet.DataMapper.SqlMapper.ConfigureAndWatch(String fileName, ConfigureHandler configureDelegate) +205
   IBatisNet.DataMapper.SqlMapper.ConfigureAndWatch(ConfigureHandler configureDelegate) +42
   IBatisNet.DataMapper.Mapper.InitMapper() +73
   IBatisNet.DataMapper.Mapper.Instance() +100
   Web.Ui._Default.Button1_Click(Object sender, EventArgs e) in D:\netMvc\ibatis\事例代码\ibatis\Solution1\Web.Ui\Default.aspx.cs:20
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565 小弟刚学.net。。参考文档这样配置map为什么会出错
貌似
<sqlMapConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:noNamespaceSchemaLocation="SqlMapConfig.xsd">
换成这个就没什么问题?
这是为什么。。
搞了几天了。。郁闷

解决方案 »

  1.   

    http://hi.baidu.com/peng_jianming/blog/item/871f8e2a82ce839f023bf656.html
      

  2.   

    webconfig  配的是些么事哦  ~~
      

  3.   

    Ibatis 配置
      

  4.   

    <sqlMapConfig
      xmlns="http://ibatis.apache.org/dataMapper"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    为什么我换个这个报的错好像又不同了
    换成这样
    <sqlMapConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xsi:noNamespaceSchemaLocation="SqlMapConfig.xsd">  
    错误:
    “/”应用程序中的服务器错误。
    --------------------------------------------------------------------------------Error while configuring the Provider named "sqlServer2005". Cause : The provider is not in 'providers.config'. 
    说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: IBatisNet.Common.Exceptions.ConfigurationException: Error while configuring the Provider named "sqlServer2005". Cause : The provider is not in 'providers.config'.源错误: 
    行 18:         protected void Button1_Click(object sender, EventArgs e)
    行 19:         {
    行 20:             SqlMapper map =Mapper.Instance();
    行 21:         }
    行 22:     }
     源文件: D:\netMvc\ibatis\事例代码\ibatis\Solution1\Web.Ui\Default.aspx.cs    行: 20 堆栈跟踪: 
    [ConfigurationException: Error while configuring the Provider named "sqlServer2005". Cause : The provider is not in 'providers.config'.]
       IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.ParseProvider(XmlNode node) +261
       IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Initialize() +1088
       IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Build(XmlDocument document, Boolean useConfigFileWatcher) +75
       IBatisNet.DataMapper.SqlMapper.ConfigureAndWatch(String fileName, ConfigureHandler configureDelegate) +205
       IBatisNet.DataMapper.SqlMapper.ConfigureAndWatch(ConfigureHandler configureDelegate) +42
       IBatisNet.DataMapper.Mapper.InitMapper() +73
       IBatisNet.DataMapper.Mapper.Instance() +100
       Web.Ui._Default.Button1_Click(Object sender, EventArgs e) in D:\netMvc\ibatis\事例代码\ibatis\Solution1\Web.Ui\Default.aspx.cs:20
       System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
       System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
       System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
       System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
       System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565 
      

  5.   

    Error while configuring the Provider named "sqlServer2005". Cause : The provider is not in 'providers.config' or is not enabled. 
      
     <!-- 配置数据源 -->
      <database>
        <provider name="sqlServer2005"/>
        <dataSource name="${dataSourceName}"
                 connectionString="server=${server};uid=${user};pwd=${pwd};database=${databaseName}"/>
      </database>
    为什么又会出这样的问题??? 此问题谁碰到过、??? 刚学ibatis
      

  6.   

    老帖啦   晕  你没有把providers.config相应数据库提供者的enabled属性设置为true