Subject: [Pljava-dev] Can't install pljava with Postgres 8.3 and Java 1.5 on WinXP Pro (for Adempiere 3.42s)

From: stefanscottalexx at gmail.com (Stefan Scott Alexander)
Date: Wed, 9 Jun 2010 02:51:11 -0300

Hi -

I need to install pljava so that I can use Adempiere 3.42s, an open-source
ERP (enterprise resource planning) suite which uses Java, Postgres, and
pljava.

I've been trying for three days to install pljava with Postgres 8.3 and Java
1.5 on Windows XP, but it always returns an error message about not being
able to load pljava.dll.

(I admit that I wasted a day trying to install pljava with Postgres 8.4 and
Java 1.6, until I finally found a message here:

http://old.nabble.com/pljava-install-problems-td28493671.html

<http://old.nabble.com/pljava-install-problems-td28493671.html>saying that
this isn't supported. More specifically, it says that there *is* a way to
install pljava with Postgres 8.4 and run with Java 1.6, if you use use CVS
to download the sources for pljava and build using Java 1.5. I installed
Tortoise CVS and managed to checkout the sources to my WinXP machine, but
then I got stuck because I couldn't figure out how to do the build. I
noticed that the sources included a file called Makefile, and also included
some C header files. This confused me. I've only done builds in Java on
Windows using Ant or Maven - I have no idea how to do a build in Java on
Windows involving a Makefile. I do have a Debian server elsewhere, so I
thought about trying to do the build there - but it's already running Java
1.6 under Debian Lenny, and I'm afraid of messing that server up if I were
to install Java 1.5 on it just for the purpose of trying to build pljava
from source. Anyways, the errors I've been getting always involve a file
called pljava.dll, and I'm not sure that doing a make under Debian would
produce a dll file, as they are used for Windows.)

I'm on the verge of a nervous breakdown now from frustration and lack of
sleep, since every time I attempt a new approach, I think I'm close to
getting it to work this time... and then I end up staying up till 4 or 5 in
the morning until finally collapsing from exhaustion.

I'm accustomed to encountering difficulties when installing new software.
However, this situation seems worse that the normal, because Google turns up
lots of people with this same problem, but no people offering a solution.

According to this Google search, pljava may be broken since Postgres 8.3:

http://www.google.com/search?&safe=off&q=pljava+broken+8.3RC1

This is unfortunate, as pljava is an important procedural language for
Postgres. In particular, pljava is required by Adempiere, which is one of
the top open-source ERP (enterprise resource planning) packages.

Does anyone have a fix to enable installing pljava in Postgres 8.3 (or
later) on Windows?

+++

As far as I understand, there are two methods for installing pljava. Neither
one has worked. The complete error messages are shown below, essentially
saying:

ERROR: could not load library "C:/Program
Files/PostgreSQL/8.3/lib/pljava.dll": The specified module could not be
found.

By the way, the file pljava.dll does exist in the above directory. I assume
the error message means that some other module (which pljava.dll is
dependent on) couldn't be found.

Method 1:

C:\Program Files\PostgreSQL\8.3\share\pljava>java
org.postgresql.pljava.deploy.Deployer -install -database adempiere -user
postgres -password postgres

org.postgresql.util.PSQLException: ERROR: could not load library "C:/Program
Files/PostgreSQL/8.3/lib/pljava.dll": The specified module could not be
found.

        at
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1608)
        at
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1343)
        at
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:194)
        at
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:451)
        at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:336)
        at
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:328)
        at
org.postgresql.pljava.deploy.Deployer.initJavaHandlers(Deployer.java:474)
        at org.postgresql.pljava.deploy.Deployer.main(Deployer.java:269)

Method 2:

C:\Program Files\PostgreSQL\8.3\share\pljava>psql -f install.sql adempiere
postgres

Password for user postgres:
CREATE SCHEMA
GRANT
psql:install.sql:6: ERROR:  could not load library "C:/Program
Files/PostgreSQL/8.3/lib/pljava.dll": The specified module could not be
found.

psql:install.sql:8: ERROR:  function sqlj.java_call_handler() does not exist
psql:install.sql:12: ERROR:  could not load library "C:/Program
Files/PostgreSQL/8.3/lib/pljava.dll": The specified module could not be
found

