Bug 13100 - NullPointerException when starting or stopping tests with a JDBC Connection
Summary: NullPointerException when starting or stopping tests with a JDBC Connection
Status: CLOSED FIXED
Alias: None
Product: JMeter - Now in Github
Classification: Unclassified
Component: Main (show other bugs)
Version: 1.7Beta3
Hardware: PC other
: P3 normal (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-09-27 21:49 UTC by Orr Bernstein
Modified: 2004-11-16 19:05 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Orr Bernstein 2002-09-27 21:49:25 UTC
I believe I found a bug in the
org.apache.jmeter.protocol.jdbc.util.DBConnectionManager class.

The errant symptom was a NullPointerException being thrown with the following 
stack trace:
java.lang.NullPointerException
        at java.util.Hashtable.get(Unknown Source)
        at 
org.apache.jmeter.protocol.jdbc.util.DBConnectionManager.releaseConnection
(DBConnectionManager.java:211)
        at org.apache.jmeter.protocol.jdbc.sampler.JDBCSampler.sample
(JDBCSampler.java:169)
        at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:138)
        at java.lang.Thread.run(Unknown Source)


The conditions under which this exception was triggered were as follow:
- Test Plan
    - Test Group (number of threads 1; ramp-up 0; loop count 100)
        - JDBC Database Connection Pool Defaults (pool size 5; max usage 50)
        - JDBC Database Login Defaults (...)
        - JDBC Request (pool size 5; max usage 50; query="[valid query]")
        - Constant Timer (thread delay 100 ms)
        - Graph Results
        - View Results Tree


The exception is thrown in either of the following two scenarios:
User "starts" the test (from the "Run" menu)
User can either allow the test to complete or not...
User "stops" the test (from the "Run" menu)

Any starting or stopping of the test after this point, including the last 
mentioned stop, yields the aforementioned NullPointerException.

The error is a simple one, though, and can be easily fixed.

The solution is as follows:
Insert between line 190 and line 191 the following lines of code:
	 if(connectionArray==null) {
		setup(key);
		connectionArray=(ConnectionObject[])connections.get(key);
	 }
Comment 1 Orr Bernstein 2002-09-27 21:50:10 UTC
Again, the solution is as follows:
Insert between line 190 and line 191 the following lines of code:
	 if(connectionArray==null) {
		setup(key);
		connectionArray=(ConnectionObject[])connections.get(key);
	 }
Comment 2 Orr Bernstein 2002-09-27 22:00:54 UTC
My apologies; forgot to mention the class in error:
Insert between line 190 and line 191 of class,
    org.apache.jmeter.protocol.jdbc.util.DBConnectionManager
the following lines of code:
	 if(connectionArray==null) {
		setup(key);
		connectionArray=(ConnectionObject[])connections.get(key);
	 }
Comment 3 Jordi Salvat i Alabart 2002-12-27 16:15:21 UTC
Marking all bugs RESOLVED before JMeter 1.8's release date as VERIFIED.
Yes, it's pretty poor QA procedure, but there's bugs here lingering since JMeter
1.6, and we need to clean up a little.
Comment 4 Jordi Salvat i Alabart 2002-12-29 14:20:30 UTC
Bulk-closing all bugs RESOLVED before JMeter 1.8 release date.
Comment 5 The ASF infrastructure team 2022-09-24 20:37:28 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/947