jscv : Cannot locate JVM library file - jvm

When I try to start a demo jsvc implementation I get the following error output of jsvc:
jsvc -cp ApacheDeamonDemo.jar -pidfile /mypath/pid.txt -outfile /mypath/log.txt -errfile /mypath/err.log net.example.deamon.DemoDeamon
I get the following error ouput:
Cannot find any VM in Java Home /Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/Home
Cannot locate JVM library file
Service exit with a return value of 1
Actually the path is correct. Therefore I do not understand why jsvc is telling me this. I'm using a mac.

Almost five years later, so probably too late to help the original asker, but I had the same problem today trying to run jsvc with open-jdk-11 for AMD64, so this might help someone later.
To diagnose the problem, I ran jsvc with the --debug flag, and that told me that it was choking on trying to find libjvm.so. I ran find /usr/lib/jvm/java-11-openjdk-amd64 -name libjvm.so and found it at /usr/lib/jvm/java-11-openjdk-amd64/lib/server/libjvm.so, but jsvc was looking for it at /usr/lib/jvm/java-11-openjdk-amd64//lib/amd64/server/libjvm.so. So, I did this, and then jscv worked:
sudo mkdir /usr/lib/jvm/java-11-openjdk-amd64/lib/amd64
sudo ln -s /usr/lib/jvm/java-11-openjdk-amd64/lib/server /usr/lib/jvm/java-11-openjdk-amd64/lib/amd64/
It turns out the problem is fixed in later versions of jsvc. I experienced the issue with jsvc version 1.0.6, which is the one you get if you run apt install jsvc on Ubuntu 18.04. After I downloaded the 1.2.0 version commons-daemon src from Apache and compiled jsvc myself, the issue is fixed and I didn't need the symlink anymore.

Don't know why jsvc would try to locate all the dylib files and load them with dlopen, but apparently, this doesn't work well with Apple's Java release. While fixing jsvc might not be too hard, I just went firing up the JVM myself like so,
export JAVA_HOME=$(/usr/libexec/java_home)
export CATALINA_HOME=/Users/rong/Projects/apache-tomcat-8.0.12
export CATALINA_BASE=$CATALINA_HOME
java \
-server \
-classpath $CATALINA_HOME/bin/bootstrap.jar:$CATALINA_HOME/bin/tomcat-juli.jar \
-Dcatalina.home=$CATALINA_HOME \
-Dcatalina.base=$CATALINA_BASE \
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager \
-Djava.util.logging.config.file=$CATALINA_BASE/conf/logging.properties \
org.apache.catalina.startup.Bootstrap \
> $CATALINA_BASE/logs/catalina.out \
2> $CATALINA_BASE/logs/catalina.err
By wrapping this in a bash script and adding a bit of forking, changing UID stuff, you can forget about jsvc completely.

Related

SOLVED - Ubuntu 18.04 setting up virtualenvwrapper, python 3.8

Original question:
I am installing virtualenvwrapper on Ubuntu 18.04. Here is what I have tried so far:
From https://virtualenvwrapper.readthedocs.io/en/latest/#:~:text=virtualenvwrapper%20is%20a%20set%20of,introducing%20conflicts%20in%20their%20dependencies:
$ pip install virtualenvwrapper
...
$ export WORKON_HOME=~/Envs
$ mkdir -p $WORKON_HOME
$ source /usr/local/bin/virtualenvwrapper.sh
Error: bash: /usr/local/bin/virtualenvwrapper.sh: No such file or directory
Ok, so I went looking for virtualenvwrapper.sh. Eventually I found it:
joanna#joanna-X441BA:~/.local/bin$ ls
...
virtualenv-clone
virtualenvwrapper_lazy.sh
virtualenvwrapper.sh
...
Tried again with the new path: joanna#joanna-X441BA:/$ source /home/.local/bin/virtualenvwrapper.sh
bash: /home/.local/bin/virtualenvwrapper.sh: No such file or directory
Agh, ok. Searched StackOverflow, followed the instructions in Issue installing Virtualenvwrapper on Ubuntu 18.04?:
export WORKON_HOME=$HOME/.virtualenv
export VIRTUALENVWRAPPER_LOG_DIR="$WORKON_HOME"
export VIRTUALENVWRAPPER_HOOK_DIR="$WORKON_HOME"
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
I checked that this is in fact where my python3 installation lives. Same result though - No such file or directory.
Also tried sudo apt-get update and it successfully updated a bunch of stuff. But still No such file or directory.
Following this article, I also tried
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python
export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv
(with the paths corrected for my filesystem setup.)
I don't understand why Bash is saying "No such file or directory" when it is in fact there (inexact error message that could be improved?), or more importantly how to fix this problem.
Note: This article warns me not to use sudo with pip because "If you think you need to use sudo, you're probably trying to modify a distribution-owned file", which is apparently Very Bad. I have also seen several articles warning that I should really use python -m pip install (or python3 -m pip install?) instead of plain pip install, because plain pip install can cause unintended side effects. I am not an expert by any means in these matters, but avoiding side effects sounds good to me.
Solution:
I finally got it to work! I kept playing around with it and double-checking that all the paths were correct and I did everything in the right order. I also had a stray installation of Python 3.8 that it seems I had installed in one of my folders that I use for code (my understanding is that Python installations should automatically go into one of the root folders like /usr/bin). On advice from my mentor I used the file manager to delete the stray Python 3.8, which may have helped with the virtualenvwrapper problem. After deleting the stray Python 3.8 I ran these commands and it finally worked!!!!
export WORKON_HOME=$HOME/.virtualenv
export VIRTUALENVWRAPPER_LOG_DIR="$WORKON_HOME"
export VIRTUALENVWRAPPER_HOOK_DIR="$WORKON_HOME"
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
source ~/.local/bin/virtualenvwrapper.sh
My advice to readers of this question who are stumped with similar problems: triple-check the paths you are using by cd-ing into the folders, and also check for spelling errors in what you are typing. Your computer's file system may be set up slightly different from mine so don't blindly copy-paste the file paths I used. This will save you a lot of time and frustration. Also note that the file location of ~ is NOT the same as /home, that's one mistake I made.