psql:install.sql:14: ERROR:  function sqlj.javau_call_handler() does not
exist
psql:install.sql:23: NOTICE:  CREATE TABLE will create implicit sequence
"jar_repository_jarid_seq" for serial column "jar_repository.jarid"
psql:install.sql:23: NOTICE:  CREATE TABLE / PRIMARY KEY will create
implicit index "jar_repository_pkey" for table "jar_repository"
psql:install.sql:23: NOTICE:  CREATE TABLE / UNIQUE will create implicit
index "jar_repository_jarname_key" for table "jar_repository"
CREATE TABLE
GRANT
psql:install.sql:32: NOTICE:  CREATE TABLE will create implicit sequence
"jar_entry_entryid_seq" for serial column "jar_entry.entryid"
psql:install.sql:32: NOTICE:  CREATE TABLE / PRIMARY KEY will create
implicit index "jar_entry_pkey" for table "jar_entry"
psql:install.sql:32: NOTICE:  CREATE TABLE / UNIQUE will create implicit
index "jar_entry_jarid_key" for table "jar_entry"
CREATE TABLE
GRANT
ALTER TABLE
psql:install.sql:43: NOTICE:  CREATE TABLE / PRIMARY KEY will create
implicit index "classpath_entry_pkey" for table "classpath_entry"
CREATE TABLE
GRANT
psql:install.sql:50: NOTICE:  CREATE TABLE will create implicit sequence
"typemap_entry_mapid_seq" for serial column "typemap_entry.mapid"
psql:install.sql:50: NOTICE:  CREATE TABLE / PRIMARY KEY will create
implicit index "typemap_entry_pkey" for table "typemap_entry"
CREATE TABLE
GRANT
psql:install.sql:55: ERROR:  language "java" does not exist
psql:install.sql:59: ERROR:  language "java" does not exist
psql:install.sql:63: ERROR:  language "java" does not exist
psql:install.sql:67: ERROR:  language "java" does not exist
psql:install.sql:71: ERROR:  language "java" does not exist
psql:install.sql:75: ERROR:  language "java" does not exist
psql:install.sql:79: ERROR:  language "java" does not exist
psql:install.sql:83: ERROR:  language "java" does not exist
psql:install.sql:87: ERROR:  language "java" does not exist

Method 3 - Following the instructions here:

http://www.adempiere.com/index.php/Adempiere_Install_WinXp

<http://www.adempiere.com/index.php/Adempiere_Install_WinXp>I added the
following lines to the file C:\Program
Files\PostgreSQL\8.3\data\postgresql.conf:

custom_variable_classes = 'pljava'
pljava.classpath = 'C:\\Program
Files\\PostgreSQL\\8.3\\share\\pljava\\pljava.jar'
pljava.release_lingering_savepoints = true
pljava.vmoptions = '-Xmx64M -Dbackchannel.port=48'
pljava.debug = false

and and stopped and started the Postgres server before attempting the above
two methods, but they still returned the same error messages.

+++

Here are the attempts I've made to try to diagnose and fix this problem.
None of these attempts has worked.

Attempt 1 - I checked my JRE_HOME environment variable in WinXP. I made sure
that it was a system variable (not a user variable), and that it's included
in the PATH environment variable. I also rebooted the computer.

If I do:

dir %JRE_HOME%\bin\client

the output looks ok:

 Directory of C:\programs\Java\jdk1.5.0_22\jre\bin\client

06/08/2010  02:43 PM    <DIR>          .
06/08/2010  02:43 PM    <DIR>          ..
06/08/2010  02:43 PM        12,713,984 classes.jsa
10/09/2009  03:16 AM         1,626,233 jvm.dll
06/08/2010  02:37 PM             1,447 Xusage.txt

If I do:

PATH

the output (with some returns added for readability) also looks ok:

PATH=
C:\windows\system32;
C:\Programs\MaudeFW\2.4\cygwin\bin;
C:\Program Files\PC Connectivity Solution;
C:\Program Files\ATI Technologies\ATI.ACE\Core-Static;
C:\Program Files\TortoiseSVN\bin;
C:\Sun\SDK\lib\ant\bin;
C:\programs\maven\apache-maven-2.2.1\bin;
C:\Programs\PostgreSQL\8.4\bin;
C:\programs\Java\jdk1.5.0_22\bin;
C:\programs\Java\jdk1.5.0_22\jre\bin;
C:\programs\Java\jdk1.5.0_22\jre\bin\client;
C:\Program Files\CVSNT\;C:\Program Files\PostgreSQL\8.3\bin

So the file jvm.dll should be available.

By the way, I have un-installed Postgres 8.3, deleted the WinXP user
postgres, re-booted the computer, re-installed Postgres 8.3 (with the above
environment variables in effect), hoping that this might make the Postgres
8.3 installer add pljava during the install, but no luck. During the
Postgres 8.3 install, there is a tree of components to be installed which
initially shows "PL/Java" with a red "X" on it, so of course I changed this
to "Install to hard disk". Later during the install, there is a list of
procedural languages which can be installed, and only the first one is
checked - the remaining ones (including "PL/Java") are all dimmed, and
unchecked, and cannot be checked.

