HERE IS THE CONSTRUCTOR IN MY DAO object that is blowing up on me:
public AccountService()
{
try
{
//_daoManager = ServiceConfig.GetInstance().DaoManager;
DomDaoManagerBuilder builder = new
DomDaoManagerBuilder();
builder.Configure("dao.config");
_daoManager = DaoManager.GetInstance("SqlMapDao");
if (_daoManager == null)
{
Log.Info("daoManager is null you fool");
}
//_accountDao = _daoManager.GetDao(typeof(IAccountDao))
as IAccountDao;
_accountDao =
(IAccountDao)_daoManager[typeof(IAccountDao)];
}catch(Exception E)
{
Log.Error("** Error: " + E.Message + "--" +
E.InnerException);
throw new DataAccessException("Error executing
AccountService. Cause :" + E.Message, E);
}
}
Randall Svancara
Web Developer
-----Original Message-----
From: Svancara, Randall - CO 7th [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 29, 2006 12:01 PM
To: [email protected]
Subject: RE: DataAccess problems
STACK TRACE
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
IBatisNet.DataAccess.Exceptions.DataAccessException: Error executing
AccountService. Cause :
- The error occurred while configure DaoSessionHandler.
- The error occurred in <property name="resource" value="SqlMap.config"
xmlns="http://ibatis.apache.org/dataAccess" />.
- Check the
IBatisNet.DataAccess.DaoSessionHandlers.SqlMapDaoSessionHandler. --->
IBatisNet.Common.Exceptions.ConfigurationException:
- The error occurred while configure DaoSessionHandler.
- The error occurred in <property name="resource" value="SqlMap.config"
xmlns="http://ibatis.apache.org/dataAccess" />.
- Check the
IBatisNet.DataAccess.DaoSessionHandlers.SqlMapDaoSessionHandler. --->
IBatisNet.Common.Exceptions.ConfigurationException: DaoManager could not
configure SqlMapDaoSessionHandler.Cause: --->
IBatisNet.Common.Exceptions.ConfigurationException --->
System.NullReferenceException: Object reference not set to an instance
of an object.
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.Build(XmlDocument
document, DataSource dataSource, Boolean useConfigFileWatcher,
NameValueCollection properties)
at
IBatisNet.DataAccess.DaoSessionHandlers.SqlMapDaoSessionHandler.Configur
e(NameValueCollection properties, IDictionary resources)
--- End of inner exception stack trace ---
at
IBatisNet.DataAccess.DaoSessionHandlers.SqlMapDaoSessionHandler.Configur
e(NameValueCollection properties, IDictionary resources)
at
IBatisNet.DataAccess.Configuration.DomDaoManagerBuilder.GetContexts(Conf
igurationScope configurationScope)
at
IBatisNet.DataAccess.Configuration.DomDaoManagerBuilder.BuildDaoManagers
(XmlDocument document, Boolean useConfigFileWatcher)
--- End of inner exception stack trace ---
at
IBatisNet.DataAccess.Configuration.DomDaoManagerBuilder.BuildDaoManagers
(XmlDocument document, Boolean useConfigFileWatcher)
at
IBatisNet.DataAccess.Configuration.DomDaoManagerBuilder.Configure(String
resource)
at Test.Service.AccountService..ctor() in D:\Data\Visual Studio
2005\Projects\IBATIS_TEST\Test.Service\AccountService.cs:line 40
--- End of inner exception stack trace ---
at Test.Service.AccountService..ctor() in D:\Data\Visual Studio
2005\Projects\IBATIS_TEST\Test.Service\AccountService.cs:line 52
at Test.Client.Form1.button1_Click(Object sender, EventArgs e) in
D:\Data\Visual Studio
2005\Projects\IBATIS_TEST\Test.Client\Form1.cs:line 30
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&
m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase:
file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
Test.Client
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase:
file:///D:/Data/Visual%20Studio%202005/Projects/IBATIS_TEST/Test.Client/
bin/Debug/Test.Client.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase:
file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5
c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase:
file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/Sy
stem.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase:
file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d
50a3a/System.Drawing.dll
----------------------------------------
log4net
Assembly Version: 1.2.9.0
Win32 Version: 1.2.9.0
CodeBase:
file:///D:/Data/Visual%20Studio%202005/Projects/IBATIS_TEST/Test.Client/
bin/Debug/log4net.DLL
----------------------------------------
System.Configuration
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase:
file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5
f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase:
file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e08
9/System.Xml.dll
----------------------------------------
Test.Service
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase:
file:///D:/Data/Visual%20Studio%202005/Projects/IBATIS_TEST/Test.Client/
bin/Debug/Test.Service.DLL
----------------------------------------
Test.Domain
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase:
file:///D:/Data/Visual%20Studio%202005/Projects/IBATIS_TEST/Test.Client/
bin/Debug/Test.Domain.DLL
----------------------------------------
IBatisNet.DataAccess
Assembly Version: 1.7.0.0
Win32 Version: 1.7.0.0
CodeBase:
file:///D:/Data/Visual%20Studio%202005/Projects/IBATIS_TEST/Test.Client/
bin/Debug/IBatisNet.DataAccess.DLL
----------------------------------------
Test.Persistance
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase:
file:///D:/Data/Visual%20Studio%202005/Projects/IBATIS_TEST/Test.Client/
bin/Debug/Test.Persistance.DLL
----------------------------------------
IBatisNet.Common
Assembly Version: 1.3.0.0
Win32 Version: 1.3.0.0
CodeBase:
file:///D:/Data/Visual%20Studio%202005/Projects/IBATIS_TEST/Test.Client/
bin/Debug/IBatisNet.Common.DLL
----------------------------------------
IBatisNet.Common.Logging.Log4Net
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase:
file:///D:/Data/Visual%20Studio%202005/Projects/IBATIS_TEST/Test.Client/
bin/Debug/IBatisNet.Common.Logging.Log4Net.DLL
----------------------------------------
System.Data
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase:
file:///C:/WINDOWS/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089
/System.Data.dll
----------------------------------------
IBatisNet.DataMapper
Assembly Version: 1.3.0.0
Win32 Version: 1.3.0.0
CodeBase:
file:///D:/Data/Visual%20Studio%202005/Projects/IBATIS_TEST/Test.Client/
bin/Debug/IBatisNet.DataMapper.DLL
----------------------------------------
************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
SQLMAP.config
<?xml version="1.0" encoding="utf-8"?>
<sqlMapConfig xmlns="http://ibatis.apache.org/dataMapper"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<settings>
<setting useStatementNamespaces="false"/>
<setting cacheModelsEnabled="true"/>
</settings>
<!-- ==== SqlClient configuration ========= -->
<!-- Optional ( default ) -->
<!-- Rem : If used with a Dao it will be ignored -->
<database>
<provider name="sqlServer1.1"/>
<dataSource name="SqlServer" connectionString="data
source=(local)\NetSDK;database=TEST;user
id=sa;password=dofa7h;connection reset=false;connection lifetime=5; min
pool size=1; max pool size=50"/>
</database>
<sqlMaps>
<sqlMap resource="Maps/Account.xml"/>
</sqlMaps>
</sqlMapConfig>
dao.config:
<?xml version="1.0" encoding="utf-8"?>
<daoConfig xmlns="http://ibatis.apache.org/dataAccess"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<context id="SqlMapDao" default="true">
<!-- ==== Sql Server : SqlClient configuration ========= -->
<database>
<provider name="sqlServer1.1"/>
<dataSource name="SqlServer"
connectionString="data source=(local)\NetSDK;database=TEST;user
id=sa;password=xxxxx;connection reset=false;connection lifetime=5; min
pool size=1; max pool size=50"/>
</database>
<daoSessionHandler id="SqlMap">
<property name="resource" value="SqlMap.config"/>
</daoSessionHandler>
<daoFactory>
<dao
interface="Test.Persistance.Dao.Interface.Accounts.IaccountDao,
Test.Persistance.Dao"
implementation="Test.Persistance.Dao.Implementations.Accounts.AccountDao
, Test.Persistance.Dao"/>
</daoFactory>
</context>
</daoConfig>
Randall Svancara
Web Developer
-----Original Message-----
From: Ron Grabowski [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 28, 2006 5:22 PM
To: [email protected]
Subject: Re: DataAccess problems
Can you post the full stack trace please? What method in IBatisNet is
throwing the exception?
--- "Svancara, Randall - CO 7th" <[EMAIL PROTECTED]> wrote:
> I have implemented IBATIS data access and data mapper. I have been
> looking at the Subversion repository for examples of how to implement
> IBATIS.
>
> Right now I am receiving an error:
>
>
> ERROR 4722778ms [672 ] AccountService .ctor
> - ** Error:
> - The error occurred while configure DaoSessionHandler.
> - The error occurred in <property name="resource"
> value="SqlMap.config"
> xmlns="http://ibatis.apache.org/dataAccess" />.
> - Check the
> IBatisNet.DataAccess.DaoSessionHandlers.SqlMapDaoSessionHandler.
> 'Test.Client.vshost.exe' (Managed): Loaded 'D:\Data\Visual Studio
>
2005\Projects\IBATIS_TEST\Test.Client\bin\Debug\IBatisNet.DataMapper.dll
> ', No symbols loaded.
> A first chance exception of type
> 'IBatisNet.Common.Exceptions.ConfigurationException' occurred in
> IBatisNet.DataAccess.dll
> A first chance exception of type
> 'IBatisNet.DataAccess.Exceptions.DataAccessException' occurred in
> Test.Service.dll
> The program '[1548] Test.Client.vshost.exe: Managed' has exited with
> code 0 (0x0).
>
> Here is my dao.config:
>
> <?xml version="1.0" encoding="utf-8"?>
> <daoConfig xmlns="http://ibatis.apache.org/dataAccess"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>
> <context id="SqlMapDao" default="true">
>
>
> <!-- ==== Sql Server : SqlClient configuration ========= -->
> <database>
> <provider name="sqlServer1.1"/>
> <dataSource name="SqlServer"
> connectionString="data source=(local)\NetSDK;database=TEST;user
> id=sa;password=dofa7h;connection reset=false;connection lifetime=5;
> min
> pool size=1; max pool size=50"/>
> </database>
>
> <daoSessionHandler id="SqlMap">
> <property name="resource" value="SqlMap.config"/>
> </daoSessionHandler>
>
> <daoFactory>
> <dao
> interface="Test.Persistance.Dao.Interface.Accounts.IaccountDao,
> Test.Persistance.Dao"
>
implementation="Test.Persistance.Dao.Implementations.Accounts.AccountDao
> , Test.Persistance.Dao"/>
> </daoFactory>
> </context>
>
> </daoConfig>
>
> Here is my SqlMap.config:
>
> <?xml version="1.0" encoding="utf-8"?>
> <sqlMapConfig xmlns="http://ibatis.apache.org/dataMapper"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
>
>
> <settings>
> <setting useStatementNamespaces="false"/>
> <setting cacheModelsEnabled="true"/>
> </settings>
>
> <!-- ==== SqlClient configuration ========= -->
> <!-- Optional ( default ) -->
> <!-- Rem : If used with a Dao it will be ignored -->
> <database>
> <provider name="sqlServer1.1"/>
> <dataSource name="SqlServer" connectionString="data
> source=(local)\NetSDK;database=TEST;user
> id=sa;password=dofa7h;connection reset=false;connection lifetime=5;
> min
> pool size=1; max pool size=50"/>
> </database>
>
> <sqlMaps>
> <sqlMap resource="Maps/Account.xml"/>
> </sqlMaps>
> </sqlMapConfig>
>
> I can not figure out why I am getting this error message. The line
> of
> code that throws and error for me is
> "builder.Configure("dao.config");"
>
> I am using Visual Studio 2005/.net 2.0.
>
> Thanks,
>
>
> Randall Svancara
> Web Developer
>
> The information contained in this email may be privileged,
> confidential or otherwise protected from disclosure. All persons are
> advised that they may face penalties under state and federal law for
> sharing this information with unauthorized individuals. If you
> received this email in error, please reply to the sender that you
> have received this information in error. Also, please delete this
> email after replying to the sender.
>
The information contained in this email may be privileged, confidential
or otherwise protected from disclosure. All persons are advised that
they may face penalties under state and federal law for sharing this
information with unauthorized individuals. If you received this email
in error, please reply to the sender that you have received this
information in error. Also, please delete this email after replying to
the sender.
The information contained in this email may be privileged, confidential or
otherwise protected from disclosure. All persons are advised that they may
face penalties under state and federal law for sharing this information with
unauthorized individuals. If you received this email in error, please reply to
the sender that you have received this information in error. Also, please
delete this email after replying to the sender.