The BASEDIR environment variable is not defined correctly - linux

While running my tomcat the following error is coming .
The BASEDIR environment variable is not defined correctly
This environment variable is needed to run this program
Dec 23, 2009 1:03:22 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=1/41 config=null
This is how I set my JAVA_PATH in my bashrc file
export JAVA6_HOME=/home/asharma/Softwares/jdk1.6.0_12
export JAVA_HOME=$JAVA6_HOME
export JPDA_TRANSPORT=dt_socket
export JPDA_ADDRESS=9000
export RESIN_HOME=/home/asharma/Softwares/resin
export PATH JAVA_HOME
export GDK_NATIVE_WINDOWS=1
export CATALINA_HOME=/home/asharma/Softwares/apache-tomcat-6.0.20
export CATALINA_OPTS="-Dcom.sun.management.jmxremote Dcom.sun.management.jmxremote.port=19000 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"
export CATALINA_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9998 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"
alias tstart="$CATALINA_HOME/bin/catalina.sh jpda start -Xmx2000m -Dcom.sun.management.jmxremote.port=9998 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false ; tail -f $CATALINA_HOME/logs/catalina.out"
alias tstop="sh $CATALINA_HOME/bin/shutdown.sh"
alias minstall='mvn clean install -Dhttps.proxyHost=monitoring01.hyd.int.untd.com -Dhttps.proxyPort=3128'
alias resin='sh $RESIN_HOME/bin/httpd.sh -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=12345 -Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -verbose -DVPS_HOME=/home/asharma/vps -Xms2000m -Xmx2000m'

I had the same problem and this worked for me.
Try this:
Go to the your path-to-tomcat/bin in the terminal
Then execute the command below:
chmod +x *.sh
Then run tomcat using ./startup.sh

For me the problem occurs because I have different versions of apache tomcat installed. In particular, you get this error if you are trying to invoke a newer version of the web-server, with the CATALINE_HOME pointed to an older version. A quick fix, which worked for me, is to set the CATALINA_HOME environment variable to the version you are trying to invoke.

I had this issue in windows 7 with a new installation of tomcat, after about 30 minutes of looking i wanted to see where the error was and opened up the classpath.bat file to see a variable named BASEDIR. I tried all the different things people suggested to no avail. The simple solution i found..
open startup.bat
add
set BASEDIR=d:\tomcat
or whatever your tomcat base folder is to the line right after #echo off (this is the first line in the file)

I solved it using sudo:
sudo ./startup.sh

I have same problem and have resolved it. There is another tomcat and have CATALINA_HOME setting in /etc/profile, when the new tomcat starts, the CATALINA_HOME redirect to old tomcat home, where the new tomcat starting user doesn't have permission to execute.
Just, add the setting "export CATALINA_HOME=" to the new tomcat home at the beginning of the startup.sh script.

Related

JAVA_HOME for Logstash

I am trying to setup ELK stack for my Web Services Log Monitoring.
So I have setup all the parts for ELK Stack.
I am facing one issue in Log-stash. When I am running Log-stash, I am facing error, could not load Java binary
Although the simple fix it set the JAVA_HOME in environment variable.
But I don't want to set an environment variable, but what I want to set JAVA_HOME just for Log-stash. I have tried adding in startup.options, but to enable I must run system-install. When I am running system-install, I am facing the same error again.
I have added
export JAVA_HOME=/opt/jre8
then system-install file runs, but still on starting log-stash, I am getting the same error. What should I do to resolve this error?
You can config in startup.options (logstash5.4 version):
Ex:
JAVA_HOME=/.../jdk1.8.0_121
JAVACMD=/.../jdk1.8.0_121/bin/java
Then use root role to start: system-install.
(You can use update-java-alternatives --list to list installed java versions with paths)
You can add this configuration to the file- /etc/sysconfig/logstash, this file is read during startup by logstash.
This is what you should add:
export JAVA_HOME=/opt/jre8

The environment variable declared in setenv.sh is not setting

I am working with tomcat 7 on aws linux AMI. I have installed the tomcat 7 and its working fine. Now I need to deploy the eHour webapp in it. I have followed all the procedure given in this documentation.But when I run the ehour app it does not start and following error is thrown.
Caused by: java.io.FileNotFoundException: ${EHOUR_HOME}/conf/ehour.properties (No such file or directory)
also when I do printenv there is no EHOUR_HOME variable in the list.Below is my code for setenv.sh
# Load Tomcat Native Library
LD_LIBRARY_PATH=/opt/bitnami/common/lib:$LD_LIBRARY_PATH
EHOUR_HOME=/home/bitnami/ehour
JAVA_HOME=/opt/bitnami/java
JRE_HOME=$JAVA_HOME
JAVA_OPTS="-Djava.awt.headless=true -XX:+UseG1GC -Dfile.encoding=UTF-8 $JAVA_OPTS "
. "/opt/bitnami/java/bitnami/setenv.sh"
export JAVA_HOME
export JRE_HOME
export JAVA_OPTS
export LD_LIBRARY_PATH
export EHOUR_HOME
If you can please point out my mistake or some other way to declare EHOUR_HOME variable so that tomcat can pick it during its startup.
Thanks

