You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by Marc Rodrigues <jl...@gmail.com> on 2006/02/20 15:13:16 UTC
IBatisNet.Common.Exceptions.ConfigurationException
Hi all,
I am trying this mailing list, because I didn't get answer from user list.
I am sorry by advance if it is not the rigth list.
Sorry also for my english
So I'am using this technical environment :
Dot.Net 2.0
MS SQL Server 2000 or 2005 same issues
C# 2.0
Visual Studio 2005
with this bin release of iBatis.net
IBatisNet.DataMapper.dll 1.2.1.0IBatisNet.Common.dll 1.2.0.0
I would like to know what is wrong with my SqlMap file, i got this
error message
:
Test method NortWindTest.CustomerServiceTest.UpdateCustomerTest threw
exception:
IBatisNet.Common.Exceptions.ConfigurationException:
- The error occurred while loading SqlMap .
- initialize type alias
- The error occurred in <sqlMap resource="${root}/CustomerHelper.xml" />. -
Check the NortwindProject.Model.Customer, NortwindProject.Model. --->
System.TypeLoadException: Could not load type :
NortwindProject.Model.Customer, NortwindProject.Model.
Thanks,
Below you can find the class CustomerService, the test class
CustomerServiesTest,
the error stack and all config files
using NortwindProject.Model;
using IBatisNet.DataMapper;
namespace NortwindProject.Services
{
public class CustomerService
{
public Customer NewCustomer()
{
return new Customer();
}
public bool UpdateCustomer(Customer customer)
{
// get it
SqlMapper m_Mapper = IBatisNet.DataMapper.Mapper.Instance();
m_Mapper.Update("Update", customer); return true;
}
.......
[TestMethod()]
public void UpdateCustomerTest()
{
CustomerService target = new CustomerService();
Customer value = new Customer();
value.CustomerID = "MONIC";
value.CompagnyName = "Saga Groupe";
value.ContactName = "Marc";
bool expected = true;
bool actual;
actual = target.UpdateCustomer(value);
Assert.AreEqual(expected, actual, "
NortWindProject.Services.CustomerService.UpdateCustomer did not return the
expec" +
"ted value.");
}
Error Stack Trace :
at IBatisNet.Common.Utilities.TypesResolver.TypeResolver.Resolve(String
typeName)
at IBatisNet.Common.Utilities.TypesResolver.CachedTypeResolver.Resolve(String
typeName)
at IBatisNet.Common.Utilities.Resources.TypeForName(String className)
at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.ConfigureSqlMap()
at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Initialize()
at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Build(XmlDocument
document,
DataSource dataSource, Boolean useConfigFileWatcher, Boolean isCallFromDao)
--- End of inner exception stack trace ---
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.Mapper.InitMapper()
at IBatisNet.DataMapper.Mapper.Instance()
at NortwindProject.Services.CustomerService.UpdateCustomer(Customer customer)
in G:\Dot.Net\NortWind project\NortWindProject\Services\CustomerService.cs:line
16 at NortWindTest.CustomerServiceTest.UpdateCustomerTest() in
G:\Dot.Net\NortWind
project\NortWindProject\NortWindTest\CustomerServiceTest.cs:line 145
Here my sqlMap file "CustomerHelper.xml" :
<?xml version="1.0" encoding="utf-8" ?>
<sqlMap
namespace="Customer"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:noNamespaceSchemaLocation="SqlMap.xsd">
<!-- XML "behind" document for the People service class. -->
<alias>
<typeAlias alias="Customer" type="NortwindProject.Model.Customer,
NortwindProject.Model" />
</alias>
<resultMaps>
<resultMap id="SelectResult" class="Customer">
<result property="CustomerID" column="CUSTOMERID" />
<result property="CompagnyName" column="COMPAGNYNAME" />
<result property="ContactName" column="CONTACTNAME" />
</resultMap>
</resultMaps>
<statements> <select id="Select" parameterClass="int"
resultMap="SelectResult">
select
CUSTOMERID,
COMPAGNYNAME,
CONTACTNAME
from CUSTOMER
<dynamic prepend="WHERE">
<isParameterPresent>
CUSTOMERID = #value#
</isParameterPresent>
</dynamic>
</select>
<insert id="Insert" parameterClass="Customer">
insert into CUSTOMER
(CUSTOMERID, COMPAGNYNAME, CONTACTNAME)
values
(#CustomerID#, #CompagnyName#, #ContactName#)
</insert>
<update id="Update" parameterClass="Customer">
update CUSTOMER set
COMPAGNYNAME = #CompagnyName#,
CONTACTNAME = #ContactName#
where CUSTOMERID = #CustomerID#
</update>
<delete id="Delete" parameterClass="int">
delete from CUSTOMER
where CUSTOMERID = #value#
</delete>
</statements> </sqlMap>
and my sqlMap.config file
<?xml version="1.0" encoding="UTF-8" ?>
<sqlMapConfig
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:noNamespaceSchemaLocation="SqlMapConfig.xsd">
<properties resource="properties.config"/>
<settings>
<setting useStatementNamespaces="false"/>
<setting cacheModelsEnabled="true"/>
</settings>
<providers resource="providers.config"/>
<database> <provider name="${provider}"/> <dataSource name="PUPPY-TOY"
connectionString="${connectionString}"/>
</database>
<sqlMaps>
<sqlMap resource="${root}CustomerHelper.xml" />
</sqlMaps>
</sqlMapConfig>
and the properties file
<?xml version="1.0" encoding="utf-8" ?>
<settings>
<!-- User application and configured property settings go here.-->
<!-- Example: <add key="settingName" value="settingValue"/> -->
<add key="provider" value="sqlServer1.1" />
<add key="connectionString" value="Provider=Microsoft.Jet.OLEDB.4.0;
database=Northwind;
user ID = XX; password =XXXXX" />
<add key="root" value="../../" />
</settings>
Re: IBatisNet.Common.Exceptions.ConfigurationException
Posted by Ron Grabowski <ro...@yahoo.com>.
Older versions of IBatisNet only supported properties (i.e. ${xyz}) in
some configuration elements. I don't recall the date of the 1.2.x
release but the issue has since been resolved:
https://issues.apache.org/jira/browse/IBATISNET-58
Are you able to upgrade to a more recent version?
--- Marc Rodrigues <jl...@gmail.com> wrote:
> Hi all,
> I am trying this mailing list, because I didn't get answer from user
> list.
>
>
>
> I am sorry by advance if it is not the rigth list.
>
> Sorry also for my english
>
>
>
> So I'am using this technical environment :
>
> Dot.Net 2.0
> MS SQL Server 2000 or 2005 same issues
> C# 2.0
> Visual Studio 2005
>
> with this bin release of iBatis.net
> IBatisNet.DataMapper.dll 1.2.1.0IBatisNet.Common.dll 1.2.0.0
>
> I would like to know what is wrong with my SqlMap file, i got this
> error message
> :
>
> Test method NortWindTest.CustomerServiceTest.UpdateCustomerTest threw
> exception:
> IBatisNet.Common.Exceptions.ConfigurationException:
>
> - The error occurred while loading SqlMap .
> - initialize type alias
>
> - The error occurred in <sqlMap resource="${root}/CustomerHelper.xml"
> />. -
> Check the NortwindProject.Model.Customer, NortwindProject.Model. --->
> System.TypeLoadException: Could not load type :
> NortwindProject.Model.Customer, NortwindProject.Model.
>
> Thanks,
>
>
> Below you can find the class CustomerService, the test class
> CustomerServiesTest,
> the error stack and all config files
>
> using NortwindProject.Model;
> using IBatisNet.DataMapper;
>
> namespace NortwindProject.Services
> {
> public class CustomerService
> {
> public Customer NewCustomer()
> {
> return new Customer();
> }
>
> public bool UpdateCustomer(Customer customer)
> {
> // get it
> SqlMapper m_Mapper =
> IBatisNet.DataMapper.Mapper.Instance();
>
>
> m_Mapper.Update("Update", customer); return true;
>
> }
> .......
>
> [TestMethod()]
> public void UpdateCustomerTest()
> {
> CustomerService target = new CustomerService();
>
> Customer value = new Customer();
> value.CustomerID = "MONIC";
> value.CompagnyName = "Saga Groupe";
> value.ContactName = "Marc";
>
> bool expected = true;
> bool actual;
>
> actual = target.UpdateCustomer(value);
>
>
> Assert.AreEqual(expected, actual, "
> NortWindProject.Services.CustomerService.UpdateCustomer did not
> return the
> expec" +
>
> "ted value.");
> }
>
>
>
> Error Stack Trace :
>
> at
> IBatisNet.Common.Utilities.TypesResolver.TypeResolver.Resolve(String
> typeName)
> at
>
IBatisNet.Common.Utilities.TypesResolver.CachedTypeResolver.Resolve(String
> typeName)
>
> at IBatisNet.Common.Utilities.Resources.TypeForName(String
> className)
> at
> IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.ConfigureSqlMap()
> at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Initialize()
>
> at
> IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Build(XmlDocument
> document,
> DataSource dataSource, Boolean useConfigFileWatcher, Boolean
> isCallFromDao)
>
> --- End of inner exception stack trace ---
>
> 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.Mapper.InitMapper()
> at IBatisNet.DataMapper.Mapper.Instance()
>
> at NortwindProject.Services.CustomerService.UpdateCustomer(Customer
> customer)
> in G:\Dot.Net\NortWind
> project\NortWindProject\Services\CustomerService.cs:line
> 16 at NortWindTest.CustomerServiceTest.UpdateCustomerTest() in
> G:\Dot.Net\NortWind
> project\NortWindProject\NortWindTest\CustomerServiceTest.cs:line 145
>
> Here my sqlMap file "CustomerHelper.xml" :
>
> <?xml version="1.0" encoding="utf-8" ?>
>
> <sqlMap
> namespace="Customer"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xsi:noNamespaceSchemaLocation="SqlMap.xsd">
>
> <!-- XML "behind" document for the People service class. -->
>
> <alias>
>
> <typeAlias alias="Customer" type="NortwindProject.Model.Customer,
> NortwindProject.Model" />
>
> </alias>
>
> <resultMaps>
>
> <resultMap id="SelectResult" class="Customer">
> <result property="CustomerID" column="CUSTOMERID" />
> <result property="CompagnyName" column="COMPAGNYNAME" />
> <result property="ContactName" column="CONTACTNAME" />
> </resultMap>
> </resultMaps>
>
> <statements> <select id="Select" parameterClass="int"
> resultMap="SelectResult">
>
> select
> CUSTOMERID,
> COMPAGNYNAME,
> CONTACTNAME
> from CUSTOMER
> <dynamic prepend="WHERE">
> <isParameterPresent>
> CUSTOMERID = #value#
> </isParameterPresent>
> </dynamic>
> </select>
>
> <insert id="Insert" parameterClass="Customer">
> insert into CUSTOMER
> (CUSTOMERID, COMPAGNYNAME, CONTACTNAME)
> values
> (#CustomerID#, #CompagnyName#, #ContactName#)
> </insert>
>
> <update id="Update" parameterClass="Customer">
> update CUSTOMER set
> COMPAGNYNAME = #CompagnyName#,
> CONTACTNAME = #ContactName#
> where CUSTOMERID = #CustomerID#
> </update>
>
> <delete id="Delete" parameterClass="int">
> delete from CUSTOMER
> where CUSTOMERID = #value#
> </delete>
>
> </statements> </sqlMap>
>
>
=== message truncated ===