Attempt 2 - I used a program called Dependency Walker to check whether
pljava.dll has any unsatisfied dependencies. This program gave one error and
one warning:

- The error said that there was a dll which pljava.dll depended on, called
c:\windows\system32\libeay32.dll, which had "an unresolved import due to a
missing export function in an implicitly dependent module."

- The warning said that there was a dll which pljava.dll depdended on,
called c:\windows\system32\mpr.dll, which had an "unresolved import due to a
missing export function in a delay-load dependent module."

I tried two ways of fixing the error: First, I tried to install OpenSSH for
Windows, which includes the dll libeay32.dll, and I copied this dll into
C:\windows\system32. That didn't resolve the error message. Then I noticed
that directory c:\Program Files\PostgreSQL\8.3\bin also contains a file
called libeay32.dll, so I copied that into c:\windows\system32, and that
resolved the error message.

I couldn't figure out a way to resolve the warning about the other dll,
mpr.dll - but since it's only a warning (not an error), maybe it's not
fatal.

Attempt 3 - I also tried installing using various EnterpriseDB installers,
to see if they gave different results. But the same error messages continued
to occur.

+++

I'm totally stuck and I don't know what to do now. I'd really like to be
able to use pljava with Postgres.

Thanks for any help.

- Scott Alexander
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pgfoundry.org/pipermail/pljava-dev/attachments/20100609/bc774fbb/attachment.html>

---

From: pierce at hogranch.com (John R Pierce)
Date: Tue, 08 Jun 2010 23:18:36 -0700

Stefan Scott Alexander wrote:
> Hi -
>
> I need to install pljava so that I can use Adempiere 3.42s, an 
> open-source ERP (enterprise resource planning) suite which uses Java, 
> Postgres, and pljava.

according to the adempiere website, this installer here 
http://www.adempiere.com/index.php/Windows_Installer  has everything you 
need, including Postgres, for Windows.

---

From: stefanscottalexx at gmail.com (Stefan Scott Alexander)
Date: Wed, 9 Jun 2010 03:28:17 -0300

Thanks John.

I did try the Windows installer you mentioned:

http://www.adempiere.com/index.php/Windows_Installer

However, it gave an "erroneous" error message immediately after launching,
saying that the version of Postgres installed on the machine was earlier
than 8.1. This error message was wrong, since I had either:

- NO Postgres installed (because I assumed that the Windows installer would
include Postgres)

- later I had Postgres 8.3 installed.

The Windows installer quit immediately after displaying this message.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pgfoundry.org/pipermail/pljava-dev/attachments/20100609/d72669f9/attachment.html>

---

From: pierce at hogranch.com (John R Pierce)
Date: Tue, 08 Jun 2010 23:34:43 -0700

Stefan Scott Alexander wrote:
> However, it gave an "erroneous" error message immediately after 
> launching, saying that the version of Postgres installed on the 
> machine was earlier than 8.1. This error message was wrong, since I 
> had either:
>
> - NO Postgres installed (because I assumed that the Windows installer 
> would include Postgres)
>

then, I'd contact whatever support forums this project has.  until you 
posted here, I'd never heard of this 'most popular ERP' package.

btw, I also see that the newest versions no longer require PLJava, per 
http://www.adempiere.com/index.php/PLJAVA

---

From: stefanscottalexx at gmail.com (Stefan Scott Alexander)
Date: Wed, 9 Jun 2010 22:28:25 -0300

Thanks for the reply. I have managed to fix the problem. My JRE_HOME was
pointing to Java 1.5, but my CLASSPATH was pointing to Java 1.6. And I
couldn't get PL/Java 1.4 to install using Java 1.6.

Actually there was a further twist involving the ERP application
Adempiere-3.4.2-s I was trying to install: it apparently won't run with Java
1.5, only with Java 1.6!

So I had to use Java 1.5 to install PL/Java, and then Java 1.6 to run the
application Adempiere-3.4-2-s.

(I can't wait till deployment dependencies for big Java projects such as
Adempiere ERP are always routinely encoded in an executable Maven POM file
rather than scattered across the internet in how-to's and forums... but
that's off-topic. :-)

On Wed, Jun 9, 2010 at 3:34 AM, John R Pierce <pierce at hogranch.com> wrote:

> _______________________________________________
> 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/20100609/544b524b/attachment.html>