[Pljava-dev] java.lang.NoSuchMethodError: method java.sql.ResultSet.isClosed with signature ()Z was not found.

From: vorarlberger at gmail(dot)com (Vorarlberger)
To:
Subject: [Pljava-dev] java.lang.NoSuchMethodError: method java.sql.ResultSet.isClosed with signature ()Z was not found.
Date: 2011-12-05 20:08:42
Message-ID: CALtUeZZpPg_MTejvXHdhxWz+czjHtjh24eXTAVBPNNDKrV=DpQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pljava-dev

Hi

Ok, so far I understood that jdbc and pljava is not working in the same
manner.

While you can catch and proceed exceptions in jdbc you need to use
savepoints in pljava. In jdbc a sqlexception is thrown at commit and in
pljava on execute. Since I develop my javacode using jdbc and later loading
my code into the database I want to support both ways. This is almost
working except of resultsets. Is it true that we do not have a isClosed
method? Since ResultSet? Is it not mandatory to implement this method due
to the ResultSet interface definition? Or is there another error?

Check out this StackTrace:

postgres=# select queued.put_q('select 1', false);
DEBUG: StartTransactionCommand
DEBUG: StartTransaction
DEBUG: name: unnamed; blockState: DEFAULT; state: INPROGR,
xid/subid/cid: 0/1/0, nestlvl: 1, children:
DEBUG: find_in_dynamic_libpath: trying "/usr/lib/postgresql/9.1/lib/pljava"
DEBUG: find_in_dynamic_libpath: trying
"/usr/lib/postgresql/9.1/lib/pljava.so"
DEBUG: Using integer_datetimes
DEBUG: Added JVM option string
"-Djava.class.path=/usr/lib/postgresql/9.1/lib/pljava.jar:/usr/lib/postgresql/9.1/lib/postgresql-9.1-901.jdbc4.jar"
DEBUG: Added JVM option string
"-Dsqlj.defaultconnection=jdbc:default:connection"
DEBUG: Added JVM option string "vfprintf"
DEBUG: Added JVM option string "-Xrs"
DEBUG: Creating JavaVM
DEBUG: JavaVM created
DEBUG: Getting Backend class pljava.jar
DEBUG: Backend class was there
DEBUG: 05 Dec 11 20:33:26 org.postgresql.pljava.internal.Backend Using
SecurityManager for trusted language
DEBUG: className = 'kic.stalked.queued.sql.SQLInterface', methodName =
'putQ', parameters = 'null', returnType = 'null'
DEBUG: 05 Dec 11 20:33:26 org.postgresql.pljava.sqlj.Loader Creating
typeMappings for schema queued
DEBUG: 05 Dec 11 20:33:26 org.postgresql.pljava.sqlj.Loader Adding type
mapping for OID OID(24473) -> class
org.postgresql.pljava.example.ComplexTuple for schema queued
DEBUG: Loading class kic.stalked.queued.sql.SQLInterface
DEBUG: 05 Dec 11 20:33:26 org.postgresql.pljava.sqlj.Loader$1 Obtaining
type mapping for OID OID(20) for schema queued
DEBUG: 05 Dec 11 20:33:26 org.postgresql.pljava.sqlj.Loader$1 Obtaining
type mapping for OID OID(16) for schema queued
DEBUG: Obtaining method kic.stalked.queued.sql.SQLInterface.putQ
(Ljava/lang/String;Z)J
DEBUG: Method kic.stalked.queued.sql.SQLInterface.putQ
(Ljava/lang/String;Z)J not found
DEBUG: Obtaining method kic.stalked.queued.sql.SQLInterface.putQ
(Ljava/lang/String;Z)Ljava/lang/Long;
INFO: 05 Dec 11 20:33:26 kic.stalked.util.database.Query New SQL: insert
into queued.queue (what,fetch_result) values (?, ?) returning id
INFO: 05 Dec 11 20:33:26 kic.stalked.util.database.Query New bound SQL:
insert into queued.queue (what,fetch_result) values ($1, $2) returning id
DEBUG: StartSubTransaction
DEBUG: name: unnamed; blockState: STARTED; state: INPROGR,
xid/subid/cid: 0/1/0, nestlvl: 1, children:
DEBUG: name: anonymous_savepoint; blockState: SUB BEGIN; state:
INPROGR, xid/subid/cid: 0/2/0, nestlvl: 2, children:
INFO: 05 Dec 11 20:33:26 kic.stalked.util.database.Query Set savepoint
INFO: 05 Dec 11 20:33:26 kic.stalked.util.database.Query Execute SQL
insert into queued.queue (what,fetch_result) values ($1, $2) returning id
DEBUG: ProcessQuery
INFO: 05 Dec 11 20:33:26 kic.stalked.util.database.Query closing ...
INFO: 05 Dec 11 20:33:26 kic.stalked.util.database.Query ... release
savepoint
DEBUG: CommitSubTransaction
DEBUG: name: unnamed; blockState: STARTED; state: INPROGR,
xid/subid/cid: 8031/1/0 (used), nestlvl: 1, children:
DEBUG: name: anonymous_savepoint; blockState: SUB INPROGRS; state:
INPROGR, xid/subid/cid: 8032/2/0 (used), nestlvl: 2, children:
ERROR: java.lang.NoSuchMethodError: method java.sql.ResultSet.isClosed
with signature ()Z was not found.
postgres=#

and the related java code:
public void close() {
Logger.getAnonymousLogger().info("closing ... ");
batchBinds = new ArrayList<Object[]>();
if (!hasException && savePoint != null && isDefaultConnecton) {
Logger.getAnonymousLogger().info("... release savepoint");
try {
preparedStatement.getConnection().releaseSavepoint(savePoint);
} catch (SQLException e) {
StackUtils.logStackTrace("Release Savepoint failed!", e);
}
}
try {
if (!preparedStatement.getConnection().getAutoCommit() &&
!isDefaultConnecton) {
Logger.getAnonymousLogger().info("... committing");
try{
preparedStatement.getConnection().commit();
} catch (Exception e) {
StackUtils.logStackTrace("Commit failed!", e);
}
}
} catch (SQLException e) {
StackUtils.logStackTrace("ps.getConnection() failed!!!", e);
}
try {
if (rs != null && !rs.isClosed()){
Logger.getAnonymousLogger().info("... close ResultSet");
rs.close();
rs = null;
}
} catch (SQLException e) {
StackUtils.logStackTrace("close ReusltSet failed!", e);
}
try {
if (!preparedStatement.isClosed()) {
try {
Logger.getAnonymousLogger().info("... close PreparedStatement");
preparedStatement.close();
} catch (SQLException e) {
StackUtils.logStackTrace("Close PreparedStatement failed!", e);
}
}
} catch (SQLException e) {
StackUtils.logStackTrace("Corrupted PreparedStatement!!!", e);
}
}

Any Ideas?

Thanks
Chris

PS This is on Linux postgres 9.1 and pljava 1.4.3
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pgfoundry.org/pipermail/pljava-dev/attachments/20111205/626c8237/attachment.html>

Responses

Browse pljava-dev by date

  From Date Subject
Next Message John R Pierce 2011-12-05 21:52:20 [Pljava-dev] CVS HEAD is now Java 6.
Previous Message Johann 'Myrkraverk' Oskarsson 2011-12-05 12:00:09 [Pljava-dev] CVS HEAD is now Java 6.