From: whalesuit at bonbon.net (Eric E) Date: Wed, 25 May 2005 10:17:49 -0400 Subject: [Pljava-dev] libjvm.so error In-Reply-To: References: <200505242238.j4OMbxEJ015903@bigmac.hydroblaster.com> <42940D38.9040905@mailblocks.com> Message-ID: <4294890D.3040007@bonbon.net> Hi Thomas, Thanks for the help. Like Terrance, when I created a symlink in /lib that solved the problem. You are correct that this is bypassing LD_LIBRARY_PATH, but I could not figure out how to make the postmaster aware of LD_LIBRARY_PATH. My approach was to add export CLASSPATH= and export LD_LIBRARY_PATH= statements to the init script used to start the postmaster. These statements work fine with invoking the deployer from the command line: # ldd /usr/lib/postgresql/libpljava.so linux-gate.so.1 => (0xfbffd000) libjvm.so => /usr/lib/jvm/java/jre/lib/i386/server/libjvm.so (0x4001e000) libc.so.6 => /lib/i686/libc.so.6 (0x40643000) libnsl.so.1 => /lib/libnsl.so.1 (0x40757000) libm.so.6 => /lib/i686/libm.so.6 (0x4076d000) libdl.so.2 => /lib/libdl.so.2 (0x40790000) libpthread.so.0 => /lib/i686/libpthread.so.0 (0x40794000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) but they do not seem to propagate to the postmaster's environment. Any suggestions? Is there any way to find out what environment variables are set for a postmaster process? As an aside, I had put the /usr/share/pgsql/pg73b1jdbc3.jar in my CLASSPATH because it is evidently necessary to have it in the classpath when running the deployer. I've since removed it. Thanks, Eric Thomas Hallgren wrote: > Terrance, > The symbolic link you've added will make the dynamic loader find the > libjvm.so without consulting the LD_LIBRARY_PATH so something is wrong > with your LD_LIBRARY_PATH. Either it's not visible to the backend > process somehow, or it's incorrect. > > The LD_LIBRARY_PATH *is* the mechanism whereby the system (i.e. the > dynamic loader) will find either the server or the client version of > PL/Java. > > Unrelated to this problem I also see that you have > "/usr/share/pgsql/pg73b1jdbc3.jar" in your CLASSPATH. That's probably > a very bad idea. PL/Java should not have this jar in it's classpath. > Why do you need this? > > Regards, > Thomas Hallgren > > Terrance Davis wrote: > >> I was having the same error today on linux, and happened to do an >> 'ldd' on >> 'libpljava.so' >> >> As I recall, it has a dependency on libjvm.so, but the installation >> of Java >> had not told the system where to find either the server or client >> version of >> libjvm.so, so I put a symbolic link to the libjvm.so version I wanted >> to use >> in the '/lib' directory and the error went away. >> >> I'm not sure if that is the right solution, but it seems to have >> worked so >> far. >> >> Terrance >> >> >> -----Original Message----- >> From: pljava-dev-bounces at gborg.postgresql.org >> [mailto:pljava-dev-bounces at gborg.postgresql.org] On Behalf Of Eric E >> Sent: Monday, May 23, 2005 4:42 PM >> To: pljava-dev at gborg.postgresql.org >> Subject: [Pljava-dev] libjvm.so error >> >> Howdy, >> I'm having a bit of trouble installing PL/JAVA. I believe I've the >> LD_LIB and CLASSPATH variables correctly, but I'm still getting the >> error about libjvm.so: >> --------------- >> java.sql.SQLException: ERROR: could not load library >> "/usr/lib/postgresql/libpljava.so": libjvm.so: cannot open shared object >> file: No such file or directory >> --------------- >> >> I believe I'm setting both CLASSPATH and LD_LIBRARY_PATH correctly for >> my machine. Can you think of any reason why this error might occur? >> >> Below is the output of the init script to start postgres. >> >> Many thanks, >> >> Eric >> >> --------------- >> # bash -x /etc/init.d/postgresql restart >> + PG_SYSCONFIG=/etc/sysconfig/postgresql >> + test -f /etc/sysconfig/postgresql >> + . /etc/sysconfig/postgresql >> ++ POSTGRES_DATADIR='~postgres/data' >> ++ POSTGRES_OPTIONS= >> ++ POSTGRES_LANG= >> ++ >> POSTGRES_CLASSPATH=/usr/lib/postgresql/pljava/pljava.jar:/usr/share/pgsql/pg >> >> 73b1jdbc3.jar >> ++ >> POSTGRES_LD_LIBRARY_PATH=/usr/lib/jvm/java/jre/lib/i386:/usr/lib/jvm/java/jr >> >> e/lib/i386/client:/usr/lib/jvm/java/jre/lib/i386/native_threads >> + export >> CLASSPATH=/usr/lib/postgresql/pljava/pljava.jar:/usr/share/pgsql/pg73b1jdbc3 >> >> .jar >> + >> CLASSPATH=/usr/lib/postgresql/pljava/pljava.jar:/usr/share/pgsql/pg73b1jdbc3 >> >> .jar >> + export >> LD_LIBRARY_PATH=/usr/lib/jvm/java/jre/lib/i386:/usr/lib/jvm/java/jre/lib/i38 >> >> 6/client:/usr/lib/jvm/java/jre/lib/i386/native_threads >> + >> LD_LIBRARY_PATH=/usr/lib/jvm/java/jre/lib/i386:/usr/lib/jvm/java/jre/lib/i38 >> >> 6/client:/usr/lib/jvm/java/jre/lib/i386/native_threads >> + . /etc/rc.status >> ++ test -z '' -o -z '' >> +++ exec >> +++ stty size >> +++ read L C >> +++ echo LINES=24 COLUMNS=80 >> ++ eval LINES=24 COLUMNS=80 >> +++ LINES=24 >> +++ COLUMNS=80 >> ++ test 24 -eq 0 >> ++ test 80 -eq 0 >> ++ export LINES COLUMNS >> ++ case $PATH in >> ++ test -t 1 -a xterm '!=' raw -a xterm '!=' dumb >> ++ stty size >> +++ echo -en '\033' >> ++ esc=$'\E' >> ++ extd='' >> ++ warn='' >> ++ done='' >> ++ attn='' >> +++ echo -en '\017' >> ++ norm='' >> +++ echo -en >> '\015 >> ' >> ++ stat=' ' >> ++ rc_done=' >> done' >> ++ rc_running=' >> running' >> ++ rc_failed=' >> failed' >> ++ rc_missed=' >> missing' >> ++ rc_skipped=' >> skipped' >> ++ rc_dead=' >> dead' >> ++ rc_unused=' >> unused' >> ++ rc_unknown=' >> failed'' >> ++ rc_reset=''p=' >> ++ rc_save='' >> ++ rc_restor'=' >> ++ _rc_service=/etc/init.d/postgresql >> ++ _rc_status=0 >> ++ _rc_status_all=0 >> ++ _rc_todo=restart >> ++ test restart = status >> ++ test -n restart >> + LOGFILE=/var/log/postgresql >> + eval 'DATADIR=~postgres/data' >> ++ DATADIR=/var/lib/pgsql/data >> + OPTIONS= >> + H=/usr/bin/postmaster >> + test -x /usr/bin/postmaster >> + '[' -r /var/lib/pgsql/data/PG_VERSION ']' >> ++ /usr/bin/postmaster --version >> ++ sed 's/.* \([0-9]\+\.[0-9]\+\).*/\1/' >> + BIN_VERSION=7.4 >> ++ cat /var/lib/pgsql/data/PG_VERSION >> + DATA_VERSION=7.4 >> + '[' 7.4 '!=' 7.4 ']' >> + rc_reset >> + _rc_status=0 >> + _rc_status_all=0 >> + rc_check >> + _rc_status_ret=0 >> + test 0 -eq 0 >> + test 0 -eq 0 >> + return >> + return 0 >> + case "$1" in >> + /etc/init.d/postgresql stop >> Shutting down PostgreSQL >> done >> + /etc/init.d/postgresql start >> Starting PostgreSQL >> done >> + rc_status >> + rc_check >> + _rc_status_ret=0 >> + test 0 -eq 0 >> + test 0 -eq 0 >> + return >> + test 0 -gt 7 >> + _rc_status_ret=0 >> + case "$_rc_todo" in >> + local i >> + return 0 >> + rc_exit >> + exit 0 >> >> here's libjvm.so: >> >> # ls -l /usr/lib/jvm/java/jre/lib/i386/client >> total 4997 >> drwxr-xr-x 2 root root 144 Mar 18 12:11 . >> drwxr-xr-x 5 root root 976 Mar 18 12:11 .. >> -rw-r--r-- 1 root root 1386 Sep 28 2004 Xusage.txt >> lrwxrwxrwx 1 root root 13 Mar 18 12:11 libjsig.so -> ../libjsig.so >> -rwxr-xr-x 1 root root 5103795 Sep 28 2004 libjvm.so >> >> >> >> _______________________________________________ >> Pljava-dev mailing list >> Pljava-dev at gborg.postgresql.org >> http://gborg.postgresql.org/mailman/listinfo/pljava-dev >> >> _______________________________________________ >> Pljava-dev mailing list >> Pljava-dev at gborg.postgresql.org >> http://gborg.postgresql.org/mailman/listinfo/pljava-dev >> >> > > > >