Subject: [Pljava-dev] pljava on centos 6.5 64bit and postgres 9.? and java ?

From: pierce at hogranch.com (John R Pierce)
Date: Wed, 19 Nov 2014 13:49:38 -0800

I've got a team at another site at $JOB asking me about the state of 
pljava on centos 6.x 64bit, postgres 9.whatever and which java to use...

what IS the state of this project?    last time I tried to package 
pljava for deployment, I found it annoyingly finicky and opaque to get 
working.  most of the documentation seems quite old, and is talking 
about truly ancient java 1.4, 1.5 releases, postgres 8.0 and so forth.

Ideally, I'd like to use the RHEL6 provided openjdk 1.7 with pgdg 
provided postgres 9.3, all 64bit.  I'd really rather not have to compile 
stuff, as this is being deployed overseas and supporting them is a big 
enough pain with standard components, never mind homebrew stuff.

-- 
john r pierce                                      37N 122W
somewhere on the middle of the left coast

---

From: craig at 2ndquadrant.com (Craig Ringer)
Date: Thu, 20 Nov 2014 07:38:19 +0800

On 11/20/2014 05:49 AM, John R Pierce wrote:
> what IS the state of this project?

As far as I can tell from the mailing list and repository activity,
essentially abandoned at this point.

As someone who likes Java I'd like to see PL/Java be a more viable
option than it presently is, despite the mismatch between Java's
thread-based heavyweight-startup shared-everything-by-default model and
PostgreSQL's lightweight-process-based shared-nothing-by-default model.
PL/Java is less useful than it would be on a thread-based RDBMS because
you must use remoting to communicate between different PostgreSQL
connections within the same PostgreSQL instance, but it remains a
powerful tool ... just one that nobody seems to really be doing much
with at the moment.

PL/Java needs some remediation work in things like the logging
integration and its JDBC interface over SPI, so making it usable is not
just a matter of updating it for the latest JDK and PostgreSQL.

Like so many things I don't think many prospective users are willing to
actively contribute to its maintenance, and few people will work on JNI
code in their spare time. I have enough trouble getting people to
contribute to PgJDBC and finding time to work on that myself.

If you're interested in getting PL/Java rolling again it might be worth
speaking to someone on
  http://www.postgresql.org/support/professional_support/
about that.

Otherwise you could do what everyone else seems to when they see
PL/Java's current state and just use an external JDK.

-- 
 Craig Ringer                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

---

From: hal.hildebrand at me.com (Hal Hildebrand)
Date: Thu, 20 Nov 2014 08:36:44 -0800

Well, that hasn't been my experience. I haven't built lately but one of my devs did for our project. I just pointed him at the build and it worked for him. I didn't even have to step in and help him over hurdles. 

As to development, it's pretty fricking stable, so there's not a huge passel of work that needs to be constantly done. You can chalk this up to the way java had designed jni. Moving to a different version of Java requires nothing to change. 

As to how it works in production, I got to say I haven't had any problems. And I'm running openjpa in my stored procedures. It's an extreme case but it works like a charm. 

There's still work to do on supporting the modern jdbc driver and all the Postgres stuff. But that's work that can be done at our leisure. And it's only if you need it. 

Anyways, your mileage may vary, of course. But I don't think that one should deduce that this is a useless project just because there's not a whole lotta Dev work going on. Thanks to the jni stability of java, there really isn't all that much that needs to be done. 

At least for our project, pl/Java works, and works well.  

> On Nov 19, 2014, at 3:38 PM, Craig Ringer <craig at 2ndquadrant.com> wrote:
> 
> _______________________________________________
> Pljava-dev mailing list
> Pljava-dev at lists.pgfoundry.org
> http://lists.pgfoundry.org/mailman/listinfo/pljava-dev

---

From: pierce at hogranch.com (John R Pierce)
Date: Thu, 20 Nov 2014 14:45:54 -0800

> Well, that hasn't been my experience. I haven't built lately but one of my devs did for our project. I just pointed him at the build and it worked for him. I didn't even have to step in and help hi…

apologies for being so noobish here, but i'm running on fumes, and this 
stuff is rather far out of my comfort zone....   I generally avoid java 
stuff.

so I'm looking at the github.com/tada/pljava stuff, and its been so long 
since i've touched pljava, I can't even figure out how I should build 
it.   the 'Building' instructions aren't even remotely 'instructions', 
they are a few random notes.

are there no current binaries, with a .so for 64bit linux such as 
RHEL6/CentOS6 that will work with openjdk 1.6 ?

