1

I installed pl/java on Ubuntu with:

sudo apt-get install postgresql-9.1-pljava-gcj

but have hit a snag which I think is a gcj/jdk 1.7 incompatibility between the jar and pl/java. These are the steps used with guidance from http://www.javacodegeeks.com/2012/10/introduction-to-postgresql-pljava.html:

select sqlj.install_jar('file:///home/me/temp/testJar.jar', 'sandbox', true);

select sqlj.set_classpath('public', 'sandbox');

CREATE FUNCTION public.hello(varchar) RETURNS varchar
AS 'sandbox.PLJava.hello'
LANGUAGE java;

We're happy until execution:

SELECT hello('world');

Which generates this error:

ERROR: java.lang.ClassFormatError: sandbox.PLJava (unrecognized class file version) SQL state: XX000

The jar was made with a standard eclipse/export to jar (jdk 1.7.0).

Anyone travel this road before? Thanks in advance.

user1351848
  • 127
  • 1
  • 1
  • 9

1 Answers1

0

This problem would be caused by, as you say, an incompatibility between the JVM that you are running via pl/java and your java code. This is hence a packaging issue if you are running everything from repos and you can follow up with your distro or compile from source.

If you can compile from source, that may be the best option at present.

Chris Travers
  • 25,424
  • 6
  • 65
  • 182