List:NDB Connectors« Previous MessageNext Message »
From:Jim Dowling Date:October 24 2007 4:07pm
Subject:ant targets
View as plain text  
Monty,
I'm at a loss as to how I get java to find the relevant JNI shared library.
Normally, i could set LD_LIBRARY_PATH or java.library.path, and JNI  
would find and load the shared library.
However, it's not happening with swig:

jdowling@localhost:~/dev/ndbconnectors/devel/java$ env | grep LD_LI

LD_LIBRARY_PATH=:/home/jdowling/.mysql/mysql/lib:/usr/local/lib
jdowling@localhost:~/dev/ndbconnectors/devel/java$ ls 
/usr/local/lib/libndbj.*
/usr/local/lib/libndbj.a   /usr/local/lib/libndbj.so.0
/usr/local/lib/libndbj.la  /usr/local/lib/libndbj.so.0.0.0
/usr/local/lib/libndbj.so

Modified ant target to include java.library.path:
  <target name="HelloWorldInsert">
    <java fork="yes" 
classname="com.mysql.cluster.ndbj.examples.HelloWorldInsert" 
failonerror="true">
      <classpath refid="NdbConnectors.classpath"/>
        <arg value="-Djava.library.path=/home/jdowling/.mysql/mysql/lib"/>
    </java>
  </target>

jdowling@localhost:~/dev/ndbconnectors/devel/java$ ant HelloWorldInsert
Buildfile: build.xml

HelloWorldInsert:
     [java] Dropping and recreating schema
     [java] java.lang.UnsatisfiedLinkError: 
com.mysql.cluster.ndbj.ndbjJNI.swig_module_init()V
     [java]     at 
com.mysql.cluster.ndbj.ndbjJNI.swig_module_init(Native Method)
     [java]     at com.mysql.cluster.ndbj.ndbjJNI.<clinit>(ndbjJNI.java:776)
     [java]     at 
com.mysql.cluster.ndbj.NdbClusterConnectionImpl.<init>(NdbClusterConnectionImpl.java:47)
     [java]     at 
com.mysql.cluster.ndbj.NdbFactory.createNdbClusterConnection(NdbFactory.java:44)
     [java]     at 
com.mysql.cluster.ndbj.examples.HelloWorldInsert.main(HelloWorldInsert.java:75)
     [java] Exception: You probably haven't set the LD_LIBRARY_PATH 
environment variable to include the location for 'libndbj.so'
     [java] java.lang.UnsatisfiedLinkError: 
com.mysql.cluster.ndbj.ndbjJNI.swig_module_init()V

BUILD SUCCESSFUL
Total time: 4 seconds

(Obviously the build wasn't succesful!)

 >ant testndbj

testndbj:
    [junit] #
    [junit] # An unexpected error has been detected by Java Runtime 
Environment:
    [junit] #
    [junit] #  SIGSEGV (0xb) at pc=0x9047361b, pid=15149, tid=3084352400
    [junit] #
    [junit] # Java VM: Java HotSpot(TM) Server VM (1.6.0-b105 mixed mode)
    [junit] # Problematic frame:
    [junit] # C  [libmysqlclient_r.so.16+0x9661b]  _db_enter_+0x3e
    [junit] #
    [junit] # An error report file with more information is saved as 
hs_err_pid




Any ideas what I'm doing wrong?

-- 

Regards,
__________________
Jim Dowling, Ph.D.

Swedish Institute of Computer Science
Box 1263, SE-164 29 Kista, Sweden

Phone +46 8 6331694
Fax +46 8 751 7230

http://www.sics.se/~jdowling/

Thread
ant targetsJim Dowling24 Oct
  • Re: ant targetsMonty Taylor24 Oct