or, if there are no current binaries for linux, where/how do I download 
the current source, is the src-snapshot here 
http://pgfoundry.org/frs/?group_id=1000038  the latest?    there appear 
to be a few source file changes july 2013, and that snapshot is from 2012.

I'm not very familiar with using git, and where I should go to compile 
the pieces.   I think I remember I need to create two files, the .so for 
the postgres and the .jar, plus teh deployer and the test scripts.

---

From: thomas at tada.se (Thomas Hallgren)
Date: Thu, 20 Nov 2014 23:48:03 +0100

As the original creator/author of the code base I'd like to mention that while I have limited time to spend on PL/Java 
nowadays, I will help and answer questions about the code if anyone has an interest in improving it. I will also review 
and and probably accept patches in the form of pull requests to https://github.com/tada/pljava

Thomas Hallgren

---

From: pierce at hogranch.com (John R Pierce)
Date: Thu, 20 Nov 2014 15:15:12 -0800

On 11/20/2014 2:45 PM, John R Pierce wrote:
> the pieces.   I think I remember I need to create two files, the .so 
> for the postgres and the .jar, plus teh deployer and the test scripts. 

ok, I figured out this part, at least...

     $ git init
     $ git clone https://github.com/tada/pljava

---

From: pierce at hogranch.com (John R Pierce)
Date: Thu, 20 Nov 2014 15:25:53 -0800

On 11/20/2014 2:45 PM, John R Pierce wrote:
> so I'm looking at the github.com/tada/pljava stuff, and its been so 
> long since i've touched pljava, I can't even figure out how I should 
> build it.   the 'Building' instructions aren't even remotely 
> 'instructions', they are a few random notes. 

[me at c6 git]$ git clone https://github.com/tada/pljava
Initialized empty Git repository in /home/me/git/pljava/.git/
remote: Counting objects: 7574, done.
remote: Total 7574 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (7574/7574), 3.50 MiB | 1.74 MiB/s, done.
Resolving deltas: 100% (2955/2955), done.
[me at c6 git]$ cd pljava/
[me at c6 pljava]$ ls
COPYRIGHT  fixes         Makefile   pljava      pljava-api 
pljava-examples  pom.xml    src
docs       freenode.ver  packaging  pljava-ant  pljava-deploy 
pljava-so        README.md

ok, so far, so good.

[me at c6 pljava]$ export PATH=/usr/pgsql-9.2/bin:$PATH
[me at c6 pljava]$ make
make[1]: Entering directory `/home/me/git/pljava/build/classes/pljava'
make[1]: /home/me/git/pljava/cd Makefile: No such file or directory
make[1]: *** No rule to make target 
`/home/me/git/pljava/src/java/pljava/Makefile'.  Stop.
make[1]: Leaving directory `/home/me/git/pljava/build/classes/pljava'
make: *** [pljava_all] Error 2

hoookay.

$ ls src/java/
Makefile.global  test

no such directory as ./src/java/pljava to even have a Makefile ? ummmmm.

---

From: pierce at hogranch.com (John R Pierce)
Date: Thu, 20 Nov 2014 16:12:59 -0800

> `/home/me/git/pljava/src/java/pljava/Makefile'.  Stop. 

ok, so I figured out I'm supposed to use Maven.

Hmm, not in any 'sane' CentOS 6 repository, ugh, so I get apache-maven, 
put it in /opt, put that in my path, run `mvn --version` and it seems to 
be good, ok.

so I go to the pljava root, and run `mvn clean install` (hey, I have no 
idea how to do this), and it downloads a bajillion things from 
http://repo.maven.apache.org (where is all that going?!?  ahhh, 
~/.m2/...  yeesh), then...
......
[INFO] Compiling 18 source files to 
/home/me/git/pljava/pljava-api/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] Failure executing javac, but could not parse the error:
Fatal Error: Unable to find package java.lang in classpath or bootclasspath

