List Info

Thread: The error occurred while Validate SqlMap config




The error occurred while Validate SqlMap config
country flaguser name
United States
2007-08-24 12:06:41
 
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" ?>
&lt;
sqlMapConfig xmlnssi="http://www.w3.org/2001/XMLSchema-instance">
&nbsp;  <
settings>
&nbsp; &nbsp;  <
setting cacheModelsEnabled="true"/>
&nbsp; &nbsp;  <
setting useStatementNamespaces="false"/>
&nbsp; &nbsp;  <
setting validateSqlMap="false"/>
&nbsp; &nbsp;  <
setting useReflectionOptimizer="true"/>
&nbsp;  </
settings>
 &nbsp; <
database>
&nbsp; &nbsp; &nbsp; <
provider name="sqlServer2.0"/>
&nbsp; &nbsp;   <
dataSource name="TestServer" connectionString="Data Source=testdbserver;Initial Catalog=TEST257;user=user1;password=abc123;" />
&nbsp;  </
database>

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

  ; <
resultMaps>
&nbsp; &nbsp; &nbsp; <
resultMap id="UserResult" class="User">
&nbsp; &nbsp; &nbsp;   ; <
result property="Id" column="userid"/>
&nbsp; &nbsp;   </
resultMap>
&nbsp;  </
resultMaps>
&nbsp;  <
statements>
&nbsp; &nbsp; &nbsp; <
select id="GetUser" resultMap="UserResult" parameterClass="String">
 &nbsp; &nbsp;  SELECT
&nbsp;   ; &nbsp; userid
&nbsp;   ; &nbsp; FROM
&nbsp; &nbsp; &nbsp;  dbo.Users
 &nbsp; &nbsp;   <dynamic prepend="WHERE">
&nbsp; &nbsp; &nbsp;   ;  <
isParameterPresent>
 &nbsp; &nbsp;   ; &nbsp; &nbsp; userid&nbsp;= #value#
 &nbsp; &nbsp;   ; &nbsp; </isParameterPresent>
&nbsp; &nbsp; &nbsp;   </
dynamic>
&nbsp; &nbsp; &nbsp; </
select>
&nbsp;  </
statements>
<;/
sqlMap>
 
------------
mapper.cs
------------
using System;
using IBatisNet.Common.Utilities;
using IBatisNet.DataMapper;
using IBatisNet.DataMapper.Configuration;
namespace QuickStart.DataAccess
{
public class Mapper
{
&nbsp; 
private static volatile ISqlMapper _mapper = null;
 
 &nbsp; private Mapper() { }
 
 &nbsp; protected static void Configure(object obj)
&nbsp;  {
   ; &nbsp; _mapper =
null;
   }
 
 &nbsp; public static ISqlMapper Get()
&nbsp;  {
 &nbsp; &nbsp;  return Instance();
 &nbsp; }
 
 &nbsp; protected static void InitMapper()
   {
 &nbsp; &nbsp;  ConfigureHandler handler = new ConfigureHandler(Configure);
 &nbsp; &nbsp;  DomSqlMapBuilder builder = new DomSqlMapBuilder();
&nbsp; &nbsp; &nbsp; _mapper = builder.ConfigureAndWatch(handler);
 ;  }
 
 &nbsp; public static ISqlMapper Instance()
 &nbsp; {
 &nbsp; &nbsp;  if (_mapper == null)
   ; &nbsp; {
 &nbsp; &nbsp; &nbsp; &nbsp; lock (typeof(SqlMapper))
 ; &nbsp; &nbsp; &nbsp;  {
 &nbsp; &nbsp; &nbsp; &nbsp;   ; if (_mapper == null)
   ; &nbsp; &nbsp; &nbsp;  {
   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; InitMapper();
 ; &nbsp; &nbsp; &nbsp; &nbsp;   }
   ; &nbsp; &nbsp;  }
   ; &nbsp; }
 &nbsp; &nbsp;  return _mapper;
 &nbsp; }
}
}
 
 
-----------
mapperFixture
-----------
[Test]
public void InstanceTest()
{
 &nbsp; ISqlMapper mapper = Mapper.Instance();
}
&nbsp;
&nbsp;
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(String resource, ConfigureHandler configureDelegate)
at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.ConfigureAndWatch(ConfigureHandler configureDelegate)
at QuickStart.DataAccess.Mapper.InitMapper() in C:DevelopmentiBATISQuickStartSourceQuickStart.DataAccessMapper.cs:line 31
at QuickStart.DataAccess.Mapper.Instance() in C:DevelopmentiBATISQuickStartSourceQuickStart.DataAccessMapper.cs:line 43
at QuickStart.DataAccess.Test.MapperFixture.InstanceTest() in C:DevelopmentiBATISQuickStartTestQuickStart.DataAccess.TestMapperFixture.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.ParseGlobalProperties()
at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Initialize()
at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Build(XmlDocument document, DataSource dataSource, Boolean useConfigFileWatcher, Boolean isCallFromDao)
&nbsp;
 ;
Any help would be greatly appreciated.


Recharge--play some free games. Win cool prizes too! Play It!
RE: The error occurred while Validate SqlMap config
user name
2007-08-24 13:27:06

