tags:

views:

335

answers:

2

According to the user guide i am able to use file path instead of resource:


// Using classpath relative resources
<mappers>
    <mapper resource="org/mybatis/builder/AuthorMapper.xml"/>
</mappers>

// Using url fully qualified paths
<mappers>
    <mapper url="file:///var/sqlmaps/AuthorMapper.xml"/>
</mappers>

in my project I'm trying to put my mapper xml "outside" the project and i'm doing this:

<mapper url="file://D:/Mappers/ComponentMapper1.xml" /> 

The output of my log4j console:

Error building SqlSession. 
The error may exist in file://D:/Mappers/ComponentMapper1.xml 
Cause: org.apache.ibatis.builder.BuilderException: Error parsing 
SQL Mapper Configuration. Cause: java.net.UnknownHostException: D 

Is it bug or it's me doing something wrong?

+2  A: 

Sql Map Config looks for mapping files relatively to the classpath, so just try adding your ComponentMapper1.xml somewhere to the classpath.

set CLASSPATH=%CLASSPATH%;D:/Mappers/

...

<mapper resource="ComponentMapper1.xml" />
Vasil Remeniuk
+1  A: 

You just need an additional forward slash before the drive letter.