[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] 
------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] PostgreSQL pl/java ................................ SUCCESS [0.001s]
[INFO] PL/JAVA API ....................................... FAILURE [40.656s]
[INFO] pl/java implementation ............................ SKIPPED
[INFO] pl/java deploy .................................... SKIPPED
[INFO] pl/java Ant Tasks ................................. SKIPPED
[INFO] pl/java examples .................................. SKIPPED
[INFO] pl/java server side library ....................... SKIPPED
[INFO] pl/java packaging ................................. SKIPPED
[INFO] 
------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] 
------------------------------------------------------------------------
[INFO] Total time: 41.750s
[INFO] Finished at: Thu Nov 20 23:58:25 PST 2014
[INFO] Final Memory: 9M/102M
[INFO] 
------------------------------------------------------------------------
[ERROR] Failed to execute goal 
org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile 
(default-compile) on project pljava-api: Compilation failure
[ERROR] Failure executing javac, but could not parse the error:
[ERROR] Fatal Error: Unable to find package java.lang in classpath or 
bootclasspath
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the 
-e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, 
please read the following articles:
[ERROR] [Help 1] 
http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the 
command
[ERROR]   mvn <goals> -rf :pljava-api

well, I can't find any file called java.lang in either my JVM or this 
project directory.

I'm treading in deep waters here, lost in the dark.

---

From: craig at 2ndquadrant.com (Craig Ringer)
Date: Fri, 21 Nov 2014 08:48:29 +0800

On 11/21/2014 06:48 AM, Thomas Hallgren wrote:
> As the original creator/author of the code base I'd like to mention that
> while I have limited time to spend on PL/Java nowadays, I will help and
> answer questions about the code if anyone has an interest in improving
> it. I will also review and and probably accept patches in the form of
> pull requests to https://github.com/tada/pljava

I'm glad to see that you're keeping an eye on things, and was clearly
mistaken in thinking PL/Java abandoned - simply fairly stable/mature,
and not subject to tons of ongoing change and development.

A few tweaks to the docs/makefiles to indicate the most recent tested
versions may not hurt.

---

From: pierce at hogranch.com (John R Pierce)
Date: Thu, 20 Nov 2014 19:23:53 -0800

On 11/20/2014 5:50 PM, John R Pierce wrote:
> I put /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin in the front of the 
> path and got exactly the same thing.

and for MORE fun.   I tried Sun JDK 1.6, and same thing

wait, the notes/wiki did say something about compiling in JDK 1.6 was 
broken, so I installed Sun-err-Oracle JDK 1.5.0_22 64bit, and enabled 
that as the default java with alternatives, also set my JAVA_HOME and 
PATH accordingly ...

nope.   weirder more different errors.

$ mvn compile
[INFO] Scanning for projects...
[INFO] 
------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] PostgreSQL pl/java
[INFO] PL/JAVA API
[INFO] pl/java implementation
[INFO] pl/java deploy
[INFO] pl/java Ant Tasks
[INFO] pl/java examples
[INFO] pl/java server side library
[INFO] pl/java packaging
[INFO]
[INFO] 
------------------------------------------------------------------------
[INFO] Building PostgreSQL pl/java 0.0.2-SNAPSHOT
[INFO] 
------------------------------------------------------------------------
[INFO]
[INFO] 
------------------------------------------------------------------------
[INFO] Building PL/JAVA API 0.0.2-SNAPSHOT
[INFO] 
------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ 
pljava-api ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory 
/home/me/git/pljava/pljava-api/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ 
pljava-api ---
[INFO] Compiling 18 source files to 
/home/me/git/pljava/pljava-api/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] Failure executing javac, but could not parse the error:
javac: invalid flag: -s
Usage: javac <options> <source files>
where possible options include:
   -g                         Generate all debugging info
   -g:none                    Generate no debugging info
   -g:{lines,vars,source}     Generate only some debugging info
   -nowarn                    Generate no warnings
   -verbose                   Output messages about what the compiler is 
doing
   -deprecation               Output source locations where deprecated 
APIs are used
   -classpath <path>          Specify where to find user class files
   -cp <path>                 Specify where to find user class files
   -sourcepath <path>         Specify where to find input source files
   -bootclasspath <path>      Override location of bootstrap class files
   -extdirs <dirs>            Override location of installed extensions
   -endorseddirs <dirs>       Override location of endorsed standards path
   -d <directory>             Specify where to place generated class files
   -encoding <encoding>       Specify character encoding used by source 
files
   -source <release>          Provide source compatibility with 
specified release
   -target <release>          Generate class files for specific VM version
   -version                   Version information
   -help                      Print a synopsis of standard options
   -X                         Print a synopsis of nonstandard options
   -J<flag>                   Pass <flag> directly to the runtime system

