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 Bryce Budd <bb...@agileparadigm.com> on 2007/06/26 17:23:39 UTC
Configuration Exception with ${root} in SqlMap
I get the following error when trying to configure a sqlMapper.
- The error occurred while loading SqlMap.
- The error occurred in <sqlMap resource="${root}\Maps\a.xml"
----> IBatisNet.Common.Exceptions.ConfigurationException : Unable to load
file via resource "root\Maps\a.xml" as resource. Cause : Could not find a
part of the path [Path].
It appears that IBatis is not expanding my ${root} property correctly.
Here is my config:
<sqlMapConfig xmlns="http://ibatis.apache.org/dataMapper"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<properties>
<property resource="properties.config" />
</properties>
<settings>
<setting useStatementNamespaces="true" />
<setting cacheModelsEnabled="true" />
<setting validateSqlMap="true" />
<setting useReflectionOptimizer="true" />
</settings>
<sqlMaps>
<sqlMap resource="${root}\Maps\a.xml" />
<sqlMap resource="${root}\Maps\b.xml" />
<sqlMap resource="${root}\Maps\c.xml" />
<sqlMap resource="${root}\Maps\d.xml" />
</sqlMaps>
</sqlMapConfig>
Properties.config has the following:
<?xml version="1.0" encoding="utf-8" ?>
<settings>
<add key="root" value="C:\Projects\Company\path-blah\Persistence" />
</settings>
I'm using DataMapper 1.61 & DataAccess 1.9.1 libs.
The DataMapper Guide version 1.61 in sections 4.3.2 and 4.3.3 states that
properties can be used for this purpose.
One caveat is my application is a console application. I don't believe that
should make a difference though.
Any assistance is greatly appreciated.
--
View this message in context: http://www.nabble.com/Configuration-Exception-with-%24%7Broot%7D-in-SqlMap-tf3982941.html#a11307473
Sent from the iBATIS - User - Cs mailing list archive at Nabble.com.
Re: Configuration Exception with ${root} in SqlMap
Posted by Lee Shinlever <ls...@lexesinc.com>.
Okay I reserve the right to be wrong because I used embedded maps and
such but...
Should it read:
<sqlMaps>
<sqlMap resource="${root}/Maps/a.xml" />
<sqlMap resource="${root}/Maps/b.xml" />
<sqlMap resource="${root}/Maps/c.xml" />
<sqlMap resource="${root}/Maps/d.xml" />
</sqlMaps>
AND:
<?xml version="1.0" encoding="utf-8" ?>
<settings>
<!--add key="root" value="C:\Projects\Company\path-blah\Persistence" /-->
<!--the number of ../ markers should equal the number of levels below
the root of your application-->
<add key="root" value="../../../../Persistence">
</settings>
So if you are actually using a file path then url would be the way to
go?.?.?
On Tue, 2007-06-26 at 08:23 -0700, Bryce Budd wrote:
> I get the following error when trying to configure a sqlMapper.
>
> - The error occurred while loading SqlMap.
> - The error occurred in <sqlMap resource="${root}\Maps\a.xml"
>
> ----> IBatisNet.Common.Exceptions.ConfigurationException : Unable to load
> file via resource "root\Maps\a.xml" as resource. Cause : Could not find a
> part of the path [Path].
>
> It appears that IBatis is not expanding my ${root} property correctly.
>
> Here is my config:
>
> <sqlMapConfig xmlns="http://ibatis.apache.org/dataMapper"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <properties>
> <property resource="properties.config" />
> </properties>
> <settings>
> <setting useStatementNamespaces="true" />
> <setting cacheModelsEnabled="true" />
> <setting validateSqlMap="true" />
> <setting useReflectionOptimizer="true" />
> </settings>
> <sqlMaps>
> <sqlMap resource="${root}\Maps\a.xml" />
> <sqlMap resource="${root}\Maps\b.xml" />
> <sqlMap resource="${root}\Maps\c.xml" />
> <sqlMap resource="${root}\Maps\d.xml" />
> </sqlMaps>
> </sqlMapConfig>
>
> Properties.config has the following:
>
> <?xml version="1.0" encoding="utf-8" ?>
> <settings>
> <add key="root" value="C:\Projects\Company\path-blah\Persistence" />
> </settings>
>
> I'm using DataMapper 1.61 & DataAccess 1.9.1 libs.
>
> The DataMapper Guide version 1.61 in sections 4.3.2 and 4.3.3 states that
> properties can be used for this purpose.
>
> One caveat is my application is a console application. I don't believe that
> should make a difference though.
>
> Any assistance is greatly appreciated.
>
>