Wrong ELF class: How does one successfully install OpenSpliceDDS? - java

I've been trying to install and successfully run OpenSplice DDS on CentOS, The initial objective is to get it installed and run the HelloWorld Example (In Java),I did make the files necessary, using make, the compilation stage for subscriber and publisher steps which require compilation (of .jar) is very presistant, I've been working on this for almost 2-3 weeks, the problem is, there is very few documents and/ or resources discussing issues related to DDS installation(and there are many), I also tried to consult with my professor, he hinted to me that this could be a compatibility problem,sometime when I fix one issue with this installation another issue comes up, below is my current output:
[root#localhost standalone]# java -jar saj_helloworld_sub.jar
OpenJDK 64-Bit Server VM warning: You have loaded library /root/Downloads/HDE/x86.linux/lib/libdcpssaj.so 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'.
org.opensplice.dds.dcps.DomainParticipantFactoryImpl.get_instance() failed: /root/Downloads/HDE/x86.linux/lib/libdcpssaj.so: /root/Downloads/HDE/x86.linux/lib/libdcpssaj.so: wrong ELF class: ELFCLASS32 (Possible cause: architecture word width mismatch)
Exception in thread "main" java.lang.NullPointerException
at DDS.DomainParticipantFactory.create_participant(Unknown Source)
at DDSEntityManager.createParticipant(DDSEntityManager.java:67)
at HelloWorldDataSubscriber.main(HelloWorldDataSubscriber.java:38)
Java Version:
# java -version
openjdk version "1.8.0_111"
OpenJDK Runtime Environment (build 1.8.0_111-b15)
OpenJDK 64-Bit Server VM (build 25.111-b15, mixed mode)
System Details :
# uname -a
Linux localhost.localdomain 3.10.0-327.36.1.el7.x86_64 #1 SMP Sun Sep 18 13:04:29 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
So, the wrong ELF class is one of the possible errors that I may get,the difficulty of getting DDS installed and working correctly is not encountered only by me alone, some other friends of mine also having different errors,and since no resources and discussions exist online about OpenSplice DDS installation(except the official website and the readme file), i decided to open this discussion.

You're running a 64bit operating system - the x86_64 indicates this.
You're running a 64bit java VM - OpenJDK 64-Bit Server VM (build 25.111-b15, mixed mode)
You've got a 32-bit library: /root/Downloads/HDE/x86.linux/lib/libdcpssaj.so: wrong ELF class: ELFCLASS32 (Possible cause: architecture word width mismatch)
The simplest workaround is to download the 64bit version of OpenSplice DDS to get past this issue.

Related

Issues with javac-algs4 compiler

I am trying to use Princeton Course specific Java Compiler (javac-algs4) on my windows machine and am seeing this error:
$ javac-algs4
warning: [path] bad path element "/usr/local/lift/lib/algs4.jar": no such file or directory
javac: no source files
This is related to Princeton Algorithms 1 Course. I followed the instructions on installing IntelliJ Idea from https://lift.cs.princeton.edu/java/windows/ and other steps to configure CLASSPATH.
javac and java work ok on HelloWorld programs, but I am expecting javac-algs4 to work for programs that use Course specific libraries.
It seems to me like a Unix Path may be hidden in the JAR file that I`m using in the CLASSPATH, and that may be breaking things for me. (Notice the /usr/local... directory in my error)
What steps could I take to troubleshoot and resolve the error?
Other Version Info:
openjdk version "1.8.0_191"
OpenJDK Runtime Environment (build 1.8.0_191-8u191-b12-2ubuntu0.18.04.1-b12)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)
Javac Version: javac 10.0.2

Tomcat 7 + JNI: UnsatisfiedLinkError: cannot open shared object file: No such file or directory

Here's my problem: I have a WAR file which contains my webapp, and a .jar in its WEB-INF/lib which depends on .so files to be present on the host where Tomcat is running. When I deploy my WAR file through the app manager, I get an UnsatisfiedLinkError: file not found in the startup logs when the JNI wrapper class is loaded from the .jar. When I look in the directory where the linked libraries are, they are clearly present, and have world read and execute permissions, and I've even changed the owner to be the same run-as user executing tomcat. I am fairly certain this is a permissions problem, because I can execute the WAR file on the command line, and I do not get the error. I'm hoping that someone can spot something I have missed, or direct me to some Tomcat documentation I've misread.
Here's the full text of the error when deployed via Tomcat manager:
07 Apr 2017 10:45:53,140 [ERROR] [... omitted irrelevant log output ...] java.lang.UnsatisfiedLinkError: /opt/omitted-sdk-name/linux_x86_64/bin/libjni_emdq.so: libemdq.so: cannot open shared object file: No such file or directory
If I shut down tomcat via systemctl stop tomcat and execute my war file like this (as root), I do not get the UnsatisfiedLinkError:
java -Djava.library.path=/opt/omitted-sdk-name/linux_x86_64/bin -jar /path/to/my/app##0.1.war
Some other useful info:
CentOS 7
Fresh, vanilla install via yum (no deviations from default config, except to enable the admin user on the manager and switch the default jvm).
/usr/sbin/tomcat version shows:
Server version: Apache Tomcat/7.0.69
Server built: Nov 6 2016 01:55:51 UTC
Server number: 7.0.69.0
OS Name: Linux
OS Version: 3.10.0-514.10.2.el7.x86_64
Architecture: amd64
JVM Version: 1.8.0_121-b13
JVM Vendor: Oracle Corporation
Tomcat is running as user tomcat
I've tried changing ownership from root to tomcat of all the .so files in this sdk. Changing owners did not change the actual behavior. For example, this owner/mode yields the problem - same owner as the tomcat run-as user, and full read+executable permission, which I expected would have fixed things:
[root#omitted-host bin]# ls -la | grep emdq
-rwxr-xr-x 1 tomcat tomcat 403153 Nov 10 03:10 libemdq.so
-rwxr-xr-x 1 tomcat tomcat 76850 Nov 10 03:11 libjni_emdq.so
EDIT: There seems to be two versions of Java on this machine. The one in root's path is 1.8.0_77 and the one configured for tomcat is 1.8.0_121:
[root#omitted-host tomcat]# java -version
java version "1.8.0_77"
Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode)
[root#omitted-host tomcat]# /etc/alternatives/jre_1.8.0_openjdk/bin/java -version
openjdk version "1.8.0_121"
OpenJDK Runtime Environment (build 1.8.0_121-b13)
OpenJDK 64-Bit Server VM (build 25.121-b13, mixed mode)
output of file on the two .so in question shows they are 64-bit libs, so I don't think there's a problem with running in a 64-bit JVM:
[root#omitted-host bin]# file libjni_emdq.so
libjni_emdq.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped
[root#omitted-host bin]# file libemdq.so
libemdq.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped
I have these lines in a file in $CATALINA_HOME/conf/conf.d/omittedname.conf. At some point in the past, I had them in tomcat.conf but either location seems to yield the same results.
MY_BIN="/opt/omitted-sdk-name/linux_x86_64/bin"
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$MY_BIN"
JAVA_OPTS="$JAVA_OPTS -Djava.library.path=$MY_BIN -Djava.security.egd=file:/dev/./urandom -Djava.awt.headless=true -XX:+UseConcMarkSweepGC"
# needed to run the application
JAVA_OPTS="$JAVA_OPTS -Dprofile=test"
EDIT: after posting this, I noticed that root has a different jvm in its path. Java version above was edited too.
[root#omitted-host tomcat]# echo $PATH
/java/jdk1.8.0_77/bin:/opt/omitted-sdk-name/linux_x86_64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
Is there anything else I can try looking at? Do I possibly need to add a java.io.FilePermissions permission?
Also, just a humble statement that I am aware of the implications of running/owning things as root. My goal is just to get back to a working tomcat manager configuration to un-break this development server.
This answer is less than satisfying, but it was the key to solving my problem. I had to move the statement LD_LIBRARY_PATH=/opt/omitted-sdk-name/linux_x86_64/bin from $CATALINA_HOME/conf/conf.d/myapp.conf to $CATALINA_HOME/conf/tomcat.conf. After I did this, the UnsatisfiedLinkError disappeared.

Install java plugin in chrome in Ubuntu 14.04

I have installed Oracle Java 7 in my /home directory by following steps given here (by just changing the path of installation). But still I cannot see the plugin listed in the chrome://plugins tab.
I also cannot see it running in JavaTester or here. I have tried enabling by following steps provided here but nothing works.
Some specifications:
Operating System: Ubuntu 14.04
output of java -version:
java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
Please comment if anything more is needed for resolving the problem
Just pull it from webupd8 servers. Follow the directions at the following link.
http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html
Also, this belongs on a different forum. This forum is for programming questions, installing a chrome plugin isn't really what we do. Next time post to the Ubuntu stack exchange located here.

Open MPI's Java bindings

I'm trying to build the new Java bindings of Open MPI (v.openmpi-1.9a1r29661) on Macbook Pro running Mavericks (OSX 10.9). I have the JDK 7 installed:
^_^:examples demirelo $ java -version
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
I configured the OMPI with that command:
./configure --enable-mpi-java --with-platform=optimized --with-jdk-dir=/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home --prefix=/Users/demirelo/libs/openmpi
which is followed by the usual suspect:
make all install
When I tried to run the HelloWorld example, I received the following runtime error:
^_^:examples demirelo $ ../bin/mpijavac Hello.java
^_^:examples demirelo $ ../bin/mpirun -np 1 java Hello
JAVA BINDINGS FAILED TO LOAD REQUIRED LIBRARIES
-------------------------------------------------------
Primary job terminated normally, but 1 process returned
a non-zero exit code.. Per user-direction, the job has been aborted.
Moreover, the ~/.bash_profile has the correct path to the /lib folder.
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/Users/demirelo/libs/openmpi/lib/
It's quite mysterious which libraries failed. Previously, I was able to build slightly older version (openmpi-1.9a1r28578) on Lion and still use it on Mavericks. This time I needed a freshly compiled OMPI but didn't work out. I'm wondering if anyone else had the same issue with Mavericks and was able to fix it.
This appears to be a bug in Open MPI that is comprised of at least two issues:
OMPI is hard-coded to try to dlopen libmpi.so, which is the wrong name on OS X (it should be libmpi.dylib).
Even after I fix that, I'm running into another Java error that I need to run by the Java programmers.
Apparently, we haven't tested the OMPI Java bindings on OS X in a long time. :-(
Such is the life of running against the SVN trunk. Sorry!

How to get remote debugging work for Java on Solaris

I am trying to get remote debugging working with Java on Solaris OS. Following is what I have tried-
I have a Java class called TestP which has the main method.
When I try
java -classpath . TestP
the program works fine. But when I try adding the debug parameters to the JVM-
java -Xdebug -Xrunjdwp:transport=dt_socket,address=8001,server=y,suspend=n -classpath . TestP
It fails giving this error-
UTF ERROR ["../../../src/solaris/npt/utf_md.c":49]: Failed to complete iconv_open() setup
Can anyone please help me on figuring out why this error is coming up?? The above works fine on my Linux box.
Java version on Solaris:
Java(TM) SE Runtime Environment (build 1.6.0_15-b03)
Java HotSpot(TM) Client VM (build 14.1-b02, mixed mode)
Java version on Linux:
java version "1.6.0_0"
OpenJDK Runtime Environment (IcedTea6 1.5) (fedora-20.b16.fc10-i386)
OpenJDK Server VM (build 14.0-b15, mixed mode)
Hmm... This seems to be a known Solaris (not specific to Solaris 10) issue with Java 6, not a Java issue (see this thread).
Someone has successfully applied a workaround (see this blog post) from a Sun guy, Jeff Moguillansky, but I wouldn't recommend it and rather consider searching sunsolve for a patch as indicated on Sun's forums.
Look at this one: http://sunsolve.sun.com/search/document.do?assetkey=1-1-6586755-1 (you'll need a Sun Online Account with a valid Support Contract or Software Subscription).
Using truss I found out that the process was looking for /usr/lib/iconv/geniconvtbl/binarytables/UTF-8%646.bt and 646%UTF-8.bt, so I just copied ISO8859-1%ISO646.bt to UTF-8%646.bt and ISO646%ISO8859-1.bt to 646%UTF-8.bt (yes, it is "646", not "ISO646"!)
This is of course a very ugly workaround and I have no idea if it has any negative effects on the JVM, but at least it starts the JVM without aborting. (I did this on OpenSolaris 2009.06, btw)
If Pascal Thivent is right, then you may want to try running OpenSolaris (either on a blank machine or in a vm) and see if the problem is also there. If not, then consider using that version for now if possible.

Categories