Making an npm script auto start in a FreeBSD Jail

I've installed an npm package / script in a JAIL on FreeNAS 9.10. (FreeBSD based)
It works perfectly if I run "npm start" in the directory where the scripts are installed.
However, I need this to be auto-starting when the jail starts. I don't know now to do that. Do I need to create an rc script?
Basically all I need to do is give the "npm start" in the correct directory on start up. How do I do that?
thanks
Yes, you can place an rc script within the jail and enable it using the jail's /etc/rc.conf file.
But, for a quick and dirty solution, you could create a /etc/rc.local script (also within the jail's environment) and put your startup commands in there.
See the manual page here.
Don't know about npm start, but for node.js I made such RC srcipt:
#!/bin/sh
# $FreeBSD: 340872 2014-01-24 00:14:07Z mat $
#
# PROVIDE: SERVICENAME
# REQUIRE: NETWORKING
# KEYWORD: shutdown
#
# Add the following line to /etc/rc.conf to enable SERVICENAME:
#
# SERVICENAME_enable="YES"
#
. /etc/rc.subr
name="SERVICENAME"
rcvar=SERVICENAME_enable
pidfile=${SERVICENAME_pidfile:-"/var/run/SERVICENAME.pid"}
command="/usr/sbin/daemon"
#command_args="-r -u USERNAME -P /var/run/SERVICENAME.pid /usr/local/bin/node /home/USERNAME/PROGDIR" # cjayho: restart if crashed
command_args="-u USERNAME -P /var/run/SERVICENAME.pid /usr/local/bin/node /home/USERNAME/PROGDIR"
load_rc_config $name
: ${SERVICENAME_enable:="NO"}
run_rc_command "$1"
name this file something like SERVICENAME and put to /usr/local/etc/rc.d
to enable automatic startup run command as root:
sysrc SERVICENAME_enable="YES"
do not forget to replace SERVICENAME, USERNAME and PROGDIR to your values, and add
process.chdir('/home/USERNAME/PROGDIR')
to your entry js file.

Linux environment variable reset after restart

So I have this really nasty problem.
I once set up a tomcat Server on my raspberry pi. The version of it was 8.0.24. I've created a bash script which sets the variable $CATALINA_HOME=/home/pi/apache-tomcat-8.0.24 on each start.
Meanwhile the directory is /home/pi/tomcat - i removed the useless information.
I've changed the export in /etc/init.d/tomcat also, but it didnt help.
After every restart, CATALINA_HOME is set back to /home/pi/apache-tomcat-8.0.24 again.
Is there a way to see, which script sets the environmental variable?
Somewhere I told linux to change the path at startup to /home/pi/apache.. , but i cant find where.
You can add a line in a few of the startup scripts to print the value of $CATALINA_HOME. Try adding:
echo "In $0, \$CATALINA_HOME is $CATALINA_HOME"
to your .bashrc before and after the call to /etc/bashrc
There's also a script called setenv.bash inside Tomcat that sets these types of variables. Take a look in there too.

Why won't Groovy see JAVA_HOME correctly?

I'm trying to install Groovy via Puppet on SUSE SLES 11 SP2. I have the Groovy files installed, but now I need to set the environment variables. I'm using a shell script to set the values and when I echo the values, they are correct.
echo $JAVA_HOME
/myapplication/mypath/jdk1.6.0_30
When I run the command "groovy -version" I get this error: /bin/javaAVA_HOME is not defined correctly, can not execute: /myapplication/mypath/jdk1.6.0_30.
That's not a typo, that's actually the output I get! :)
This is the correct path to my java installation. Why is "/bin/java" replacing the "J" in "JAVA_HOME"? I searched /bin and /usr/bin and neither directory has a java directory.
If I set the values from the command line on the server, everything works fine.
Here is my shell script:
# groovy.sh
export JAVA_HOME=/myapplication/mypath/jdk1.6.0_30
export GROOVY_HOME=/myapplication/mypath/groovy-2.0.7
export PATH=$PATH:/myapplication/mypath/groovy-2.0.7/bin
Here is the snippet from my puppet module:
$groovy_sh = "/etc/profile.d/groovy.sh"
file { $groovy_sh:
ensure => present,
source => "puppet:///modules/groovy/groovy.sh",
owner => "myuser",
group => "mygroup",
mode => 777,
}

Resources