java.lang.UnsatisfiedLinkError ... invalid ELF header (Possible cause: endianness mismatch)

I get the following error when I try to load the pdfnet library on a (specific) Linux machine.

`

Caused by: java.lang.UnsatisfiedLinkError: /usr/lib64/libPDFNetC.so.6.3.2: /usr/lib64/libPDFNetC.so.6.3.2: invalid ELF header (Possible cause: endianness mismatch)
at java.lang.ClassLoader$NativeLibrary.load(Native Method) ~[na:1.7.0_55]
at java.lang.ClassLoader.loadLibrary1(Unknown Source) ~[na:1.7.0_55]
at java.lang.ClassLoader.loadLibrary0(Unknown Source) ~[na:1.7.0_55]
at java.lang.ClassLoader.loadLibrary(Unknown Source) ~[na:1.7.0_55]
at java.lang.Runtime.loadLibrary0(Unknown Source) ~[na:1.7.0_55]
at java.lang.System.loadLibrary(Unknown Source) ~[na:1.7.0_55]
at pdftron.PDF.PDFNet.(PDFNet.java:21) ~[pdfnet-6.3.2.jar:na]
at com.t_systems_mms.e_cohesion.workflow_core.impl.AbstractPdftronServiceImpl.init(AbstractPdftronServiceImpl.java:54) ~[workflow-core-1.0.0-SNAPSHOT.jar:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_55]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.7.0_55]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.7.0_55]
at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.7.0_55]

`

Further up in the log there is the following warning (which might be related or not):

Java HotSpot(TM) 64-Bit Server VM warning: You have loaded library /usr/lib64/libPDFNetC.so.6.3.2 which might have disabled stack guard. The VM will try to fix the stack guard now. It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.

I am using the latest Pdfnet for Java distribution (v.6.3.2 (updated on October 31, 2014), http://www.pdftron.com/downloads/PDFNetC64.tar.gz).

I have set the library path, placed the library there and created the symlink as per the instructions. I am using pdfnet from a web application in Tomcat 6 (6.0.24-62.el6), with Java 7 (1.7.0_55).

This is my environment:

`

[root@chive ~]# uname -a

Linux chive
3.8.13-26.2.2.el6uek.x86_64 #2 SMP Tue Mar 25 18:51:35 PDT 2014 x86_64 x86_64
x86_64 GNU/Linux

[root@chive ~]# cat /etc/*-release

LSB_VERSION=base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch
Oracle Linux Server release 6.5
Red Hat Enterprise Linux Server release 6.5 (Santiago)
Oracle Linux Server release 6.5

[root@wf-live ~]# ps -ef | grep java

tomcat 26652 1 0 Dec04 ? 00:02:36 /usr/java/jre1.7.0_55/bin/java -Djavax.sql.DataSource.Factory=org.apache.commons.dbcp.BasicDataSourceFactory -Djava.awt.headless=true -Duser.language=de -Duser.country=DE -Dfile.encoding=ISO-8859-1 -Xmx512m -Xms512m -server -XX:MaxPermSize=256m -Djavax.sql.DataSource.Factory=org.apache.commons.dbcp.BasicDataSourceFactory -Djava.awt.headless=true -Duser.language=de -Duser.country=DE -Dfile.encoding=ISO-8859-1 -Xmx512m -Xms512m -server -XX:MaxPermSize=256m -classpath :/usr/share/tomcat6/bin/bootstrap.jar:/usr/share/tomcat6/bin/tomcat-juli.jar:/usr/share/java/commons-daemon.jar -Dcatalina.base=/usr/share/tomcat6 -Dcatalina.home=/usr/share/tomcat6 -Djava.endorsed.dirs= -Djava.io.tmpdir=/var/cache/tomcat6/temp -Djava.util.logging.config.file=/usr/share/tomcat6/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager org.apache.catalina.startup.Bootstrap start

`

I have other machines (Windows, and one more Linux machine) where everything works well. The well-behaving Linux has somewhat different environment properties though (Linux chive-me 2.6.32-358.18.1.el6.x86_64 #1 SMP Wed Aug 28 17:19:38 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux; CentOS release 6.4 (Final); Java 1.7.0_40-b43).

Any help would be appreciated. Thank you.

Can you run one of the PDFNet JAVA samples in the SDK.

For example, go to Samples/ElementBuilderTest/Java and run the RunTest.sh file.

If that works, then I think you made a mistake when you “… set the library path, placed the library there and created the symlink as per the instructions”

It turns out we made a mistake when copying the file to the target system. The checksum of the file in the distribution and the checksum of the file on the target system were different.