Bonjour,
J'essaie de mettre en place une couche DAO Spring avec accès aux données à l'aide de Ibatis2.2.
Je travaille avec Websphère 5.1.2 et la base est une base Mysql.
Voici mes fichiers de config applicationContext.xml, sql-map-config-mysql.xml et demandes-mysql.xml qui semblent poser problème :
applicationContext.xml :
sql-map-config-mysql.xml :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <!-- la source de donnéees DBCP --> <bean id="dataSource" class="com.mysql.jdbc.jdbc2.optional.MysqlDataSource"> <property name="url"> <value>jdbc:mysql://172.27.129.16:3306/webrniam</value> </property> <property name="user"> <value>isa</value> </property> <property name="password"> <value>isa</value> </property> </bean> <!-- SqlMapDemandes --> <bean id="sqlMapDemandes" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean"> <property name="dataSource"> <ref local="dataSource"/> </property> <property name="configLocation"> <value>classpath:fr/canam/rniam/ibatis/config/sql-map-config-mysql.xml</value> </property> </bean> <!-- la classes d'accè à la couche [dao] --> <bean id="consultationFacade" class="fr.canam.rniam.fabrique.consultation.ConsultationFacadeBean"> <property name="sqlMapDemandes"> <ref local="sqlMapDemandes"/> </property> </bean> <!--accès à la couche service --> <bean id="daoService" class="fr.canam.rniam.spring.DAO.DaoImpl"/> </beans>
demandes-mysql.xml :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE sqlMapConfig PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-config-2.dtd"> <sqlMapConfig> <sqlMap resource="demandes-mysql.xml"/> </sqlMapConfig>
Voici ce que j'ai dans la console :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd"> <!-- Fichiers contenant les ordres SQL --> <sqlMap> <typeAlias alias="demandes.classe" type="fr.canam.rniam.entites.Demandes"/> <resultMap id="demandes.map" class="fr.canam.rniam.entites.Demandes"> <result property="strTypeDemande" column="type_demande"/> <result property="strEtatDemande" column="etat_demande"/> <result property="dateEmisDemande" column="date_demande"/> <result property="dateRecepReponse" column="date_reponse"/> <result property="strNir" column="nir_demande"/> <result property="strNom" column="nom_demande"/> <result property="strPrenom" column="prenom_demande"/> </resultMap> <!-- liste des demandes --> <select id="demandes.getAll" resultMap="demandes.map"> SELECT TYPE_DEMANDE, ETAT_DEMANDE, DATE_DEMANDE, DATE_REPONSE, NIR_DEMANDE, NOM_DEMANDE, PRENOM_DEMANDE FROM DEMANDES </select> </sqlMap>
Voilà, j'espère que vous pourrez m'aider, merci.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 [12/12/06 14:08:19:594 CET] 65aa571a LocalStateles W org.springframework.ejb.access.LocalStatelessSessionProxyFactoryBean TRAS0014I: L'exception suivante a été consignée : javax.ejb.EJBException: ; nested exception is: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlMapDemandes' defined in class path resource [META-INF/applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.RuntimeException: Error occurred. Cause: 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 demandes-mysql.xml org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlMapDemandes' defined in class path resource [META-INF/applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.RuntimeException: Error occurred. Cause: 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 demandes-mysql.xml java.lang.RuntimeException: Error occurred. Cause: 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 demandes-mysql.xml
Partager