If IBatis is throwing following exception then apart from usual suspects of correct dtd declaration in sql-map-config xml and sql-map xml files, one should also look at the insert sql definition in sql-map xml.
com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'. Cause: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMap/insert'. Cause: java.util.NoSuchElementException
I had something like this in my insert query xml definition:
INSERT INTO TEST_T (ACCT_ID) VALUES (#acctId)
above mentioned sql statement throws com.ibatis.common.xml.NodeletException which is difficult to figure out.
In my case, error is due to not having closing hash (#) with acctId
If i change the insert statement to following then things work again, notice the closing # in #acctId#
INSERT INTO TEST_T (ACCT_ID) VALUES (#acctId#)
Hope that this is of some use to others who get this error.
10 comments:
thanks it saved my life , amit
saved my life as well. many thanks
Thanks. I'm converting a myBatis 3 DAO to myBatis 2 for a rare case. myBatis 3 uses a parameter syntax of #{xxx} and myBatis 2 was choking hard with the useless NoSuchElementException. Your post helped me fix my code.
Thanks.. it saved me lots of time
Thanks....my problem is also solved.now it is working fine..
Thanks alot! my problem also solved!
Thanks a lot, it helped me with my problem.
I spent almost 2 hours on this, doing all sorts of things until I searched for it and yours is the first on the result. Saved my rest of evening ... :)
Thank you!
God bless your soul ! You saved me.
I was spending 2 hours on that already, you saved my night!
I can finally finish my task!
Post a Comment