|
List Info
Thread: The error occurred while Validate SqlMap config
|
|
| The error occurred while Validate SqlMap
config |
  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" ?>
<sqlMapConfig xmlns si="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 si="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(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! |
| RE: The error occurred while Validate
SqlMap config |

|
2007-08-24 13:27:06 |
|
Your issue is most likely in this line:
<sqlMapConfig xmlns si="http://www.w3.org/2001/XMLSchema-instance">
Notice
you have ‘ si’ where it is not needed. It should be like this:
<sqlMapConfig
xmlns="http://ibatis.apache.org/dataMapper"
xmlns si="http://www.w3.org/2001/XMLSchema-instance">
Tom Nguyen
Sr. Developer
tom.nguyen rels.info">tom.nguyen rels.info
From: Phillip S
[mailto:todextreme hotmail.com]
Sent: Friday, August 24, 2007
12:07 PM
To: user-cs ibatis.apache.org
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 si="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 si="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(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. 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 )
|