[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] 
------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] PostgreSQL pl/java ................................ SUCCESS [0.001s]
[INFO] PL/JAVA API ....................................... FAILURE [0.631s]
[INFO] pl/java implementation ............................ SKIPPED
[INFO] pl/java deploy .................................... SKIPPED
[INFO] pl/java Ant Tasks ................................. SKIPPED
[INFO] pl/java examples .................................. SKIPPED
[INFO] pl/java server side library ....................... SKIPPED
[INFO] pl/java packaging ................................. SKIPPED
[INFO] 
------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] 
------------------------------------------------------------------------
[INFO] Total time: 1.549s
[INFO] Finished at: Fri Nov 21 03:11:00 PST 2014
[INFO] Final Memory: 9M/104M
[INFO] 
------------------------------------------------------------------------
[ERROR] Failed to execute goal 
org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile 
(default-compile) on project pljava-api: Compilation failure
[ERROR] Failure executing javac, but could not parse the error:
[ERROR] javac: invalid flag: -s
[ERROR] Usage: javac <options> <source files>
[ERROR] where possible options include:
[ERROR] -g                         Generate all debugging info
[ERROR] -g:none                    Generate no debugging info
[ERROR] -g:{lines,vars,source}     Generate only some debugging info
[ERROR] -nowarn                    Generate no warnings
[ERROR] -verbose                   Output messages about what the 
compiler is doing
[ERROR] -deprecation               Output source locations where 
deprecated APIs are used
[ERROR] -classpath <path>          Specify where to find user class files
[ERROR] -cp <path>                 Specify where to find user class files
[ERROR] -sourcepath <path>         Specify where to find input source files
[ERROR] -bootclasspath <path>      Override location of bootstrap class 
files
[ERROR] -extdirs <dirs>            Override location of installed extensions
[ERROR] -endorseddirs <dirs>       Override location of endorsed 
standards path
[ERROR] -d <directory>             Specify where to place generated 
class files
[ERROR] -encoding <encoding>       Specify character encoding used by 
source files
[ERROR] -source <release>          Provide source compatibility with 
specified release
[ERROR] -target <release>          Generate class files for specific VM 
version
[ERROR] -version                   Version information
[ERROR] -help                      Print a synopsis of standard options
[ERROR] -X                         Print a synopsis of nonstandard options
[ERROR] -J<flag>                   Pass <flag> directly to the runtime 
system
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the 
-e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, 
please read the following articles:
[ERROR] [Help 1] 
http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the 
command
[ERROR]   mvn <goals> -rf :pljava-api

