ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guy Rouillier <guyr-...@burntmail.com>
Subject Re: Issues with Ibatis Configuration File
Date Wed, 09 Dec 2009 22:10:10 GMT
Soks86 wrote:
> Hi,
> 
> I have created the following configuration file for my Ibatis
> SqlSessionFactoryBuilder.
> 
> <?xml version="1.0" encoding="UTF-8" ?>
> <!DOCTYPE configuration
>   PUBLIC "-//ibatis.apache.org//DTD Config 3.0//EN"
>   "http://ibatis.apache.org/dtd/ibatis-3-config.dtd">
> <configuration>
>     <environments default="development">
>         <environment id="development">
>             <transactionManager type="JDBC" />
>             <dataSource type="POOLED">
>                 <property name="driver"
> value="org.apache.derby.jdbc.EmbeddedDriver" />
>                 <property name="url"
>                     value="jdbc:derby:/home/mchrosto/MyTestDB;create=true"
> />
>                 <!--
>                     <property name="username" value="${username}" />
> <property
>                     name="password" value="${password}" />
>                 -->
>             </dataSource>
>         </environment>
>     </environments>
>     <typeAliases>
>         <typeAlias alias="TradableDao"
>             type="com.icarus.common.strategies.dao.TradableDao" />
>         <typeAlias alias="Tradable"
> type="com.icarus.common.strategies.Tradable" />
>     </typeAliases>
>     <mappers>
>         <mapper resource="src/main/resources/IbatisMaps/TradableDao.xml" />
>     </mappers>
> </configuration>
> 
> 
> If I remove the <typeAliases> portion (and rename my aliases inside of
> TradableDao.xml) then it works just fine. However when I put the aliases in
> (exactly as shown above) I get XML parsing exceptions... in particular:
> 
> ### Error building SqlSession.
> ### The error may exist in SQL Mapper Configuration
> ### Cause: org.apache.ibatis.builder.BuilderException: Error creating
> document instance.  Cause: org.xml.sax.SAXParseException: The content of
> element type "configuration" must match
> "(properties?,settings?,typeAliases?,typeHandlers?,objectFactory?,plugins?,environments?,mappers?)".

The configuration file is order-specific.  typeAliases need to come 
before environments, as indicated in the error message.

> Also my IDE (Eclipse) complains that the xml file is not compliant with the
> DTD file... all of this goes away if I remove my aliases.

Same issue.

> 
> Anyone have any idea why this might be ocuring? I'm alright for now without
> aliases but as I get farther and farther into iBATIS I fear that I will need
> them to stay sane.
> 
> Just to be clear this is iBATIS 3 - Beta 5 and should be the latest file
> from repository.sonatype.org.
> 
> Thanks in advance for any help!
> 
> Michael Chrostowski


-- 
Guy Rouillier

---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Mime
View raw message