ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Don Dwoske" <...@loraxis.com>
Subject Re: Could not configure ResultMap
Date Thu, 21 Sep 2006 11:57:37 GMT
I wanted to pass along my solution to this problem.   I downloaded and
compiled the source so I could run a version that dumped line numbers
in the stack trace, and discovered the problem was on line 1096 of
DomSqlMapBuilder

_configScope.SqlMapNamespace =
_configScope.SqlMapDocument.SelectSingleNode(
ApplyMappingNamespacePrefix(XML_MAPPING_ROOT),
_configScope.XmlNamespaceManager ).Attributes["namespace"].Value;


This led me to examine closely the headers I was using on my xml file
and it turns out that I had copied a header in which the namespace
value was empty.  I changed my header in the sqlMap and all was well :

<sqlMap
    namespace="CV"
    xmlns="http://ibatis.apache.org/mapping"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

The *bad* one I was previously using was this (notice no namespace) :
<sqlMap xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="SqlMap.xsd">




On 9/19/06, Don Dwoske <don@loraxis.com> wrote:
> I am having this exact problem with iBatis DataMapper 1.5.1 and the .NET 2.0 runtime.
>
> I've copied examples, changed as much as I can, yet I get the below exception.
>
> If I leave my CV.xml file (a mapping file) empty, I get the same thing.. no idea what
is causing this...
>
>
> did anyone find something that might be useful to me?  Is there a debug flag or build
> I can use to see the line numbers in the stack trace?
>
> Unhandled Exception: IBatisNet.Common.Exceptions.ConfigurationException
> :
> - The error occurred while loading SqlMap.
> - The error occurred in <sqlMap resource="CV.xml" xmlns="http://ibatis.apache.org/dataMapper"
/>. --->
> System.NullRefer
> nceException: Object reference not set to an instance of an object.
>    at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.ConfigureSqlMap()
>    at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Initialize
> ()
>    at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Build(XmlDocument document,
DataSource dataSource, Boolean us
> ConfigFileWatcher, Boolean isCallFromDao)
>    --- End of inner exception stack trace ---
>
>    at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Build(XmlDocument document,
DataSource dataSource, Boolean us
> ConfigFileWatcher, Boolean isCallFromDao)
>    at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Configure
> (String resource)
>    at HttpTestListener.test_ibatis() in c:\novartis\remoteReg\lwa\dev\cs\HttpTestListener.cs:line
235
>    at HttpTestListener.Main(String[] args) in c:\novartis\remoteReg\lwa\dev\cs\HttpTestListener.cs:line
249
>
>
>
> --- Alexandre Grenier <[EMAIL PROTECTED]> wrote:
>
> > Thanks Luke,
> >
> > I wish to be doing whatever you do that makes it work :)
> >
> > The files are all just sitting in the bin folder. The
> Domain.dll is
> > there.
> > I tried with Mapper.Instance() and the error is the same.
> >
> > I have made a 2nd unit test project, this time using the
> > iBatistutorial.mdb access database and the OleDb2.0
>  provider. I am
> > getting the same error:
> >
> > iBatisTutorial.Model.PersonTest.GetMapper :
> > IBatisNet.Common.Exceptions.ConfigurationException :
> > - The error occurred while Validate SqlMap config.
>
> > - initialize ResultMap
> > - The error occurred in <sqlMap resource="Person.xml"
> > xmlns="http://ibatis.apache.org/dataMapper"
> ; />.
> > - Check the Person.SelectAllResult.
> >   ----> IBatisNet.Common.Exceptions.ConfigurationException : Could
> > not
> > configure ResultMap. ResultMap named "SelectAllResult" not found,
>
> > failed.
> >  Cause: Object reference not set to an instance of an object.
> >
> > If I set validateSqlMap to false, the error is very similar:
> >
> > iBatisTutorial.Model.PersonTest.GetMapper
>  :
> > IBatisNet.Common.Exceptions.ConfigurationException :
> > - The error occurred while loading SqlMap.
> > - initialize ResultMap
> > - The error occurred in <sqlMap resource="Person.xml"
>
> > xmlns="http://ibatis.apache.org/dataMapper"; />.
> > - Check the Person.SelectAllResult.
> >   ----> IBatisNet.Common.Exceptions.ConfigurationException
>  : Could
> > not
> > configure ResultMap. ResultMap named "SelectAllResult" not found,
> > failed.
> >  Cause: Object reference not set to an instance of an object.
> >
> > The folder structure is very straightforward. 1 solution, 2 projects,
>
> > Model and Test. Model has a Person class. Test has a reference to
> > Model.
> > All the iBatis DLLs, Castle, log4net, config, sqlmap and mdb as well
> > as
> > Test and Model DLLs are in Test's bin\debug.
>
> >
> > Maybe I can send that simple unit test zipped up as email attachment
> > and
> > it would be easy to find out what's wrong. Maybe just replacing my
> > iBatis DLLs with yours would fix it. Maybe there's something about
>
> > compiled iBatis with 2.0 I'm not aware of. I really don't know at
> > this
> > point... except that it's 9pm and I'm at the office :(
> >
> > Thanks!
> >
> > Alex
>
>
>  --
>
> ---------------------------------------
> Donald Dwoske
> Software Journeyman
> http://www.loraxis.com/ddwoske
>



-- 

---------------------------------------
Donald Dwoske
Software Journeyman
http://www.loraxis.com/ddwoske

Mime
View raw message