From: johann at 2ndquadrant.com (Johann 'Myrkraverk' Oskarsson) Date: Wed, 04 May 2011 16:38:36 -0000 Subject: [Pljava-dev] Fwd: Re: Calling it a day In-Reply-To: References: <4DBB58FD.3090004@gmail.com> <4DC0E8AB.4000105@gmail.com> Message-ID: On Wed, 04 May 2011 15:14:04 -0000, JOSE CARLOS MARTINEZ LLARIO wrote: > > Hi Erik, > I just checked it out right now getting the same results than I got some > weeks before. > W7 64 - Pg 9 32 - JRE 32 - PLJAVA 32 - Working > W7 64 - Pg 9 32 - JRE 64 - PLJAVA 32 - not working, with this error: > ERROR: could not load library "c:/jaspa4pg/lib/pljava.dll": %1 is not a > valid Win32 application. > Do not why with JRE 64 is not working but with JRE 32 I can tell you > that its working for sure. That is expected. It's simply not possible to mix 32bit and 64bit code in applications [*]. However, the error message is misleading, the %1 is not referring to pljava.dll but to some dependency of it. In this case jvm.dll. It is interesting to note that the error messages coming from the dynamic linker (part of the operating system) are totally useless on Windows. It is possible that Postgres is not filling the %1 in correctly, but I have a feeling that's Windows' fault. Compare this with the equivalent message on Solaris: % java -cp $CLASSPATH org.postgresql.pljava.deploy.Deployer \ -host pgnode1 -port 58903 -database template1 \ -user postgres9 -install org.postgresql.util.PSQLException: ERROR: could not load library "/opt/myrkraverk/postgresql/9.0.3/lib/amd64/pljava.so": ld.so.1: postgres: fatal: libjvm.so: open failed: No such file or directory Here the server has only 32bit Java installed. Linux should have an ent- irely equivalent message. Also, when the dependency, jvm.dll, is not found, Windows says psql:C:/jaspa4pg/sql/pljavainstall.sql:6: ERROR: could not load library "c:/jaspa4pg/lib/pljava.dll": The specified module could not be found. What module? My previous error message on Solaris told me exactly what it wasn't finding. The solution here is to add the JRE bin directories to the system Path and then restart the server. I'm re-iterating these problems and solutions for posterity. In the hope that some future googler will find them useful. Unix (all I've used) has entirely different search paths for 32bit and 64bit dynamic libraries so there is no naming conflict here, unlike Wind- ows it seems. [*] This is not always true, 64bit kernels (of various operating systems) can run 32bit applications. They do however have the necessary hooks to mix the execution contexts. Unlike normal applications. -- Johann Oskarsson http://www.2ndquadrant.com/ |[] PostgreSQL Development, 24x7 Support, Training and Services --+-- | Blog: http://my.opera.com/myrkraverk/blog/