0
votes

I have written a bash script that uses SCP to copy files to another server on the same LAN.

Eg. scp /opt/alfresco_associated/tomcat/temp/Alfresco/_source_4939853286195544661.tiff [email protected]:/opt/ocr/data/temp/eng_119045725.tiff

If I execute this script directly using the terminal, it works without error. If I call it from a Java class running on Apache Tomcat, I get the below error message:

/usr/bin/ssh: relocation error: /usr/bin/ssh: symbol EVP_enc_null, version OPENSSL_1.0.0 not defined in file libcrypto.so.1.0.0 with link time reference lost connection

Both source and target machines are running Ubuntu 16.04 LTS Server.

I have tried: apt update apt upgrade

Server version: Apache Tomcat/7.0.59 Server built: Jan 28 2015 15:51:10 UTC Server number: 7.0.59.0 OS Name: Linux OS Version: 4.4.0-64-generic Architecture: amd64 JVM Version: 1.8.0_65-b17 JVM Vendor: Oracle Corporation

OpenSSL 1.0.2g 1 Mar 2016

1
This might be an issue with the environment variables. They contain paths where the dynamic linker will search for shared libraries (such as `libcrypto.so.1.0.0). Make sure you Java invocation sets the same environment variables as your bash session does. An excerpt of the Java code issuing the command would be helpful.fzgregor
Thanks. So it seems that Tomcat is using its own set of libraries, including libssl.so.1.0.0. This appears to be different from the OpenSSL 1.0.2g installed on the system. I commented out the line in tomcat's "setenv.sh" that included the custom libraries, and restarted tomcat. The error still persists. Is there a way to check, on runtime, what version of OpenSSL is Tomcat loading?Vipul Swarup

1 Answers

3
votes

I have fixed this by adding the below line to the top of my Bash script:

export LD_LIBRARY_PATH=""

This resets the environment variable that Tomcat is setting to point to custom libraries. For the session of the script, the default libraries are called.