You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Soks86 <mi...@gmail.com> on 2009/12/09 22:54:52 UTC
Issues with Ibatis Configuration File
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?)".
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.
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
--
View this message in context: http://old.nabble.com/Issues-with-Ibatis-Configuration-File-tp26718012p26718012.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org
Re: Issues with Ibatis Configuration File
Posted by Larry Meadors <la...@gmail.com>.
Move the typeAliases section above environments.
Larry
On Wed, Dec 9, 2009 at 2:54 PM, Soks86 <mi...@gmail.com> 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?)".
>
> 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.
>
> 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
> --
> View this message in context: http://old.nabble.com/Issues-with-Ibatis-Configuration-File-tp26718012p26718012.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org
Re: Issues with Ibatis Configuration File
Posted by Soks86 <mi...@gmail.com>.
Guy,
I must say I didn't know how to read the error. That is, it didn't cross my
mind that the tags would have to be in order but that makes perfect sense
now. I have only myself to blame for not learning DTD format as that looks
to be a pretty standard error message format.
Thanks again,
Michael
Guy Rouillier-2 wrote:
>
> 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
>
>
>
--
View this message in context: http://old.nabble.com/Issues-with-Ibatis-Configuration-File-tp26718012p26728787.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org
Re: Issues with Ibatis Configuration File
Posted by Guy Rouillier <gu...@burntmail.com>.
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