[Pljava-dev] Strange error on linux but not on windows

From: vorarlberger at gmail(dot)com (Vorarlberger)
To:
Subject: [Pljava-dev] Strange error on linux but not on windows
Date: 2011-09-20 14:32:42
Message-ID: CALtUeZZSNx7LdzQDBbji76Lo=KfPFtwH5tG9wUwtooMFnNUPKw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pljava-dev

Finally I was able to reproduce the same behavior on linux and windows. Then
I have added a new URL protocol and (re)load the missing classes via custom
classloader and sql. the Classpath is fine now.

But yet I am trapped in a security issue. I mean since I am going to read
from http(s) this is the best guess :-)

java.lang.IllegalStateException: Failure initializing default SSL context

This is not the case if I call my java from the linux command line instead
of a pljava postgres server process.

select stdout from quick_eval($$

//System.getProperties().put("org.apache.commons.logging.simplelog.defaultlog",
"fatal");
import com.gargoylesoftware.htmlunit.*;
import com.gargoylesoftware.htmlunit.html.*;
import net.sourceforge.pgnetted.*;
WebClient webClient;

//every thing works unil here
webClient = new WebClient(BrowserVersion.FIREFOX_3_6);
HtmlPage page = webClient.getPage("http://www.google.ch/search?q=lala");
print("something " + page.toString());
print("END");
$$);

Caused by:
java.lang.IllegalStateException
+
at
gnu.javax.net.ssl.provider.X509KeyManagerFactory.engineGetKeyManagers(libgcj.so.12)
+
at
javax.net.ssl.KeyManagerFactory.getKeyManagers(libgcj.so.12)
+
at
org.apache.http.conn.ssl.SSLSocketFactory.createSSLContext(SSLSocketFactory.java:187)
+
at
org.apache.http.conn.ssl.SSLSocketFactory.createDefaultSSLContext(SSLSocketFactory.java:209)

Any Ideas how to get around this?

Thanks
Chris

2011/9/19 Vorarlberger <vorarlberger at gmail.com>

