Your issue is most likely in this line:

<sqlMapConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>

 

Notice you have ':xsi' where it is not needed.  It should be like this:

 

<sqlMapConfig 

  xmlns="http://ibatis.apache.org/dataMapper"; 

  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>

 

Regards,


Tom Nguyen 
Sr. Developer
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 



________________________________

From: Phillip S [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 24, 2007 12:07 PM
To: [email protected]
Subject: The error occurred while Validate SqlMap config

 

Team,
 
I am beside myself on this one.  I Spent all morning on it.  I have not
a clue on this.  I am basically trying to create a sample for testing
IBastis.
 
-------------
sqlmap.config
--------------
<?xml version="1.0" encoding="UTF-8" ?>
<sqlMapConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
   <settings>
     <setting cacheModelsEnabled="true"/>
     <setting useStatementNamespaces="false"/>
     <setting validateSqlMap="false"/>
     <setting useReflectionOptimizer="true"/>
   </settings>
   <database>
      <provider name="sqlServer2.0"/>
      <dataSource name="TestServer" connectionString="Data
Source=testdbserver;Initial Catalog=TEST257;user=user1;password=abc123;"
/>
   </database>

   <sqlMaps>
      <sqlMap resource="User.xml"/>
   </sqlMaps>
</sqlMapConfig>
 
-------------
User.xml
-------------
<?xml version="1.0" encoding="UTF-8" ?>
<sqlMap namespace="User"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns="http://ibatis.apache.org/mapping";>
   <alias>
      <typeAlias alias="User" type="QuickStart.Types.User,
QuickStart.Types"/>
   </alias>

   <resultMaps>
      <resultMap id="UserResult" class="User">
         <result property="Id" column="userid"/>
      </resultMap>
   </resultMaps>
   <statements>
      <select id="GetUser" resultMap="UserResult"
parameterClass="String">
      SELECT
       userid
       FROM
       dbo.Users
       <dynamic prepend="WHERE">
          <isParameterPresent>
            userid = #value#
          </isParameterPresent>
        </dynamic>
      </select>
   </statements>
</sqlMap>
 
------------
mapper.cs
------------
using System;
using IBatisNet.Common.Utilities;
using IBatisNet.DataMapper;
using IBatisNet.DataMapper.Configuration;
namespace QuickStart.DataAccess
{
public class Mapper
{
   private static volatile ISqlMapper _mapper = null;
 
   private Mapper() { }
 
   protected static void Configure(object obj)
   {
      _mapper = null;
   }
 
   public static ISqlMapper Get()
   {
      return Instance();
   }
 
   protected static void InitMapper()
   {
      ConfigureHandler handler = new ConfigureHandler(Configure);
      DomSqlMapBuilder builder = new DomSqlMapBuilder();
      _mapper = builder.ConfigureAndWatch(handler);
   }
 
   public static ISqlMapper Instance()
   {
      if (_mapper == null)
      {
         lock (typeof(SqlMapper))
         {
            if (_mapper == null)
           {
               InitMapper();
            }
         }
      }
      return _mapper;
   }
}
}
 
 
-----------
mapperFixture
-----------
[Test]
public void InstanceTest()
{
   ISqlMapper mapper = Mapper.Instance();
}
 
 
I am simply trying to test that I can an instance and all the config
loads fine but instead I get the following:
 
Message: 
- The error occurred while Validate SqlMap config.
Type: IBatisNet.Common.Exceptions.ConfigurationException
Source: IBatisNet.DataMapper
TargetSite: IBatisNet.DataMapper.ISqlMapper
Build(System.Xml.XmlDocument, IBatisNet.Common.DataSource, Boolean,
Boolean)
HelpLink: null
Stack: at
IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Build(XmlDocument
document, DataSource dataSource, Boolean useConfigFileWatcher, Boolean
isCallFromDao)
at
IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.ConfigureAndWatch(St
ring resource, ConfigureHandler configureDelegate)
at
IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.ConfigureAndWatch(Co
nfigureHandler configureDelegate)
at QuickStart.DataAccess.Mapper.InitMapper() in
C:\Development\iBATIS\QuickStart\Source\QuickStart.DataAccess\Mapper.cs:
line 31
at QuickStart.DataAccess.Mapper.Instance() in
C:\Development\iBATIS\QuickStart\Source\QuickStart.DataAccess\Mapper.cs:
line 43
at QuickStart.DataAccess.Test.MapperFixture.InstanceTest() in
C:\Development\iBATIS\QuickStart\Test\QuickStart.DataAccess.Test\MapperF
ixture.cs:line 17
 
The innerr exception is :
Message: Object reference not set to an instance of an object.
Type: System.NullReferenceException
Source: IBatisNet.DataMapper
TargetSite: Void ParseGlobalProperties()
HelpLink: null
Stack: at
IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.ParseGlobalPropertie
s()
at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Initialize()
at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Build(XmlDocument
document, DataSource dataSource, Boolean useConfigFileWatcher, Boolean
isCallFromDao)
 
 
Any help would be greatly appreciated.

________________________________

Recharge--play some free games. Win cool prizes too! Play It!
<http://club.live.com/home.aspx?icid=CLUB_wlmailtextlink> 


************************************************************************************
This e-mail message and any files transmitted herewith, are intended solely for 
the
use of the individual(s) addressed and may contain confidential, proprietary or 
privileged information.  If you are not the addressee indicated in this message 
(or responsible for delivery of this message to such person) you may not 
review, 
use, disclose or distribute this message or any files transmitted herewith.  If 
you 
receive this message in error, please contact the sender by reply e-mail and 
delete
this message and all copies of it from your system.
************************************************************************************

Reply via email to