6 Replies Latest reply on Sep 10, 2009 11:17 AM by Ross Nicholson

    JBoss overwiting java.library.path when native libs availabl

    Ross Nicholson Apprentice

      When using JBM1.4 my java.library.path was as follows:

      /opt/jdk1.6.0_16/jre/lib/i386/server:/opt/jdk1.6.0_16/jre/lib/i386:/opt/jdk1.6.0_16/jre/../lib/i386:
      /opt/berkeleydb/lib:/usr/java/packages/lib/i386:/lib:/usr/lib
      


      But now that I've changed to HornetQ it is this:

      /opt/jboss/bin/META-INF/lib/linux2/x86
      


      So I can't load my berkeley database anymore. I'm guessing this is a bug as JBoss used to load my $LD_LIBRARY_PATH variable into java.library.path.

      The problem lies in the run.sh script:

      JBOSS_NATIVE_DIR="$JBOSS_HOME/bin/META-INF/lib/$JBOSS_NATIVE_SYS/$JBOSS_NATIVE_CPU"
      if [ -d "$JBOSS_NATIVE_DIR" ]; then
       if $cygwin ; then
       export PATH="$JBOSS_NATIVE_DIR:$PATH"
       JBOSS_NATIVE_DIR=`cygpath --path --windows "$JBOSS_NATIVE_DIR"`
       else
       if [ "x$LD_LIBRARY_PATH" = "x" ]; then
       LD_LIBRARY_PATH="$JBOSS_NATIVE_DIR"
       else
       LD_LIBRARY_PATH="$JBOSS_NATIVE_DIR:$LD_LIBRARY_PATH"
       fi
       export LD_LIBRARY_PATH
       fi
       if [ "x$JAVA_OPTS" = "x" ]; then
       JAVA_OPTS="-Djava.library.path=$JBOSS_NATIVE_DIR"
       else
       JAVA_OPTS="$JAVA_OPTS -Djava.library.path=$JBOSS_NATIVE_DIR"
       fi
      fi
      


      In which I changed the JAVA_OPTS section to this:

      JBOSS_NATIVE_DIR="$JBOSS_HOME/bin/META-INF/lib/$JBOSS_NATIVE_SYS/$JBOSS_NATIVE_CPU"
      if [ -d "$JBOSS_NATIVE_DIR" ]; then
       if $cygwin ; then
       export PATH="$JBOSS_NATIVE_DIR:$PATH"
       JBOSS_NATIVE_DIR=`cygpath --path --windows "$JBOSS_NATIVE_DIR"`
       else
       if [ "x$LD_LIBRARY_PATH" = "x" ]; then
       LD_LIBRARY_PATH="$JBOSS_NATIVE_DIR"
       else
       LD_LIBRARY_PATH="$JBOSS_NATIVE_DIR:$LD_LIBRARY_PATH"
       fi
       export LD_LIBRARY_PATH
       fi
       if [ "x$JAVA_OPTS" = "x" ]; then
       JAVA_OPTS="-Djava.library.path=$JBOSS_NATIVE_DIR:$LD_LIBRARY_PATH"
       else
       JAVA_OPTS="$JAVA_OPTS -Djava.library.path=$JBOSS_NATIVE_DIR:$LD_LIBRARY_PATH"
       fi
      fi
      


      I don't know if my workaround is complete but it fixes the issue I'm having for the moment.

      Cheers,

      Ross