Hi,
I have our UPSERT logic working when executing UPSERT's serially via the
Phoenix JDBC driver. Each such update gets a connection from the
DriverManager using the Phoenix JDBC URL a la "jdbc:phoenix:localhost"
(we're running Hadoop and HBase in the pseudo-distributed mode right now).
The logic then executes a PreparedStatement with the UPSERT, then closes
the statement, then closes the connection.
However, when each such upsert is executed from a worker thread within a
thread executor, I'm getting exceptions on the console as below.
"Connection is null or closed" or "The Phoenix jdbc driver has been
closed".
Any ideas what may be going on and how to fix this or work around it?
Thanks.
Exception in thread "pool-6-thread-1" java.lang.IllegalArgumentException:
Connection is null or closed.
at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:308)
at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:291)
at
org.apache.phoenix.query.HTableFactory$HTableFactoryImpl.getTable(HTableFactory.java:52)
at
org.apache.phoenix.query.ConnectionQueryServicesImpl.getTable(ConnectionQueryServicesImpl.java:270)
at
org.apache.phoenix.query.ConnectionQueryServicesImpl.incrementSequenceValues(ConnectionQueryServicesImpl.java:1733)
at
org.apache.phoenix.query.ConnectionQueryServicesImpl.validateSequences(ConnectionQueryServicesImpl.java:1681)
at
org.apache.phoenix.compile.SequenceManager.validateSequences(SequenceManager.java:171)
at
org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:225)
at
org.apache.phoenix.jdbc.PhoenixPreparedStatement.executeUpdate(PhoenixPreparedStatement.java:167)
at com.acme.UpdateWorker.executeTask(UpdateWorker.java:147)
at com.acme.UpdateWorker.run(DbUpdateWorker.java:107)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:701)
Exception in thread "pool-6-thread-2" java.lang.IllegalStateException: The
Phoenix jdbc driver has been closed.
at
org.apache.phoenix.jdbc.PhoenixDriver.checkClosed(PhoenixDriver.java:160)
at
org.apache.phoenix.jdbc.PhoenixDriver.getConnectionQueryServices(PhoenixDriver.java:111)
at
org.apache.phoenix.jdbc.PhoenixEmbeddedDriver.connect(PhoenixEmbeddedDriver.java:112)
at java.sql.DriverManager.getConnection(DriverManager.java:615)
at java.sql.DriverManager.getConnection(DriverManager.java:195)
at com.acme.util.SqlUtils.getDbConnection(SqlUtils.java:187)
at com.acme.util.SqlUtils.getDbConnection(SqlUtils.java:157)
at com.acme.UpdateWorker.executeTask(DbUpdateWorker.java:141)
at com.acme.UpdateWorker.run(DbUpdateWorker.java:107)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:701)
Exception in thread "pool-6-thread-3" java.lang.IllegalStateException: The
Phoenix jdbc driver has been closed.
at
org.apache.phoenix.jdbc.PhoenixDriver.checkClosed(PhoenixDriver.java:160)
at
org.apache.phoenix.jdbc.PhoenixDriver.getConnectionQueryServices(PhoenixDriver.java:111)
at
org.apache.phoenix.jdbc.PhoenixEmbeddedDriver.connect(PhoenixEmbeddedDriver.java:112)
at java.sql.DriverManager.getConnection(DriverManager.java:615)
at java.sql.DriverManager.getConnection(DriverManager.java:195)
at com.acme.SqlUtils.getDbConnection(SqlUtils.java:187)
at com.acme.SqlUtils.getDbConnection(SqlUtils.java:157)
at com.acme.UpdateWorker.executeTask(DbUpdateWorker.java:141)
at com.acme.UpdateWorker.run(DbUpdateWorker.java:107)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:701)
|