Swagger codegen build fails

I've asked this question in the swagger github repository but the community doesn't look very responsive, so I'm going to try here.
Following the README I'm running this commands to generate a PHP client (but it could be any other language):
git clone https://github.com/swagger-api/swagger-codegen
cd swagger-codegen
mvn clean package
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate
\
-i http://petstore.swagger.io/v2/swagger.json \
-l php \
-o /var/tmp/php_api_client
and I get the following error:
Error: Unable to access jarfile modules/swagger-codegen-cli/target/swagger-codegen-cli.jar
Does anybody have the same error? I'm trying to figure out if it's just me. Maybe I'm missing something.
As of today (1/10/19) it only works with Java version 7 or 8. I had to downgrade from version 10 to make it work.

On my mac. whereis command failed return application path

All
my shell is oh-my-zsh.
“whereis” doesn't work, there is not any response while I'v executed the command.
“which” works normally.
Here are some details
~ ⌚ 3:26:26
$ echo $PATH ‹ruby-2.2.4›
/Users/luoweiguang/.rvm/gems/ruby-2.2.4/bin:/Users/luoweiguang/.rvm/gems/ruby-2.2.4#global/bin:/Users/luoweiguang/.rvm/rubies/ruby-2.2.4/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Wireshark.app/Contents/MacOS:/Users/luoweiguang/.rvm/bin
~ ⌚ 3:26:28
$ which man ‹ruby-2.2.4›
/usr/bin/man
~ ⌚ 3:26:36
$ whereis Notes ‹ruby-2.2.4›
~ ⌚ 3:26:49
$ whereis XCode ‹ruby-2.2.4›
~ ⌚ 3:41:35
$
I spent much time on the problem for these days. and I didn't find a way to fix it, Hope you guys can help me. Thanks
whereis probably works just fine, there are just no binaries named Notes or XCode in your $PATH. For confirmation, please try to run which Notes and which XCode. Also try whereis man to confirm that whereis is actually working.
XCode and Notes come as App bundle and their executables are not placed in the "normal" places like /usr/bin. Instead their executable is inside their bundle directory, which (or rather the appropriate subdirectory) is usually not part of $PATH. For Notes this the bundle directory is /Applications/Notes.app and the executable is /Applications/Notes.app/Contents/MacOS/Notes.

Apache not starting after upgrading to a newer version. No errors anywhere

I had a working configuration of Apache 2.2.23 in an AIX 7 server for around 2 years and I am trying to upgrade it to 2.2.29.
I followed the official documentation to upgrade minor versions by using the ./config.nice file from the old directory and use it to config and install my new apache.
For some unknown reason after it is done when I start apache by ./apachectl -k start it returns nothing (as usual if the config is fine)
However when I do ps -eaf | grep apache nothing is shown, so it didn't run
I then tried ./apachectl -k restart, it says it is not running and the same problem repeats.
Since I backed up the old 2.2.23 folder, if I restore the folder back, it can start immediately.
I then further tested by simply installing 2.2.29 without applying any old configuration to it, so only default configuration is used. Much to my surprise the same problem still persist! Tried rebooting and commenting out LoadModules sentences but nothing works.
No errors on console, just one line of error complaining about SSL cache in error_log (which also happens in the working apache, so I think this error is not related), no errors anywhere...
Grateful if anyone could kindly shed some light on this. Much appreciated, thank you for reading.
Notes:
OS: AIX 7100-02-02
Working Apache: 2-2-23
Tried versions of Apache: 2-2-29 2-2-31
Openssl version: openssl.base 1.0.1.514
EDIT:
Further testing shows that if I configure the apache with nothing... (only ./configure --prefix=/opt/apache2) then at least it can start.
But when I use my config.nice from my old build which has the following:
"./configure" \
"--prefix=/opt/apache2" \
"--enable-rewrite=shared" \
"--enable-speling=shared" \
"--enable-ssl" \
"--enable-proxy" \
"--enable-proxy-ajp" \
"--enable-proxy-connect" \
"--enable-proxy-ftp" \
"--enable-proxy-http" \
"--enable-vhost-alias" \
"--enable-headers" \
"$#"
it cant start again...

Running script in FreeBSD

First steps in FreeBSD: trying to run my installation script. Fast help needed:
# ls
configure
# file configure
configure: Bourne-Again shell script text executable
# ./configure
./configure: Command not found
# configure
configure: Command not found
What is wrong, how can I execute this script?
Do you have bash installed? If not use FreeBSD Ports to install it. Use where bash to find out.
Use the force Luke :)
# pkg_add -r bash
May it be, that your's configure script doesn't have appropriate executions rights. Try to cast:
chmod 777 configure
If it works, fix it to
chmod 764 configure
configure scripts are ultra portable shell scripts. There is no need for bash here. The problem is somewhere else.
What's the first line in the configure script? Maybe a CR/LF snuck in, which is a common cause for a totally misleading error message saying that the script was not found, when it was the interpreter that was not found.
Please try /bin/sh ./configure
Install the bash package using
pkg add bash
or
make -C /usr/ports/shells/bash install clean
By default FreeBSD comes with tcsh and a POSIX compatible FreeBSD sh
On older FreeBSD systems you will need to do
rehash
before you can run it.
First line of this script (#!/usr/bin/bash, i suppose) should be changed to #!/usr/local/bin/bash.
And of course, you should have shells/bash port installed.