Your issue is most likely in this line:

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

 

Notice you have ‘si’ where it is not needed.&nbsp; It should be like this:

 

<sqlMapConfig

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

  xmlnssi="http://www.w3.org/2001/XMLSchema-instance">

 

Regards,


Tom Nguyen
Sr. Developer
tom.nguyenrels.info">tom.nguyenrels.info


From: Phillip S [mailto:todextremehotmail.com]
Sent: Friday, August 24, 2007 12:07 PM
To: user-csibatis.apache.org
Subject: The error occurred while Validate SqlMap config

 

Team,
&nbsp;
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.
&nbsp;
-------------
sqlmap.config
--------------
<?xml version="1.0" encoding="UTF-8" ?>
&lt;
sqlMapConfig xmlnssi="http://www.w3.org/2001/XMLSchema-instance">
&nbsp;  <
settings>
&nbsp; &nbsp;  <
setting cacheModelsEnabled="true"/>
&nbsp; &nbsp;  <
setting useStatementNamespaces="false"/>
&nbsp; &nbsp;  <
setting validateSqlMap="false"/>
&nbsp; &nbsp;  <
setting useReflectionOptimizer="true"/>
&nbsp;  </
settings>
&nbsp;  <
database>
&nbsp; &nbsp; &nbsp; <
provider name="sqlServer2.0"/>
&nbsp;   ;  <
dataSource name="TestServer" connectionString="Data Source=testdbserver;Initial Catalog=TEST257;user=user1;password=abc123;" />
&nbsp;  </
database>

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

  ; <
resultMaps>
&nbsp; &nbsp; &nbsp; <
resultMap id="UserResult" class="User">
&nbsp; &nbsp; &nbsp;   ; <
result property="Id" column="userid"/>
&nbsp;   ;  </
resultMap>
&nbsp;  </
resultMaps>
&nbsp;  <
statements>
&nbsp; &nbsp; &nbsp; <
select id="GetUser" resultMap="UserResult" parameterClass="String">
&nbsp; &nbsp;   SELECT
&nbsp;   ; &nbsp; userid
&nbsp;   ; &nbsp; FROM
&nbsp; &nbsp; &nbsp;  dbo.Users
 &nbsp; &nbsp; &nbsp; <
dynamic prepend="WHERE">
&nbsp; &nbsp; &nbsp;   ;  <
isParameterPresent>
&nbsp; &nbsp; &nbsp;   ; &nbsp;  userid = #value#
  ; &nbsp; &nbsp; &nbsp;  </
isParameterPresent>
&nbsp; &nbsp; &nbsp;   </
dynamic>
&nbsp; &nbsp; &nbsp; </
select>
&nbsp;  </
statements>
<;/
sqlMap>
&nbsp;
------------
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;
&nbsp;
&nbsp;  private Mapper() { }
 
 &nbsp; protected static void Configure(object obj)
&nbsp;  {
   ; &nbsp; _mapper = null;
&nbsp;  }
 
 &nbsp; public static
ISqlMapper Get()
&nbsp;  {
   ; &nbsp; return Instance();
 &nbsp; }
 
 &nbsp; protected static void InitMapper()
   {
 &nbsp; &nbsp;  ConfigureHandler handler = new ConfigureHandler(Configure);
 &nbsp; &nbsp;  DomSqlMapBuilder builder = new DomSqlMapBuilder();
&nbsp; &nbsp; &nbsp; _mapper = builder.ConfigureAndWatch(handler);
 ;  }
 
 &nbsp; public static
ISqlMapper Instance()
 &nbsp; {
   ; &nbsp; if (_mapper == null)
&nbsp; &nbsp;   {
   ; &nbsp; &nbsp;  lock (typeof(
SqlMapper))
 ; &nbsp; &nbsp; &nbsp;  {
   ; &nbsp; &nbsp; &nbsp; &nbsp; if (_mapper == null)
&nbsp; &nbsp;   ; &nbsp; &nbsp; {
   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; InitMapper();
&nbsp; &nbsp; &nbsp;   ; &nbsp;  }
   ; &nbsp; &nbsp;  }
   ; &nbsp; }
   ; &nbsp; return _mapper;
 &nbsp; }
}
}
 
 
-----------
mapperFixture
-----------
[Test]
public void InstanceTest()
{
 &nbsp; ISqlMapper mapper = Mapper.Instance();
}
&nbsp;
&nbsp;
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(String resource, ConfigureHandler configureDelegate)
at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.ConfigureAndWatch(ConfigureHandler configureDelegate)
at QuickStart.DataAccess.Mapper.InitMapper() in C:DevelopmentiBATISQuickStartSourceQuickStart.DataAccessMapper.cs:line 31
at QuickStart.DataAccess.Mapper.Instance() in C:DevelopmentiBATISQuickStartSourceQuickStart.DataAccessMapper.cs:line 43
at QuickStart.DataAccess.Test.MapperFixture.InstanceTest() in C:DevelopmentiBATISQuickStartTestQuickStart.DataAccess.TestMapperFixture.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.ParseGlobalProperties()
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!


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.&nbsp; 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.


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )