2013年9月11日星期三

About mybatis problem, experts into

I'm currently using struts2 + spring + mybatis for development, making mybatis configuration when there is a question about :

I applicationContext.xml were defined as follows:






In sqlMapConfig.xml , make the following definition :





In userMap.xml , make the following definition :










Question: When I start tomcat , the following questions arise :
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'sqlMapClient' defined in ServletContext resource [/ WEB-INF/applicationContext.xml]: Invocation of init method failed; ; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: ServletContext resource [/ WEB-INF/sqlMapConfig.xml]; nested exception is 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 WEB-INF/userMap.xml

Note: I have identified , in
WEB-INF / 's path, does exist userMap.xml, but why I still can not find it ?
------ Solution ---------------------------------------- ----
not on the web-inf down on the src directory such as build sqlMap folder
------ Solution ----------- ---------------------------------
Could not find resource WEB-INF/userMap. xml
find userMap.xml
mybatis configuration files are not placed under the WEB-INF
------ Solution ------------------------ --------------------
not recommended on the WEB-INF . find a place just fine.



so !
------ Solution ---------------------------------------- ----

right, in src , the path Prev plus classpath
------ Solution ---------------- ----------------------------

should be such
------ Solution - ------------------------------------------
think you this kind of wrote
put you sqlmap.xml your service package under

can also be placed directly under the src directory


------ Solution ------------------------------------ --------


+1

own special place see folders Well xml file

------ Solution ------------------------------------ --------




will mybatis configuration file into the src below it .
Then the mapper files into a single package which best a

;

------ Solution --------------------- -----------------------
the userInfo-mapper.xml best placed under src or build their own under the src folder placed userInfo- mapper.xml
------ For reference only ----------------------------------- ----
no one knows what ? ; (
------ For reference only ------------------------------------ ---
under the src I also tried it , but also not
------ For reference only --------------------- ------------------
Re : strike2368168
I do not mybatis configuration files
------ For reference only ---------------------------- -----------
I also encountered the same problem, my problem is the
"http://www.ibatis.com/dtd/sql-map-config-2.dtd"> This changed after the written 3.dtd like

没有评论:

发表评论