Salut tout le monde ! J'ai un gros souci depuis 2 jours, je n'arrive pas à régler mon problème, je viens donc quémander de l'aide !
Environnement : linux / tomcat 6.0.29 / jdk1.0.6_u23 / Spring 2.5 / Hibernate 3.2.7 / DB2 V9.7
Lorsque je démarre mon tomcat, j'ai un erreur du type :
catalina.2010-10-07.log
localhost.2010-10-07.log
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 7 oct. 2010 12:13:49 org.apache.catalina.startup.HostConfig deployWAR INFO: Déploiement de l'archive testwapp.war de l'application web 7 oct. 2010 12:13:50 org.apache.catalina.core.StandardContext start GRAVE: Error listenerStart 7 oct. 2010 12:13:50 org.apache.catalina.core.StandardContext start GRAVE: Erreur de démarrage du contexte [/testwapp] suite aux erreurs précédentes
On constate bien qu'il remonte de loin, et après plusieurs essais, notamment en la supprimant, j'ai comme l'impression qu'il n'arrive pas à créer la dataSource (d'où la cascade d'erreurs en aval).
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 7 oct. 2010 12:15:50 org.apache.catalina.core.ApplicationContext log INFO: Initializing Spring root WebApplicationContext 7 oct. 2010 12:15:51 org.apache.catalina.core.StandardContext listenerStart GRAVE: Exception lors de l'envoi de l'évènement contexte initialisé (context initialized) à l'instance de classe d'écoute (listener) org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'txAdvice': Cannot resolve reference to bean 'testManager' while setting bean property 'transactionManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'testManager' defined in ServletContext resource [/WEB-INF/applicationContext-service.xml]: Cannot resolve reference to bean 'testDataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'testDataSource' defined in ServletContext resource [/WEB-INF/applicationContext-dao.xml]: Invocation of init method failed; nested exception is javax.naming.NamingException: Cannot create resource instance [...] Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'testManager' defined in ServletContext resource [/WEB-INF/applicationContext-service.xml]: Cannot resolve reference to bean 'testDataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'testDataSource' defined in ServletContext resource [/WEB-INF/applicationContext-dao.xml]: Invocation of init method failed; nested exception is javax.naming.NamingException: Cannot create resource instance [...] ... 42 more Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'testDataSource' defined in ServletContext resource [/WEB-INF/applicationContext-dao.xml]: Invocation of init method failed; nested exception is javax.naming.NamingException: Cannot create resource instance [...] ... 55 more Caused by: javax.naming.NamingException: Cannot create resource instance [...] ... 65 more 7 oct. 2010 12:15:51 org.apache.catalina.core.ApplicationContext log INFO: Closing Spring root WebApplicationContext 7 oct. 2010 12:15:52 org.apache.catalina.core.ApplicationContext log INFO: ContextListener: contextInitialized() 7 oct. 2010 12:15:52 org.apache.catalina.core.ApplicationContext log INFO: SessionListener: contextInitialized()
Voici l'extrait du fichier context.xml, situé dans le répertoire conf de tomcat :
et le web.xml de ma webapp :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 [...] <Resource name="jdbc/test" auth="Container" type="javax.sql.Datasource" maxActive="100" maxIdle="30" maxWait="10000" username="toto" password="toto" driverClassName="com.ibm.db2.jcc.DB2Driver" url="jdbc:db2://127.0.0.1:50000/TEST_DB2:currentSchema=toto;"/> [...]
Enfin, mon fichier applicationContext-dao.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58 <web-app> <display-name>TEST Web Application</display-name> <!-- CONTEXT-PARAM --> <context-param> <param-name>log4jConfigLocation</param-name> <param-value>/WEB-INF/log4j.properties</param-value> </context-param> <context-param> <param-name>log4jRefreshInterval</param-name> <param-value>1000</param-value> </context-param> <context-param> <param-name>flex.class.path</param-name> <param-value>/WEB-INF/flex/hotfixes,/WEB-INF/flex/jars</param-value> </context-param> <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/applicationContext*.xml </param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <listener> <listener-class>flex.messaging.HttpFlexSession</listener-class> </listener> <servlet> <servlet-name>MessageBrokerServlet</servlet-name> <display-name>MessageBrokerServlet</display-name> <servlet-class>flex.messaging.MessageBrokerServlet</servlet-class> <init-param> <param-name>services.configuration.file</param-name> <param-value>/WEB-INF/flex/services-config.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>MessageBrokerServlet</servlet-name> <url-pattern>/messagebroker/*</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <resource-ref> <description>Database TEST_DB2 Connection</description> <res-ref-name>jdbc/test</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> <res-sharing-scope>Unshareable</res-sharing-scope> </resource-ref> </web-app>
Avez-vous des idées, des pistes... j'ai bien les bons .jar dans mon répertoire lib (notamment db2jcc pour le driver..)
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 <beans> <bean id="testDataSource" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName" value="java:comp/env/jdbc/test"/> </bean> <bean id="testHibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate"> <property name="sessionFactory" ref="testSessionFactory"/> <property name="alwaysUseNewSession" value="false"/> </bean> <bean id="testSessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref local="testDataSource" /> </property> <property name="mappingResources"> <list> <value>TestOne.hbm.xml</value> <value>TestTwo.hbm.xml</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.DB2Dialect</prop> <prop key="hibernate.show_sql">true</prop> <prop key="use_sql_comments">true</prop> <prop key="hibernate.connection.autocommit">false</prop> </props> </property> </bean> [...] </beans>
Je n'arrive pas à voir pourquoi il ne parvient pas à créer le nom, visiblement c'est un problème en lien avec le JNDI mais je sèche...
Aussi, voilà mes variables $PATH & $CLASSPATH :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 echo $CLASSPATH > .:/home/jdk1.6.0_23/lib/classes.zip:/home/tomcat-daniel-6.0.29/lib/db2jcc4.jar echo $PATH > [...]:/home/jdk1.6.0_23/bin
Partager