I am using IBM MQ as client to put/get messages .
when trying to create MQMessage reqMsg= new MQMessage() getting below exception
java.lang.NoClassDefFoundError: Could not initialize class com.ibm.mq.internal.MQCommonServices
But com.ibm.mq.jar is available inside my war.The same code is working in my windows machine but not working in linux(smoke) server.This will happen often but when i replace the existing mq jar with new one it used to start working again. But this time no luck.
Below some key points may help to figure out the issue.
1)we manually uploaded jars into artifact with version 7.1.0.6 since the server is running with same version and hence client side also need to have same version of jar.
But when i did java -jar com.ibm.mq.jar it shows as below
Name: WebSphere MQ classes for Java
Version: 8.0.0.5
Level: p800-005-160516.2
Build Type: Production
2) i have below jars with version 7.1.0.6 in my war to put/get messages from/to server.
com.ibm.mq.allclient
com.ibm.mq.axis2
com.ibm.mq.commonservices
com.ibm.mq.headers
com.ibm.mq
com.ibm.mq.jmqi
com.ibm.mq.jms.Nojndi
com.ibm.mq.pcf
com.ibm.mq.soap
com.ibm.mq.tools.ras
com.ibm.mq.traceControl
com.ibm.mqjms
3) i am using jdk 1.8.
Any help is greatly appreciated.
com.ibm.mq.allclient.jar did not exist prior to IBM MQ v8, so it can not be from a v7.1.0.6 install.
Check the MANIFEST.MF file in each jar to check what version of IBM MQ it is from.
On linux you can use this following command, replace the jar name with each jar.
unzip -p com.ibm.mq.jar META-INF/MANIFEST.MF|grep Implementation-Version
The error you are receiving is likely because of a mis-match between jar versions. Validate that all jar files are from the SAME version of IBM MQ.
Related
I am trying to run a java application on spring boot running on ubuntu. My application has a dependency on a jar file that loads two binaries:
"libc++_shared.so" and "libsigx.so"
I extracted the jar file and so files from an aar file that is created as a dependency for android, but I would really like to use this on my server. I was able to write the java code I need without an issue after I added the jar file as dependency to my spring boot application.
However, when these binaries are loaded(e.g System.loadLibrary("c++_shared")) in Java, I got an exception saying that libc.so is not found. Apparently, I needed to install some other binaries, so I installed the necessary binaries to my docker container by using
sudo apt-get install build-essential
Now I have all the binaries needed(libc.so, libm.so etc), but now when I run my jar file I get invalid ELF header exception:
Caused by: java.lang.UnsatisfiedLinkError: /usr/java/packages/lib/libc++_shared.so: /lib/x86_64-linux-gnu/libc.so: invalid ELF header
When I run the readelf -h command on so files:
The c++ so file has OS/ABI: UNIX - System V header, while libc.so has OS/ABI: UNIX - GNU. Looks like binaries are not compatible and I am trying to find to solve this.
Couple of questions that come to mind are:
Is it possible to get these binaries to run in a compatible way with some commands? Maybe convert binary for system v to gnu somehow?
Is it possible to find "libc++_shared.so" and "libsigx.so" created for OS/ABI: UNIX - GNU
I am open to any workaround to get these libraries running together. Thanks
Introduction
I've been assigned to an old Java Facets application, and in order to do my work I have to do a reverse ingeneering task first, hence running the project on my machine.
Problem
So the project seems to build fine and it's supposed to run on a Tomcat 7 server but it's been 3 days now and i've tried pratically everything I could think of to fix this single output :
/home//.jdks/temurin-17.0.3/bin/java -Dfile.encoding=UTF-8 -classpath /tmp/classpath1653361017.jar com.intellij.javaee.oss.process.JavaeeProcess 40057 org.jetbrains.idea.tomcat.agent.TomEEAgent
/home//apache-tomee-plume-7.0.9/bin/catalina.sh run
[2022-05-11 09:49:54,280] Artifact MyProject:war exploded: Waiting for server connection to start artifact deployment...
/home/azesa/apache-tomee-plume-7.0.9/bin/catalina.sh: line 427: /var/lib/snapd/snap/intellij-idea-ultimate/353/bin/java: No such file or directory
Disconnected from server
Stuff I tried
I tried to manually configure the catalina.sh but ended up breaking it.
I changed the /etc/profile file and added two export statements one of the JAVA_HOME and the other for the CATALINA_HOME
I have also copied the WAR file in the /webapps directory trying to run doirectly, but it's too messy and it oesn't seem to work
Please HELP
To run TomEE 7, you need to use Java 7 or Java 8.
Your log indicate, that you try to run with Java 17, which won't work. Java 17 ist only supported in TomEE 8.0.11 (Jakarta EE 8) or TomEE 9.0.0+M8-SNAPSHOT (Jakarta EE 9.1).
In addition, it looks like your Environment variables (JAVA_HOME) point to a non existing Java executable.
I have a Jenkins master on Windows server 2016 and a node on RHEL 7. When I try to connect from client to master using Java Web start the jnlp file is downloaded with no problems. The issue happens when javaws opens the file I get the following error : "com.sun.deploy.net.FailedDownloadException: Unable to load resource http://localhost:8080/jnlp.jars/remoting.jar" In the Java Console I used the proxy settings from the master which uses an automated .pac file. I have jdk 8 update 181 on both master and node.
I found someone with a similar issue on Stackoverflow. The issue is with the way the jnlp file gets edited on import and takes out the master hostname and inserts "localhost." Since the file obviously doesn't exist locally the jnlp load fails.
This is a practices that configure httpd service by adding weblogic apache plugin to support apache frontage to route traffic. This process is fellowing Puneeth Prakash's Oracle blog:
https://blogs.oracle.com/blogbypuneeth/configuring-wls-web-server-proxy-plug-in-for-apache-http-server-v2
Working environment as: Centos 7, apache 2.4.29.
I first tried install weblogic apache plugin for 12c (WLSPlugins12c-12.1.2), There are four libs in the lib directory, two modules for httpd and other two dynamic shared libs. Unfortunately, this version not work properly on ajax request, some time make session invalid.
Next I tried newer version as: WLSPlugin12.2.1.2.0. There are seven files in lib directory, two files for module libs and others 5 as shared dynamic load libs. I tried to put all files in lib directory into /usr/local/lib and change the owner to root:root, change mode to 755 for all files and then put a line in config file 00-base.conf in /etc/httpd/conf.modules.d directory. such as: "LoadModule weblogic_module /usr/local/lib/mod_wl_24.so" system load mod_wl_24.so properly, but not load dependency libopmnsecure.so, error as:
"Jan 06 16:22:49 centos.mywebsite.com.au httpd[4001]: httpd: Syntax error on line 58 of /etc/httpd/conf/httpd.conf: Syntax error on line 67 of /etc/httpd/conf.modules.d/00-base.conf: Cannot load /usr/local/lib/mod_wl_24.so into server: libopmnsecure.so: cannot open shared object file: No such file or directory"
From the error message we can see, mod_wl_24 is trying load dependent Dynamic lib libopmnsecure.so, but not found it in place. But, it is not true, libopmnsecure.so just seating in same directory with mod_wl_24.so. As Puneeth Prakash's Oracle blog required.
I had set up all related environment variables as well, that include APACHE_HOME, JAVA_HOME, PLUGIN_HOME,LD_LIBRARY_PATH.
If some one had an idea, please advise!
You need to add the specific path in LD_LIBRARY_PATH and make sure it is loaded when httpd starts.
I know you say you have, but double check, because that's exactly what the error is saying (that you haven't).
Apache httpd by default uses a file for environment variables that need to be set before starting apache httpd with its script "apachectl"
Here is the typical envvars file where we set it:
if test "x$LD_LIBRARY_PATH" != "x" ; then
LD_LIBRARY_PATH="/path/to/httpd/lib:/path/to/httpd/weblogic-module/lib:$LD_LIBRARY_PATH"
else
LD_LIBRARY_PATH="/path/to/httpd/lib:/path/to/httpd/weblogic-module/lib"
fi
export LD_LIBRARY_PATH
By the way, you don't need all files for httpd to start just these:
libdms2.so
libonssys.so
libopmnsecure.so
and obviously the module: mod_wl_24.so
Edit: Note this requirement/dependency of other libraries is new for these newer versions of the weblogic module, in earlier versions it wasn't necessary.
Update:
This issue was fixed by following steps:
Remove yum installed httpd service from system.
Download & Install weblogic apache plugins 12.2.1.2 from Oracle in customer location.
Following https://blacksaildivision.com/how-to-install-apache-httpd-on-centos to build apache 2.4.29 from source in CentOS 7
Please note: When run ./configure in apache build process, use parameter as:
--libdir=/usr/local/WLSPlugins12c-12.2.1.2/lib point to your weblogic plugin lib location
After apache was built and installed in your CentOS, setup httpd.service to be controlled by systemctl
Reconfigure apache and restart it.
it will works for you.
This issue was fixed by following steps:
1. Remove yum installed httpd service from system.
2. Download & Install weblogic apache plugins 12.2.1.2 from Oracle in customer location.
3. Following https://blacksaildivision.com/how-to-install-apache-httpd-on-centos to build apache 2.4.29 from source in CentOS 7
4. Please note: When run ./configure in apache build process, use parameter as: --libdir=/usr/local/WLSPlugins12c-12.2.1.2/lib point to your weblogic plugin lib location
5. After apache was built and installed in your CentOS, setup httpd.service to be controlled by systemctl
6. Reconfigure apache and restart it.
it will works for you.
I have a .jar file that works perfectly on my mac, but I need to run it on the web server... So when I use command line to make this file work it gives me this error:
[root#mysite.com dist]$ java -jar PDFparser.jar ffive.pdf
Exception in thread "main" java.lang.NoSuchMethodError: method java.lang.String.getBytes with signature (Ljava.nio.charset.Charset;)[B was not found.
at org.apache.commons.io.IOUtils.write(IOUtils.java:1527)
at org.apache.commons.io.FileUtils.writeStringToFile(FileUtils.java:1929)
at org.apache.commons.io.FileUtils.writeStringToFile(FileUtils.java:1962)
at pdfparser.PDFparser.main(PDFparser.java:171)
I am not the one who created that .jar app but it works just the way I need on my mac... but it need it for the site, so I need it to be working on the web server... Does anyone know what does this error mean and what should I do? I don't know Java language so it would be awesome if you explain to me what should I do like I'm very stupid person...step by step... :)
String.getBytes(Charset c) has only been available since Java 1.6. Most likely, the Java version on your Mac is 1.6+, but your target server is less than 1.6.
You will need to update to at least Java 1.6 on your web server for this method to be available.
Source
This
java.lang.NoSuchMethodError: method java.lang.String.getBytes with signature (Ljava.nio.charset.Charset;)[B was not found.
means that a class in your jar file couldn't find a corresponding method in the Java installation. I suspect your jar file was created with a java version greater/newer than that installed on your web server.
On your working server, type
$ java -version
and do the same on your web server, and compare the version numbers.
There is no issue with your mac or the webserver. The jar was created with a lower version of Java (1.5 or below) while String.getBytes() is only available with java 1.6+.
There is a version mismatch.