Bonsoir,
J'ai un petit problème avec un pool de connexion sous tomcat 5.5.
J'ai renseigné le fichier context.xml de l'application avec les renseignements suivants :
Tout fonctionne correctement, mais j'ai un problème avec cela :
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 <?xml version="1.0" encoding="UTF-8"?> <Context path="/mypictures"> <Resource auth="Container" driverClassName="com.mysql.jdbc.Driver" logAbandoned="true" maxActive="100" maxIdle="30" maxWait="10000" name="jdbc/WebNativeLocalHost" password="********" removeAbandoned="true" removeAbandonedTimeout="300" type="javax.sql.DataSource" url="jdbc:mysql://127.0.0.1:3306/webnative" validationQuery="SELECT 1" testOnBorrow="true" username="ftpserver" /> <Resource auth="Container" driverClassName="com.mysql.jdbc.Driver" logAbandoned="true" maxActive="8" maxIdle="8" maxWait="10000" name="jdbc/DiorThequeLocalHost" password="********" removeAbandoned="true" removeAbandonedTimeout="300" type="javax.sql.DataSource" url="jdbc:mysql://127.0.0.1:3306/diortheque" validationQuery="SELECT 1" testOnBorrow="true" username="ftpserver" /> <Resource auth="Container" driverClassName="com.mysql.jdbc.Driver" logAbandoned="true" maxActive="8" maxIdle="8" maxWait="10000" name="jdbc/WebNativeFP" password="**********" removeAbandoned="true" removeAbandonedTimeout="300" type="javax.sql.DataSource" url="jdbc:mysql://192.168.4.250:3306/webnative" validationQuery="SELECT 1" testOnBorrow="true" username="diorthequeadmin" /> </Context>
les fichiers log de tomcat m'indique l'erreur suivante :
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 public void insertHitsid(String login, String xmldbid){ Connection connect = null; Statement stat = null; String SQL2 = "INSERT INTO hits (login,xmldbid,hits) VALUES ('"+login+"','"+xmldbid+"','0')"; try { accessdb.getDt().getConnection(); stat = connect.createStatement(); stat.executeUpdate(SQL2); } catch (SQLException ex) { ex.printStackTrace(); logueur.warn(ex.getMessage()); }finally{ if(stat != null){ try { stat.close(); } catch (SQLException ex) { ex.printStackTrace(); logueur.warn(ex.getMessage()); } stat=null; } if(connect != null){ try { connect.close(); } catch (SQLException ex) { ex.printStackTrace(); logueur.warn(ex.getMessage()); } connect=null; } } }
la ligne 1177 correspondant à :2008-06-24 19:18:01 ERROR http-8080-Processor21 org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/mypictures].[myPhotothequeControleur] - "Servlet.service()" pour la servlet myPhotothequeControleur a g?n?r? une exception
java.lang.NullPointerException
at com.maison.myphototheque.metier.myPhotothequeDAO.insertHitsid(myPhotothequeDAO.java:1177)
at com.maison.myphototheque.metier.myPhotothequeDAO.addUser(myPhotothequeDAO.java:981)
at com.maison.myphototheque.metier.myPhotothequeBusinessFacade.addUser(myPhotothequeBusinessFacade.java:72)
at com.maison.myphototheque.beans.myPhotothequeBusinessDelegate.addUser(myPhotothequeBusinessDelegate.java:69)
at com.maison.myphototheque.servlets.myPhotothequeControleur.service(myPhotothequeControleur.java:348)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Thread.java:613)
stat = connect.createStatement();
Je ne comprend pas, car par ailleurs dans le même fichier je fais un update avec la même configuration et cela fonctionne .....
Quelqu'un a-t-il une petite idée ????
Merci
Jean-Pierre
Partager