> Hi
>
>
>
> > You could try to debug it with dbx from Solaris Studio on Linux and
> > put a break point on elog. Instructions can be found here:
>
> >
> http://my.opera.com/myrkraverk/blog/2010/12/11/debugging-pl-java-with-dbx
>
> > If you are able to build your own server with debug information, and
> > then PL/Java as well you'll have debug builds of both.
>
> This sounds like a lot of work to me ... I will try this tomorrow if I can
> not figure it out by today ...
>
>
> Did you check the server's log?
>>
>
> Yes but there were no additional information. But, now I got all log
> settings in postgresql.conf set to DEBUG5 and now it seems to be verbose
> enough to go into a direction .. I think ... maybe you can read more out of
> it .. I look at the marked line:
>
>
> postgres=# select stdout from quick_eval($$
> postgres$#
> System.getProperties().put("org.apache.commons.logging.simplelog.defaultlog",
> "fatal");
> postgres$# import com.gargoylesoftware.htmlunit.*;
> postgres$# import com.gargoylesoftware.htmlunit.html.*;
> postgres$# import net.sourceforge.pgnetted.*;
> postgres$#
> postgres$# WebClient webClient = new
> WebClient(BrowserVersion.FIREFOX_3_6);
> postgres$# print("END");
> postgres$# $$);
> 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"
> CONTEXT: PL/pgSQL function "quick_eval" line 6 at assignment
> DEBUG: find_in_dynamic_libpath: trying
> "/usr/lib/postgresql/9.1/lib/pljava.so"
> CONTEXT: PL/pgSQL function "quick_eval" line 6 at assignment
> DEBUG: Using integer_datetimes
> CONTEXT: PL/pgSQL function "quick_eval" line 6 at assignment
> DEBUG: Added JVM option string
> "-Dsqlj.defaultconnection=jdbc:default:connection"
> CONTEXT: PL/pgSQL function "quick_eval" line 6 at assignment
> DEBUG: Added JVM option string "vfprintf"
> CONTEXT: PL/pgSQL function "quick_eval" line 6 at assignment
> DEBUG: Creating JavaVM
> CONTEXT: PL/pgSQL function "quick_eval" line 6 at assignment
> DEBUG: JavaVM created
> CONTEXT: PL/pgSQL function "quick_eval" line 6 at assignment
> DEBUG: Getting Backend class pljava.jar
> CONTEXT: PL/pgSQL function "quick_eval" line 6 at assignment
> DEBUG: Backend class was there
> CONTEXT: PL/pgSQL function "quick_eval" line 6 at assignment
> DEBUG: className = 'net.sourceforge.pgbsh.PgBsh', methodName = 'init',
> parameters = 'null', returnType = 'null'
> CONTEXT: PL/pgSQL function "quick_eval" line 6 at assignment
> DEBUG: 18 Sep 11 06:58:12 org.postgresql.pljava.sqlj.Loader Creating
> typeMappings for schema pgbsh
> CONTEXT: PL/pgSQL function "quick_eval" line 6 at assignment
> DEBUG: Loading class net.sourceforge.pgbsh.PgBsh
> CONTEXT: PL/pgSQL function "quick_eval" line 6 at assignment
> DEBUG: Obtaining method net.sourceforge.pgbsh.PgBsh.init ()Z
> CONTEXT: PL/pgSQL function "quick_eval" line 6 at assignment
> DEBUG: className = 'net.sourceforge.pgbsh.PgBsh', methodName = 'eval',
> parameters = 'null', returnType = 'null'
>
> CONTEXT: PL/pgSQL function "quick_eval" line 7 at assignment
> DEBUG: Loading class net.sourceforge.pgbsh.PgBsh
>
> CONTEXT: PL/pgSQL function "quick_eval" line 7 at assignment
>
>
> DEBUG: Obtaining method net.sourceforge.pgbsh.PgBsh.eval
> (Ljava/lang/String;Ljava/sql/ResultSet;)Z
>
> CONTEXT: PL/pgSQL function "quick_eval" line 7 at assignment
> DEBUG: Exception in function ereport
> ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
>
> CONTEXT: PL/pgSQL function "quick_eval" line 7 at assignment
> DEBUG: An attempt was made to call a PostgreSQL backend function after an
> elog(ERROR) had been issued
>
> CONTEXT: PL/pgSQL function "quick_eval" line 7 at assignment
> INFO: 18 Sep 11 06:58:16 org.postgresql.pljava.sqlj.Loader Failed to load
> class
>
> java.sql.SQLException: An attempt was made to call a PostgreSQL backend
> function after an elog(ERROR) had been issued
> at org.postgresql.pljava.internal.Oid._forSqlType(pljava.so)
> at org.postgresql.pljava.internal.Oid.forSqlType(pljava.so)
> at org.postgresql.pljava.jdbc.SPIPreparedStatement.setObject(pljava.so)
> at org.postgresql.pljava.jdbc.SPIPreparedStatement.setInt(pljava.so)
> at org.postgresql.pljava.sqlj.Loader.findClass(pljava.so)
> at java.lang.ClassLoader.loadClass(libgcj.so.12)
> at java.lang.ClassLoader.loadClass(libgcj.so.12)
> at java.lang.Class.forName(libgcj.so.12)
> at java.lang.Class.initializeClass(libgcj.so.12)
> at bsh.Parser.Block(Parser.java:2763)
> at bsh.Parser.Statement(Parser.java:2674)
> at bsh.Parser.WhileStatement(Parser.java:3016)
> at bsh.Parser.Statement(Parser.java:2715)
> at bsh.Parser.BlockStatement(Parser.java:2812)
> at bsh.Parser.Line(Parser.java:200)
> at bsh.Interpreter.Line(Interpreter.java:1012)
> at bsh.Interpreter.eval(Interpreter.java:649)
> at bsh.Interpreter.eval(Interpreter.java:756)
> at bsh.Interpreter.eval(Interpreter.java:745)
> at bsh.TargetError.xPrintTargetError(TargetError.java:126)
> at bsh.TargetError.printTargetError(TargetError.java:101)
> at bsh.TargetError.getMessage(TargetError.java:81)
> at java.lang.Throwable.getLocalizedMessage(libgcj.so.12)
> at java.lang.Throwable.toString(libgcj.so.12)
> at java.lang.Throwable.stackTraceString(libgcj.so.12)
> at java.lang.Throwable.printStackTrace(libgcj.so.12)
> at net.sourceforge.pgbsh.PgBshInterpreter.eval(PgBshInterpreter.java:94)
> at net.sourceforge.pgbsh.PgBsh.eval(PgBsh.java:88)
>
>
> CONTEXT: PL/pgSQL function "quick_eval" line 7 at assignment
> DEBUG: An attempt was made to call a PostgreSQL backend function after an
> elog(ERROR) had been issued
>
> CONTEXT: PL/pgSQL function "quick_eval" line 7 at assignment
> ERROR: java.sql.SQLException: An attempt was made to call a PostgreSQL
> backend function after an elog(ERROR) had been issued
> CONTEXT: PL/pgSQL function "quick_eval" line 7 at assignment
> postgres=# --
>
> Here is the very same on windows:
>
> postgres=# select stdout from quick_eval($$
> postgres$#
> System.getProperties().put("org.apache.commons.logging.simplelog.defaultlog",
> "fatal");
> postgres$# import com.gargoylesoftware.htmlunit.*;
> postgres$# import com.gargoylesoftware.htmlunit.html.*;
> postgres$# import net.sourceforge.pgnetted.*;
> postgres$#
> postgres$# WebClient webClient = new
> WebClient(BrowserVersion.FIREFOX_3_6);
> postgres$# print("END");
> postgres$# $$);
> 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 "C:/Program
> Files/PostgreSQL/9.0/pljava/pljava"
> KONTEXT: PL/pgSQL function "quick_eval" line 5 at Zuweisung
> DEBUG: find_in_dynamic_libpath: trying "C:/Program
> Files/PostgreSQL/9.0/pljava/pljava.dll"
> KONTEXT: PL/pgSQL function "quick_eval" line 5 at Zuweisung
> DEBUG: Using integer_datetimes
> KONTEXT: PL/pgSQL function "quick_eval" line 5 at Zuweisung
> DEBUG: Added JVM option string "-Djava.class.path=C:\Program
> Files\PostgreSQL\9.0\pljava\deploy
> .jar;C:\Program Files
> (x86)\PostgreSQL\pgJDBC\postgresql-8.4-702.jdbc4.jar;C:\Program
> Files\PostgreSQL\9.0\pljava\pgnett
> ed.jar;C:\Program Files (x86)\Java\jre6\lib\ext\QTJava.zip"
> KONTEXT: PL/pgSQL function "quick_eval" line 5 at Zuweisung
> DEBUG: Added JVM option string
> "-Dsqlj.defaultconnection=jdbc:default:connection"
> KONTEXT: PL/pgSQL function "quick_eval" line 5 at Zuweisung
> DEBUG: Added JVM option string "vfprintf"
> KONTEXT: PL/pgSQL function "quick_eval" line 5 at Zuweisung
> DEBUG: Added JVM option string "-Xrs"
> KONTEXT: PL/pgSQL function "quick_eval" line 5 at Zuweisung
> DEBUG: Creating JavaVM
> KONTEXT: PL/pgSQL function "quick_eval" line 5 at Zuweisung
> DEBUG: JavaVM created
> KONTEXT: PL/pgSQL function "quick_eval" line 5 at Zuweisung
> DEBUG: Getting Backend class pljava.jar
> KONTEXT: PL/pgSQL function "quick_eval" line 5 at Zuweisung
> DEBUG: Backend class was there
> KONTEXT: PL/pgSQL function "quick_eval" line 5 at Zuweisung
> DEBUG: 19 Sep 11 16:30:38 org.postgresql.pljava.internal.Backend Using
> SecurityManager for untrusted language
> KONTEXT: PL/pgSQL function "quick_eval" line 5 at Zuweisung
> DEBUG: className = 'net.sourceforge.pgbsh.PgBsh', methodName = 'init',
> parameters = 'null', returnType = 'null'
> KONTEXT: PL/pgSQL function "quick_eval" line 5 at Zuweisung
> DEBUG: 19 Sep 11 16:30:38 org.postgresql.pljava.sqlj.Loader Creating
> typeMappings for schema pgbsh
> KONTEXT: PL/pgSQL function "quick_eval" line 5 at Zuweisung
> DEBUG: Loading class net.sourceforge.pgbsh.PgBsh
> KONTEXT: PL/pgSQL function "quick_eval" line 5 at Zuweisung
> DEBUG: Obtaining method net.sourceforge.pgbsh.PgBsh.init ()Z
> KONTEXT: PL/pgSQL function "quick_eval" line 5 at Zuweisung
> DEBUG: className = 'net.sourceforge.pgbsh.PgBsh', methodName = 'eval',
> parameters = 'null', returnType = 'null'
> KONTEXT: PL/pgSQL function "quick_eval" line 6 at Zuweisung
> DEBUG: Loading class net.sourceforge.pgbsh.PgBsh
> KONTEXT: PL/pgSQL function "quick_eval" line 6 at Zuweisung
> DEBUG: Obtaining method net.sourceforge.pgbsh.PgBsh.eval
> (Ljava/lang/String;Ljava/sql/ResultSet;)Z
> KONTEXT: PL/pgSQL function "quick_eval" line 6 at Zuweisung
> DEBUG: className = 'net.sourceforge.pgbsh.PgBsh', methodName = 'fin',
> parameters = 'null', returnType = 'null'
> KONTEXT: PL/pgSQL function "quick_eval" line 7 at Zuweisung
> DEBUG: Loading class net.sourceforge.pgbsh.PgBsh
> KONTEXT: PL/pgSQL function "quick_eval" line 7 at Zuweisung
> DEBUG: Obtaining method net.sourceforge.pgbsh.PgBsh.fin ()Z
> KONTEXT: PL/pgSQL function "quick_eval" line 7 at Zuweisung
> DEBUG: CommitTransactionCommand
> DEBUG: CommitTransaction
> DEBUG: name: unnamed; blockState: STARTED; state: INPROGR,
> xid/subid/cid: 0/1/0, nestlvl: 1, children:
> stdout
> --------
> END\r +
>
> (1 Zeile)
>
>
> postgres=#
> If you want to have a look into the source "
> net.sourceforge.pgbsh.PgBsh.eval", you can do so here:
>
> http://sourceforge.net/p/pgnetted/svn/35/tree/trunk/PgNetted/PgBsh/src/net/sourceforge/pgbsh/
>
> Thanks
> Chris
>
> PS I am using pljava 1.4.2-4ubuntu1 and postgres 9.1 on my linux test host.
> on my windows machine I am on postgres 9.0 and pljava 1.4.2. w64. I use
> openjdk 6 on linux and oracle jdk 6 on windows.
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pgfoundry.org/pipermail/pljava-dev/attachments/20110920/fe65e9c1/attachment.html>

In response to

Responses

Browse pljava-dev by date

  From Date Subject
Next Message Johann 'Myrkraverk' Oskarsson 2011-09-20 15:11:28 [Pljava-dev] Strange error on linux but not on windows
Previous Message Vorarlberger 2011-09-19 14:52:47 [Pljava-dev] Found, but not solved - Re: Strange error on linux but not on windows