Lists: | PostgreSQL : PostgreSQL 메일 링리스트 : 2011-12-05 이후 젠 토토 23:07 |
---|
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 |
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>
From: | johann at 2ndquadrant(dot)com (Johann 'Myrkraverk' Oskarsson) |
---|---|
To: | |
Subject: | [Pljava-dev] java.lang.NoSuchMethodError: method java.sql.ResultSet.isClosed with signature ()Z was not found. |
Date: | 2011-12-05 23:07:06 |
Message-ID: | x6fwgywrc5.fsf@2ndquadrant.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | PostgreSQL : PostgreSQL 메일 링리스트 : 2011-12-05 이후 젠 토토 23:07 |
Vorarlberger <vorarlberger at gmail.com> writes:
> PS This is on Linux postgres 9.1 and pljava 1.4.3
PL/Java 1.4.3 is built with Java 1.5 and hence implements JDBC 3. Are
you running it with Java 1.6? Normally that works fine because JNI is
backwards compatible.
You are using the JDBC 4 driver.
Please either use the JDBC 3 driver and compile and run your code with
Java 1.5 or upgrade PL/Java to CVS HEAD with Java 1.6. Then let us
know if it works or not.
--
Johann Oskarsson http://www.2ndquadrant.com/ |[]
PostgreSQL Development, 24x7 Support, Training and Services --+--
|
Blog: http://my.opera.com/myrkraverk/blog/
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-06 07:52:01 |
Message-ID: | CALtUeZYWvADROU-gVQSCVxqtFinoXDLz5fHCekxSWJnUeUxFbg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pljava-dev |
Yes you are right I am using Java 6 and jdbc 4. So I have download and
compiled pljava from cvs head - but still have an Issue:
select javatest.print(12);
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
WARNING: java.lang.NoClassDefFoundError: org.postgresql.pljava.internal.Oid
DEBUG: Destroying JavaVM...
DEBUG: JavaVM destroyed
ERROR: Unable to find method org.postgresql.pljava.internal.Oid.<init>
with signature (I)V
********** Error **********
ERROR: Unable to find method org.postgresql.pljava.internal.Oid.<init> with
signature (I)V
SQL state: XX000
2011/12/6 Johann 'Myrkraverk' Oskarsson <johann at 2ndquadrant.com>
> Vorarlberger <vorarlberger at gmail.com> writes:
>
>
> > PS This is on Linux postgres 9.1 and pljava 1.4.3
>
> PL/Java 1.4.3 is built with Java 1.5 and hence implements JDBC 3. Are
> you running it with Java 1.6? Normally that works fine because JNI is
> backwards compatible.
>
> You are using the JDBC 4 driver.
>
> Please either use the JDBC 3 driver and compile and run your code with
> Java 1.5 or upgrade PL/Java to CVS HEAD with Java 1.6. Then let us
> know if it works or not.
>
>
> --
> Johann Oskarsson http://www.2ndquadrant.com/ |[]
> PostgreSQL Development, 24x7 Support, Training and Services --+--
> |
> Blog: http://my.opera.com/myrkraverk/blog/
> _______________________________________________
> Pljava-dev mailing list
> Pljava-dev at pgfoundry.org
> http://pgfoundry.org/mailman/listinfo/pljava-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pgfoundry.org/pipermail/pljava-dev/attachments/20111206/bc1ff92b/attachment.html>
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-07 10:00:05 |
Message-ID: | CALtUeZY22i=Z+E1-EtOJ-X75jYH4qcW9p6UfUMishpTPy-U1zw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pljava-dev |
I did not get the pljava with java 1.6 to run (compilation was ok). So I
have downgraded everything to Java 1.5. This was not easy since there are
no more packages available to download. So I had to download the oracle
archives and configure everything by foot. But the good news is, its
working now like expected :-)
Thanks
Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pgfoundry.org/pipermail/pljava-dev/attachments/20111207/72b50b43/attachment.html>