Search code examples
javaibatis

How to use file.seperator in ibatis resource attribute of sql-map tag


I am using ibatis for OR mapping of my application. me and my team is working on two different operating systems, systems are UBUNTU and Windows xp. I have a sqlmapconfig.xml file in which I refer my ibatis query xml file, in which I write all the queries.

But when I create sqlmapconfig I want to give a path of my query.xml in resource attribute of sql-map tag by using file separator so it can adjust the separator by operating system, for that I have written code like below in sqlmapconfig.xml

<sqlMap 
      resource="file:com${file.separator}platysgroup${file.separator}lmexserver${file.separator}mobile${file.separator}dao${file.separator}ibatis{file.separator}lmexusermobileinfo.xml" />

but when I run my application I get an exception:

com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'. Cause: java.io.IOException: Could not find resource file:comfile.separatorplatysgroupfile.separatorlmexserverfile.separatormobilefile.separatordaofile.separatoribatis{file.separator}lmexusermobileinfo.xml`

How to resolve this? Please help me.

Thank you


Solution

  • The Error "com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'. Cause: java.io.IOException: Could not find resource file:comfile.separatorplatysgroupfile.separatorlmexserverfile.separatormobilefile.separatordaofile.separatoribatis{file.separator}lmexusermobileinfo.xml indicates that the requested sqlMapConfig.xml is not placed properly,Place it in the src folder. and check if your are able to access it.