Problems starting Java

If running a legacy java app on a newer RH or RHEL system, youget:

Error occurred during initialization of VM
Unable to load native library:
.../libjava.so: symbol __libc_wait, version GLIBC_2.0 not
defined in file libc.so.6 with link time reference

This is a symptom of an older JDKs that is buggy. Jakub Jelinek of RedHat suggests the following:

gcc -O2 -shared -o ~/libcwait.so -fpic -xc - <<EOF
#include <errno.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <sys/wait.h>
pid_t
__libc_wait (int *status)
{
  int res;
  asm volatile ("pushl %%ebxnt"
                "movl %2, %%ebxnt"
                "movl %1, %%eaxnt"
                "int $0x80nt"
                "popl %%ebx"
                : "=a" (res)
                : "i" (__NR_wait4), "0" (WAIT_ANY), "c" (status), "d" (0),
                  "S" (0));
  return res;
}
EOF

and using LD_ASSUME_KERNEL=2.4.19 LD_PRELOAD=~/libcwait.so when you need to load the buggy JDK.

This entry was posted in Java and tagged , , . Bookmark the permalink.

NewPush has solutions to fit your business needs.  For more than a decade, our focus has been to take on the technical challenges that are the hardest and most time-consumming.  Our goal is to free up your resources to focus on the core activities of your business and to drive your business performance.  Please visit our main site at newpush.com for more information or call us at +1-303-423-4500.