Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@www.apache.org Received: (qmail 84893 invoked from network); 11 Nov 2003 09:57:31 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 11 Nov 2003 09:57:31 -0000 Received: (qmail 23717 invoked by uid 500); 11 Nov 2003 09:56:46 -0000 Delivered-To: apmail-jakarta-tomcat-user-archive@jakarta.apache.org Received: (qmail 23627 invoked by uid 500); 11 Nov 2003 09:56:45 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 23611 invoked from network); 11 Nov 2003 09:56:45 -0000 Received: from unknown (HELO mail.promonte.com) (195.66.163.195) by daedalus.apache.org with SMTP; 11 Nov 2003 09:56:45 -0000 Content-Class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 Subject: Problem with ConnectionPool on Linux Date: Tue, 11 Nov 2003 10:56:56 +0100 Message-ID: <08CA2C0404E2EE42AABFD6025E4142B002A637F0@mail.promonte.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Problem with ConnectionPool on Linux Thread-Index: AcOoOiRu/xNcRW9tQa+Xdua6jvcUPA== From: "Veselin Kovacevic" To: X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Hi, I have o problem with Tomcat 4.1.24 on SuseLinux7.3. Our application has Controller servlet (below) where using connection objects from connection pool. When tomcat started, application working fine and everything OK that day. But next day when we try to start application we get error message in isUser method (PortalUserDB class). It's first place where we use connection object in application. Method isUser is very simple method for authenticate user (below). We get this exception:=20 SQL Exception:java.sql.SQLException: No operations allowed after connection closed Connection object is not null in this case, and this message for me is not correct. Next, if I restart tomcat, everything working ok... (for next day). On windows (we using windows for development platform) we have not this problem. What is problem?=20 Is configuration server.xml or similar configuration files on Linux different rather on windows? Note: On both platform we using Tomcat 4.1.24 and j2sdk1.4.1_03. public class Controller extends HttpServlet {=09 private DataSource ds; =09 public void init(ServletConfig config) throws ServletException { super.init(config); try { InitialContext initCtx =3D new InitialContext(); Context envCtx =3D (Context)initCtx.lookup("java:comp/env");=20 ds =3D (DataSource)envCtx.lookup("jdbc/MySQLPool"); } catch (Exception e){ throw new UnavailableException(e.getMessage()); } } =09 public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { =09 request.setCharacterEncoding("iso-8859-2"); =09 ........................ ........................ if (ds !=3D null) { Connection conn =3D ds.getConnection(); if (conn !=3D null) { boolean isUserExists =3D PortalUserDB.isUser(conn, userName, userPass); ........................ ........................=09 conn.close(); } ........................ ........................ } } public static boolean isUser(Connection conn, String userName, String userPass) throws SQLException, IOException { String query =3D "SELECT user_name FROM admin_user " + "WHERE user_name =3D ? " + "AND user_pass =3D ?"; =09 boolean isUserExists =3D false; =09 try { PreparedStatement pstmt =3D conn.prepareStatement(query); pstmt.setString(1, userName); pstmt.setString(2, userPass); =09 ResultSet rs =3D pstmt.executeQuery(); =09 isUserExists =3D rs.next(); =09 rs.close(); rs =3D null; pstmt.close(); pstmt =3D null; =09 } catch (SQLException sqle) { PortalLog.addLogLine("Class: PortalUserDB, Method: isUser. SQL Exception:" + sqle, userName); } =09 return isUserExists; } Thanks, Veso --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-user-help@jakarta.apache.org