(and I verified, thats /exactly/ the error that the 1.5 javac gives with 
a -s, so its running the right compiler.

---

From: thomas at tada.se (Thomas Hallgren)
Date: Fri, 21 Nov 2014 08:20:34 +0100

You'll need to set the environment JAVA6_HOME (note the 6) in order for it to compile.

- thomas

On 2014-11-21 04:23, John R Pierce wrote:
>> I put /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin in the front of the path and got exactly the same thing.
>
> wait, the notes/wiki did say something about compiling in JDK 1.6 was broken, so I installed Sun-err-Oracle JDK 
> 1.5.0_22 64bit, and enabled that as the default java with alternatives, also set my JAVA_HOME and PATH accordingly ...
>
> [INFO] ------------------------------------------------------------------------
> [INFO] ------------------------------------------------------------------------
> [INFO] ------------------------------------------------------------------------
> [INFO]
> [INFO] ------------------------------------------------------------------------
> [INFO] ------------------------------------------------------------------------
> [INFO]
> [INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ pljava-api ---
> [INFO] skip non existing resourceDirectory /home/me/git/pljava/pljava-api/src/main/resources
> [INFO]
> [INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ pljava-api ---
> [INFO] Compiling 18 source files to /home/me/git/pljava/pljava-api/target/classes
>   -verbose                   Output messages about what the compiler is doing
>   -deprecation               Output source locations where deprecated APIs are used
>   -encoding <encoding>       Specify character encoding used by source files
>   -source <release>          Provide source compatibility with specified release
> [INFO] ------------------------------------------------------------------------
> [INFO] Reactor Summary:
> [INFO]
> [INFO] ------------------------------------------------------------------------
> [INFO] BUILD FAILURE
> [INFO] ------------------------------------------------------------------------
> [INFO] ------------------------------------------------------------------------
> [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on 
> project pljava-api: Compilation failure
> [ERROR] -verbose                   Output messages about what the compiler is doing
> [ERROR] -deprecation               Output source locations where deprecated APIs are used
> [ERROR] -bootclasspath <path>      Override location of bootstrap class files
> [ERROR] -endorseddirs <dirs>       Override location of endorsed standards path
> [ERROR] -d <directory>             Specify where to place generated class files
> [ERROR] -encoding <encoding>       Specify character encoding used by source files
> [ERROR] -source <release>          Provide source compatibility with specified release
> [ERROR] -target <release>          Generate class files for specific VM version
> [ERROR] -J<flag>                   Pass <flag> directly to the runtime system
> [ERROR] -> [Help 1]
> [ERROR]
> [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
> [ERROR] For more information about the errors and possible solutions, please read the following articles:
> [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
> [ERROR]
> [ERROR] After correcting the problems, you can resume the build with the command
> (and I verified, thats /exactly/ the error that the 1.5 javac gives with a -s, so its running the right compiler.
>
>

---

From: pierce at hogranch.com (John R Pierce)
Date: Mon, 24 Nov 2014 10:31:18 -0800

> You'll need to set the environment JAVA6_HOME (note the 6) in order 

ahhh, that was the magic I was missing!

[INFO] 51 files were compiled.
[INFO] Linking...
[INFO]
[INFO] 
------------------------------------------------------------------------
[INFO] Building pl/java packaging 0.0.2-SNAPSHOT
[INFO] 
------------------------------------------------------------------------
[INFO] 
------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] PostgreSQL pl/java ................................ SUCCESS [0.002s]
[INFO] PL/JAVA API ....................................... SUCCESS [0.398s]
[INFO] pl/java implementation ............................ SUCCESS [0.153s]
[INFO] pl/java deploy .................................... SUCCESS [0.025s]
[INFO] pl/java Ant Tasks ................................. SUCCESS [0.028s]
[INFO] pl/java examples .................................. SUCCESS [0.057s]
[INFO] pl/java server side library ....................... SUCCESS [9.132s]
[INFO] pl/java packaging ................................. SUCCESS [0.001s]
[INFO] 
------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] 
------------------------------------------------------------------------
[INFO] Total time: 10.911s
[INFO] Finished at: Mon Nov 24 18:30:43 PST 2014
[INFO] Final Memory: 11M/141M
[INFO] 
------------------------------------------------------------------------

yay, now on to testing.

---

From: pierce at hogranch.com (John R Pierce)
Date: Mon, 24 Nov 2014 13:15:12 -0800

> yay, now on to testing. 

where does `mvn install` put stuff, anyways??   I don't understand maven 
at all.

$ find . -name \*.so -o -name \*.jar
./pljava-ant/target/pljava-ant-0.0.2-SNAPSHOT.jar
./pljava-examples/target/pljava-examples-0.0.2-SNAPSHOT.jar
./pljava-api/target/pljava-api-0.0.2-SNAPSHOT.jar
./pljava-deploy/target/pljava-deploy-0.0.2-SNAPSHOT.jar
./pljava-so/target/nar/pljava-so-0.0.2-SNAPSHOT-amd64-Linux-gpp-shared/lib/amd64-Linux-gpp/shared/libpljava-so-0.0.2-SNAPSHOT.so
./pljava-so/target/pljava-so-0.0.2-SNAPSHOT.jar
./pljava/target/original-pljava-0.0.2-SNAPSHOT.jar
./pljava/target/pljava-0.0.2-SNAPSHOT.jar

can I assume these are the two files I need?

./pljava-so/target/nar/pljava-so-0.0.2-SNAPSHOT-amd64-Linux-gpp-shared/lib/amd64-Linux-gpp/shared/libpljava-so-0.0.2-SNAPSHOT.so
./pljava/target/pljava-0.0.2-SNAPSHOT.jar

the first one's name and path doesn't make much sense to me.

this documentation 
https://github.com/tada/pljava/wiki/Installation-guide  is really 
inadequate to figure out how to do this.

---

From: craig at 2ndquadrant.com (Craig Ringer)
Date: Tue, 25 Nov 2014 08:26:46 +0800

> ahhh, that was the magic I was missing!

Since it's not in the README, and only appears:

$ git grep -n JAVA6_HOME
pom.xml:95:
<bootclasspath>${env.JAVA6_HOME}/jre/lib/rt.jar</bootclasspath>

that's unsurprising.

Maybe the README.md could use a few pointers on building?

---

From: pierce at hogranch.com (John R Pierce)
Date: Mon, 24 Nov 2014 16:59:35 -0800

> Maybe the README.md could use a few pointers on building?

understatement of the year.

'building' page... https://github.com/tada/pljava/wiki/Building-pl-java

'installing on linux' page, 
https://github.com/tada/pljava/wiki/Installing-on-linux-%28or-other-%2Anix%29

ummmmmmm.     thats ALL I can find.