You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-cs@ibatis.apache.org by Rick Evans <un...@gmail.com> on 2005/09/29 23:31:16 UTC

Jess Nielsen's iBatis.NET / Spring.NET configuration issue

Hi Jess

I can't see anything glaring in the iBatis.NET configuration; the
message from the 'usual
Spring.Objects.Factory.ObjectCreationException' would seem to indicate
that you are encountering an error when trying to set a property
called 'constructor argument'; to wit...

Can't resolve reference to object 'DataAccessProvider' while setting
property 'constructor argument'.

Can you please provide the relevant snippets (or all) of the
Forbrug.xml file? This will allow me to determine exactly what the
issue is... well, hopefully :)

You might want to consider posting Spring.NET configuration issues to
the Spring.NET list ('cos this is what this looks like)... or heck,
even cross post ;)

Ciao
Rick

---------- Forwarded message ----------
From: "Jess Nielsen" <je...@ementor.dk>
To: <us...@ibatis.apache.org>
Date: Wed, 28 Sep 2005 16:32:53 +0200
Subject: URGENT - Connecting to both Oracle and SqlServer - PLEASE HELP
Hi there

I'm trying to configure ibatis so it wil be using two different
databases (oracle and sqlserver) concurrently. I have been using several
hours on this without success and hope that some of you guys in here can
help me. The error I keep getting is the usual:
Spring.Objects.Factory.ObjectCreationException

The connection to the SQL Server is working out of the box, when the
Oracle configuration hasn't been added. As soon as I add the
configuration for the Oracle it will fail. Does anyone know how to
configure ibatis so the setup will work?

I hope for a soon reply on this.

Thanks in regards,
Jess

--- error ---
Error creating object with name 'ForbrugService' defined in 'file
[C:\Projects\ENSPOP\Source\Assemblies\ENST.ENSPOP\Presentation\ENST.ENSP
OP.Web\Spring\Forbrug.xml]' : Can't resolve reference to object
'DataAccessProvider' while setting property 'constructor argument'.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: Spring.Objects.Factory.ObjectCreationException: Error
creating object with name 'ForbrugService' defined in 'file
[C:\Projects\ENSPOP\Source\Assemblies\ENST.ENSPOP\Presentation\ENST.ENSP
OP.Web\Spring\Forbrug.xml]' : Can't resolve reference to object
'DataAccessProvider' while setting property 'constructor argument'.

Source Error:


Line 85:                        try
Line 86:                        {
Line 87:                                return
Ementor.ApplicationBlocks.ComponentFramework.ServiceLocator.GetObject(na
me);
Line 88:                        }
Line 89:                        catch (Exception ex)


Source File:
C:\Projects\ENSPOP\Source\Assemblies\ENST.ENSPOP\Framework\ENST.ENSPOP.F
ramework\ServiceLocator.cs    Line: 87

Stack Trace:


[ObjectCreationException: Error creating object with name
'ForbrugService' defined in 'file
[C:\Projects\ENSPOP\Source\Assemblies\ENST.ENSPOP\Presentation\ENST.ENSP
OP.Web\Spring\Forbrug.xml]' : Can't resolve reference to object
'DataAccessProvider' while setting property 'constructor argument'.]

Spring.Objects.Factory.Support.DefaultListableObjectFactory.PreInstantia
teSingletons()
  Spring.Context.Support.AbstractApplicationContext.Refresh()
  Spring.Context.Support.XmlApplicationContext..ctor(String[]
configurationLocations)

Ementor.ApplicationBlocks.ComponentFramework.ServiceConfig.GetInstance()

Ementor.ApplicationBlocks.ComponentFramework.ServiceLocator.GetObject(St
ring name)

[ApplicationException: Error getting object
'AuthenticationManagerService']

Ementor.ApplicationBlocks.ComponentFramework.ServiceLocator.GetObject(St
ring name)
  ENST.ENSPOP.Framework.ServiceLocator.GetFacadeObject(String name) in
C:\Projects\ENSPOP\Source\Assemblies\ENST.ENSPOP\Framework\ENST.ENSPOP.F
ramework\ServiceLocator.cs:87

[SystemErrorException: Error getting object
'AuthenticationManagerService']
  ENST.ENSPOP.Framework.ServiceLocator.GetFacadeObject(String name) in
C:\Projects\ENSPOP\Source\Assemblies\ENST.ENSPOP\Framework\ENST.ENSPOP.F
ramework\ServiceLocator.cs:91
  ENST.ENSPOP.Framework.ServiceLocator.AuthenticationManagerService()
