Greetings all! I am writing a J2EE application with the following characteristics: Platform: Windows XP (dev box) Java version: 1.4.2_04,Sun Microsystems Inc. Java VM: Java HotSpot(TM) Client VM 1.4.2_04-b05 JBoss 3.2.3 with embedded Tomcat 4.1.24 servlet engine EJB 2.0 spec beans - Stateless Session Facade only mySQL database: 4.0.17 running on Red Hat Linux 7.3 JDBC drivers: mysql-connector-java-3.0.10-stable-bin.jar (I also tried mysql-connector-java-3.1.1-alpha-bin.jar but saw the same problem)
The servlets call the Stateless Session EJBs to perform the database work. The EJB utilizes a connection pool as defined in a file called "mysqldb-ds.xml", which contains: <?xml version="1.0" encoding="UTF-8"?> <local-tx-datasource> <!-- The jndi name of the DataSource, it is prefixed with java:/ --> <!-- Datasources are not available outside the virtual machine --> <jndi-name>mySQLDS</jndi-name> <connection-url>jdbc:mysql://10.0.10.206:3306/mydatabase </connection-url> <!-- The driver class --> <driver-class>com.mysql.jdbc.Driver</driver-class> <!-- The login and password --> <user-name>myusername</user-name> mypassword <!-- this will be run before a managed connection is removed from the pool for use by a client--> <check-valid-connection-sql>select * from user</check-valid-connection-sql> <!-- The minimum connections in a pool/sub-pool. Pools are lazily constructed on first use --> <min-pool-size>1</min-pool-size> <!-- The maximum connections in a pool/sub-pool --> <max-pool-size>5</max-pool-size> <!-- The time before an unused connection is destroyed --> <!-- NOTE: This is the check period. It will be destroyed somewhere between 1x and 2x this timeout after last use --> <idle-timeout-minutes>5</idle-timeout-minutes> <!-- sql to call when connection is created --> <new-connection-sql>select * from user</new-connection-sql> <!-- sql to call on an existing pooled connection when it is obtained from pool --> <check-valid-connection-sql>select * from user</check-valid-connection-sql> <!-- Whether to check all statements are closed when the connection is returned to the pool, this is a debugging feature that should be turned off in production --> <track-statements>true</track-statements> </local-tx-datasource> The EJB code creates a connection just fine, and the code generally works OK, but if my session times out, it appears to completely hose the JDBC connection pool and no additional connections can be created at all, even for a brand new session! I am always closing and releasing my connections/rs/statements/etc, so I don't understand why this would be happening. After this occurs, I see these errors repeatedly on a regular basis (every 2-3 minutes), and no additional connections can be created until I kill the JBoss container and restart it again: 09:29:00,274 WARN [JBossManagedConnectionPool] Unable to fill pool org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.sql.SQLException: Cannot load connection class because of unde rlying exception: 'java.lang.NullPointerException'.) at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.c reateManagedConnection(LocalManagedConnectionFactory.java:160) at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.cr eateConnectionEventListener(InternalManagedConnectionPool.java:477) at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.fi llToMin(InternalManagedConnectionPool.java:422) at org.jboss.resource.connectionmanager.PoolFiller$1.run(PoolFiller.java :63) at java.lang.Thread.run(Thread.java:534) Caused by: java.sql.SQLException: Cannot load connection class because of underl ying exception: 'java.lang.NullPointerException'. at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java :409) at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.c reateManagedConnection(LocalManagedConnectionFactory.java:150) ... 4 more 09:31:30,289 WARN [JBossManagedConnectionPool] Unable to fill pool org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.sql.SQLException: Cannot load connection class because of unde rlying exception: 'java.lang.NullPointerException'.) at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.c reateManagedConnection(LocalManagedConnectionFactory.java:160) at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.cr eateConnectionEventListener(InternalManagedConnectionPool.java:477) at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.fi llToMin(InternalManagedConnectionPool.java:422) at org.jboss.resource.connectionmanager.PoolFiller$1.run(PoolFiller.java :63) at java.lang.Thread.run(Thread.java:534) Caused by: java.sql.SQLException: Cannot load connection class because of underl ying exception: 'java.lang.NullPointerException'. at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java :409) at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.c reateManagedConnection(LocalManagedConnectionFactory.java:150) ... 4 more I can post some code if you're interested, but before I get that deep, I thought I would ask the group if this is an issue, or perhaps if there's a logical explanation for this behaviour, based on the way I've setup my connection pool. The source of the null pointer is in this block of code: ic = new InitialContext(); ds = (DataSource)ic.lookup("java:/mySQLDS"); conn = ds.getConnection(); ds = null; ps = conn.prepareStatement("select * from user where isactive = 1 and email = ? and password = PASSWORD(?) ", ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_FORWARD_ONLY); The whole thing is wrapped in a try block and the ds.getConnection() call is throwing the null pointer. Now, I am not bothering to set any env parameters for the call to InitialContext() because I'm running inside an EJB. I figured that the env would take care of itself. If I do indeed have to set some env parameters, please let me know and I'll try that as an alternative, but I'm pretty sure that the container takes care of this for you when running inside an EJB. I intend to go live with this site within 1 month, so I'm very interested in figuring out what is causing this problem, before I unleash it on the world at large! :-) Thanks for any insight you can provide! View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3835817#3835817 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3835817 ------------------------------------------------------- This SF.Net email is sponsored by: Oracle 10g Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user