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 "Voorhoeve, Niels {PBG}" <ni...@pepsi.com> on 2005/10/11 17:44:13 UTC
Junit / Ibatis Configuration Problem
Hi,
I'm having trouble using junit to test my ibatis setup. I am able to run
'static void main' tests within Eclipse with no problem. However when I run
the same test within Junit it fails. It seems that Ibatis has trouble
parsing the configuration files when run via Junit and generates tons of
Xpath-related exceptions. It makes no difference whether I run the Junit
tests via Eclipse or Ant on the command line. I tried moving all the test,
configuration files and ibatis-related java files to the same package and
that did not help. Has anyone dealt with this issue before?
Thanks,
Niels
$ ant test
Buildfile: build.xml
test:
[junit] Testsuite: com.pbg.aps.model.junit.ModelIBatisTestSuite
[junit] Tests run: 1, Failures: 1, Errors: 0, Time elapsed: 1.047 sec
[junit] ------------- Standard Output ---------------
[junit] 2005-10-11 11:19:49,250 [main] ERROR
com.pbg.aps.model.junit.TestDbConfig - failed to load SqlMapClient
[junit] com.ibatis.common.exception.NestedRuntimeException: Error
occurred. Cause: com.ibatis.common.xml.NodeletException: Error parsing XML.
Ca
use: com.ibatis.common.exception.NestedRuntimeException: Error parsing XPath
'/sqlMapConfig/sqlMap'. Cause: com.ibatis.common.xml.NodeletException: E
rror parsing XML. Cause:
com.ibatis.common.exception.NestedRuntimeException: Error parsing XPath
'/sqlMap/select'. Cause: java.util.NoSuchElementExc
eption
[junit] Caused by: java.util.NoSuchElementException
[junit] Caused by: com.ibatis.common.exception.NestedRuntimeException:
Error parsing XPath '/sqlMap/select'. Cause: java.util.NoSuchElementExcept
ion
[junit] Caused by: java.util.NoSuchElementException
[junit] Caused by: com.ibatis.common.xml.NodeletException: Error parsing
XML. Cause: com.ibatis.common.exception.NestedRuntimeException: Error pa
rsing XPath '/sqlMap/select'. Cause: java.util.NoSuchElementException
[junit] Caused by: java.util.NoSuchElementException
[junit] Caused by: com.ibatis.common.exception.NestedRuntimeException:
Error parsing XPath '/sqlMap/select'. Cause: java.util.NoSuchElementExcept
ion
[junit] Caused by: java.util.NoSuchElementException
[junit] Caused by: com.ibatis.common.exception.NestedRuntimeException:
Error parsing XPath '/sqlMapConfig/sqlMap'. Cause: com.ibatis.common.xml.N
odeletException: Error parsing XML. Cause:
com.ibatis.common.exception.NestedRuntimeException: Error parsing XPath
'/sqlMap/select'. Cause: java.uti
l.NoSuchElementException
[junit] Caused by: java.util.NoSuchElementException
[junit] Caused by: com.ibatis.common.exception.NestedRuntimeException:
Error parsing XPath '/sqlMap/select'. Cause: java.util.NoSuchElementExcept
ion
[junit] Caused by: java.util.NoSuchElementException
[junit] Caused by: com.ibatis.common.xml.NodeletException: Error parsing
XML. Cause: com.ibatis.common.exception.NestedRuntimeException: Error pa
rsing XPath '/sqlMap/select'. Cause: java.util.NoSuchElementException
[junit] Caused by: java.util.NoSuchElementException
[junit] Caused by: com.ibatis.common.exception.NestedRuntimeException:
Error parsing XPath '/sqlMap/select'. Cause: java.util.NoSuchElementExcept
ion
[junit] Caused by: java.util.NoSuchElementException
[junit] Caused by: com.ibatis.common.xml.NodeletException: Error parsing
XML. Cause: com.ibatis.common.exception.NestedRuntimeException: Error pa
rsing XPath '/sqlMapConfig/sqlMap'. Cause:
com.ibatis.common.xml.NodeletException: Error parsing XML. Cause:
com.ibatis.common.exception.NestedRunti
meException: Error parsing XPath '/sqlMap/select'. Cause:
java.util.NoSuchElementException
[junit] Caused by: java.util.NoSuchElementException
[junit] Caused by: com.ibatis.common.exception.NestedRuntimeException:
Error parsing XPath '/sqlMap/select'. Cause: java.util.NoSuchElementExcept
ion
[junit] Caused by: java.util.NoSuchElementException
[junit] Caused by: com.ibatis.common.xml.NodeletException: Error parsing
XML. Cause: com.ibatis.common.exception.NestedRuntimeException: Error pa
rsing XPath '/sqlMap/select'. Cause: java.util.NoSuchElementException
[junit] Caused by: java.util.NoSuchElementException
[junit] Caused by: com.ibatis.common.exception.NestedRuntimeException:
Error parsing XPath '/sqlMap/select'. Cause: java.util.NoSuchElementExcept
ion
[junit] Caused by: java.util.NoSuchElementException
[junit] Caused by: com.ibatis.common.exception.NestedRuntimeException:
Error parsing XPath '/sqlMapConfig/sqlMap'. Cause: com.ibatis.common.xml.N
odeletException: Error parsing XML. Cause:
com.ibatis.common.exception.NestedRuntimeException: Error parsing XPath
'/sqlMap/select'. Cause: java.uti
l.NoSuchElementException
[junit] Caused by: java.util.NoSuchElementException
[junit] Caused by: com.ibatis.common.exception.NestedRuntimeException:
Error parsing XPath '/sqlMap/select'. Cause: java.util.NoSuchElementExcept
ion
[junit] Caused by: java.util.NoSuchElementException
[junit] Caused by: com.ibatis.common.xml.NodeletException: Error parsing
XML. Cause: com.ibatis.common.exception.NestedRuntimeException: Error pa
rsing XPath '/sqlMap/select'. Cause: java.util.NoSuchElementException
[junit] Caused by: java.util.NoSuchElementException
[junit] Caused by: com.ibatis.common.exception.NestedRuntimeException:
Error parsing XPath '/sqlMap/select'. Cause: java.util.NoSuchElementExcept
ion
[junit] Caused by: java.util.NoSuchElementException
[junit] at
com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigPa
rser.java:81)
[junit] at
com.ibatis.sqlmap.client.SqlMapClientBuilder.buildSqlMapClient(SqlMapClientB
uilder.java:62)
[junit] at
com.pbg.aps.dbconfig.SqlMapManager.init(SqlMapManager.java:36)
[junit] at
com.pbg.aps.dbconfig.SqlMapManager.getClient(SqlMapManager.java:53)
[junit] at
com.pbg.aps.model.junit.TestDbConfig.testGetClient(TestDbConfig.java:30)
[junit] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
[junit] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
[junit] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
[junit] at java.lang.reflect.Method.invoke(Method.java:324)
[junit] at junit.framework.TestCase.runTest(TestCase.java:154)