in
C:\Projects\ENSPOP\Source\Assemblies\ENST.ENSPOP\Framework\ENST.ENSPOP.F
ramework\ServiceLocator.cs:74
  ENST.ENSPOP.Web.Global.Application_AuthenticateRequest(Object sender,
EventArgs e) in
C:\Projects\ENSPOP\Source\Assemblies\ENST.ENSPOP\Presentation\ENST.ENSPO
P.Web\Global.asax.cs:54

System.Web.SyncEventExecutionStep.System.Web.HttpApplication+IExecutionS
tep.Execute()
  System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
completedSynchronously)
--- error ---


For the setup I'm using the following configuration files, where each
file has its own snippet below.


--- dao.config ---
<?xml version="1.0" encoding="utf-8"?>
<daoConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="DaoConfig.xsd">

       <context id="SqlMapDao" default="true">

               <daoSessionHandler id="SqlMap">
                       <property name="sqlMapConfigFile"
value="SqlMap.config"/>
                       <property name="oracleMapConfigFile"
value="OracleMap.config"/>
               </daoSessionHandler>

               <database>
                       <provider name="sqlServer1.1"/>
                       <dataSource name="SqlServer"
connectionString="data source=HOST;database=DB;user
id=USER;password=PASS;"/>
               </database>

               <database>
                       <provider name="oracleClient1.0"/>
                       <dataSource name="OracleServer"
connectionString="Data Source=SERVICE;User
Id=USER;Password=PASS;Integrated Security=no;" />
               </database>

               <daoFactory/>
       </context>

</daoConfig>
--- dao.config ---

--- providers.config ---
<?xml version="1.0" encoding="utf-8" ?>
<providers>
       <clear/>

       <provider
               name="sqlServer1.1"
               default="true"
               assemblyName="System.Data, Version=1.0.5000.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089"
               connectionClass="System.Data.SqlClient.SqlConnection"
               commandClass="System.Data.SqlClient.SqlCommand"
               parameterClass="System.Data.SqlClient.SqlParameter"
               parameterDbTypeClass="System.Data.SqlDbType"
               parameterDbTypeProperty="SqlDbType"
               dataAdapterClass="System.Data.SqlClient.SqlDataAdapter"

commandBuilderClass="System.Data.SqlClient.SqlCommandBuilder"
               usePositionalParameters = "false"
               useParameterPrefixInSql = "true"
               useParameterPrefixInParameter = "true"

               parameterPrefix="@"
       />

       <provider
               name="oracleClient1.0"
               description="MS Oracle provider V1.0.5"
               enabled="true"
               default="true"
               assemblyName="System.Data.OracleClient,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"

connectionClass="System.Data.OracleClient.OracleConnection"
               commandClass="System.Data.OracleClient.OracleCommand"

parameterClass="System.Data.OracleClient.OracleParameter"

parameterDbTypeClass="System.Data.OracleClient.OracleType"
               parameterDbTypeProperty="OracleType"

dataAdapterClass="System.Data.OracleClient.OracleDataAdapter"

commandBuilderClass="System.Data.OracleClient.OracleCommandBuilder"
               usePositionalParameters = "false"
               useParameterPrefixInSql = "true"
               useParameterPrefixInParameter = "false"
               parameterPrefix=":"
       />

</providers>
--- providers.config ---

--- OracleMap.config ---
<?xml version="1.0" encoding="utf-8"?>
<sqlMapConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="SqlMapConfig.xsd">

       <settings>
               <setting useStatementNamespaces="false"/>
               <setting cacheModelsEnabled="false"/>
       </settings>

       <database>
               <provider name="oracleClient1.0"/>
               <dataSource name="OracleServer" connectionString="not in
use, see dao.config for connectionstring" />
       </database>


       <sqlMaps>
               <sqlMap resource="DBMaps/ScantidMap.xml" />
       </sqlMaps>

</sqlMapConfig>
--- OracleMap.config ---


--- ScantidMap.xml ---
<?xml version="1.0" encoding="utf-8" ?>

<sqlMap namespace="Import"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="SqlMap.xsd">

       <alias>
               <typeAlias alias="ForbrugtTimer"
assembly="ENST.ENSPOP.Import.Domain.dll"
type="ENST.ENSPOP.Import.Domain.ForbrugtTimer" />
       </alias>

       <statements>
                       <select id="SletAlleTable1">
                               DELETE FROM TABLE1
                       </select>
       </statements>

</sqlMap>
--- ScantidMap.xml ---