LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-18-2005, 06:11 AM   #1
hadiseh
Member
 
Registered: Dec 2005
Posts: 38

Rep: Reputation: 15
how can i install tomcat?


hi
when i install tomcat ,it seems every thing is ok.but when i tried:

jakarta-tomcat-5.5.9/bin/startup.sh

it gives me this error:

The BASEDIR environment variable is not defined correctly
This environment variable is needed to run this program

how can i solve this problem?plz help me
 
Old 12-18-2005, 10:44 AM   #2
megaspaz
Senior Member
 
Registered: Nov 2002
Location: Silly Con Valley
Distribution: Red Hat 7.3, Red Hat 9.0
Posts: 2,054

Rep: Reputation: 46
you need to set the CATALINA_HOME and JAVA_HOME environment variables as well as update your CLASSPATH environment variable.

You can do this in /etc/profile. If you put it in here, you'll then need to 'source /etc/profile' before you start up tomcat.

Mine:
Code:
# /etc/profile

# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc

pathmunge () {
	if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
	   if [ "$2" = "after" ] ; then
	      PATH=$PATH:$1
	   else
	      PATH=$1:$PATH
	   fi
	fi
}

# Path manipulation
if [ `id -u` = 0 ]; then
	pathmunge /sbin
	pathmunge /usr/sbin
	pathmunge /usr/local/sbin
fi

pathmunge /usr/X11R6/bin after

CVSROOT=/usr/local/cvsroot
pathmunge $CVSROOT after
export CVSROOT

export EDITOR=vim

JAVA_HOME=/usr/java/j2sdk1.4.2_10
pathmunge $JAVA_HOME/bin after
export JAVA_HOME

KOMODO_HOME=/usr/local/Komodo
pathmunge $KOMODO_HOME after
export KOMODO_HOME

ANT_HOME=/usr/local/apache-ant-1.6.2
pathmunge $ANT_HOME/bin after
export ANT_HOME

CATALINA_HOME=/usr/local/tomcat
export CATALINA_HOME

AXIS_HOME=/usr/local/axis
pathmunge $AXIS_HOME/bin after

AXIS_LIB=$AXIS_HOME/lib
pathmunge $AXIS_LIB after

AXISCLASSPATH=$AXIS_LIB/axis.jar:$AXIS_LIB/commons-discovery-0.2.jar:$AXIS_LIB/commons-logging-1.0.4.jar:$AXIS_LIB/jaxrpc.jar:$AXIS_LIB/saaj.jar:$AXIS_LIB/log4j-1.2.8.jar:$AXIS_LIB/wsdl4j-1.5.1.jar:$AXIS_LIB/axis-ant.jar


CLASSPATH=/usr/local/tomcat/bin:/usr/java/j2sdk1.4.2_10/lib:/usr/local/tomcat/common/lib:/usr/local/tomcat:/usr/java/j2sdk1.4.2_10/lib/mysql-connector-java-3.1.12-bin.jar:$AXISCLASSPATH:/usr/local/xerces/resolver.jar:/usr/local/xerces/xercesImpl.jar:/usr/local/xerces/xercesSamples.jar:/usr/local/xerces/xml-apis.jar
export CLASSPATH

export AXIS_HOME
export AXIS_LIB
export AXISCLASSPATH

unset pathmunge

# No core files by default
ulimit -S -c 0 > /dev/null 2>&1

USER="`id -un`"
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"

HOSTNAME=`/bin/hostname`
HISTSIZE=1000

if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
    INPUTRC=/etc/inputrc
fi

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC

for i in /etc/profile.d/*.sh ; do
    if [ -r "$i" ]; then
    	. $i
    fi
done

unset i
 
Old 12-19-2005, 01:38 AM   #3
hadiseh
Member
 
Registered: Dec 2005
Posts: 38

Original Poster
Rep: Reputation: 15
hi
thx for reply.i export my CATALINA_HOME and JAVA HOME and it runs well.but after some minutes when i tried again it doesn't work.and now some times it workes and some times it doesn't.do u know what happen?
 
Old 12-19-2005, 02:53 AM   #4
megaspaz
Senior Member
 
Registered: Nov 2002
Location: Silly Con Valley
Distribution: Red Hat 7.3, Red Hat 9.0
Posts: 2,054

Rep: Reputation: 46
well, if you've export your variables as commands in a shell term (like konsole), those variables are only valid during that shell's session. this means when you exit the shell, the environment variables are lost. If you've set the variables in /etc/profile, the most reliable way to make sure the variables are set everytime you login in or use the shell term would be to reboot the machine, but logging in and out of your session should work, although, I've had logging in and out not work for me before.

My guess is that it doesn't work the next time because you've export those environment variables in a shell term, close the shell term, and then try to start it up again in a new shell term.

But I don't really know, as I'm not using version 5.X of tomcat; I'm using 4.1.31. It could be something like version 5.X is buggy... I couldn't really tell you.

Another thing, update your CLASSPATH environment variable also.
 
Old 12-19-2005, 05:57 AM   #5
hadiseh
Member
 
Registered: Dec 2005
Posts: 38

Original Poster
Rep: Reputation: 15
thx a lot.u help me so much.but i'm new in linux and cann't understand how can i do this?can u explain more?
 
Old 12-19-2005, 11:36 AM   #6
megaspaz
Senior Member
 
Registered: Nov 2002
Location: Silly Con Valley
Distribution: Red Hat 7.3, Red Hat 9.0
Posts: 2,054

Rep: Reputation: 46
Well let me ask you, how do you boot up into linux? Do you boot straight into graphical mode (init 5)?

Let's pretend you do. Here's the scenario.

You log into your user account. You open up a shell terminal. You su into root so you can start tomcat. You need to set the environment variables, so you do. You start up tomcat. You exit out of root. Now you want to restart tomcat, so you su back into root. Now here is where you'd have problems. Those environment variables you set in your previous session are no longer set. You need to make those environment variables permanent. So look at the example /etc/profile I posted and copy the lines you need in regards to classpath, catalina_home, and java_home.

For the classpath, you'd probably only need:
CLASSPATH=/usr/local/tomcat/bin:/usr/java/j2sdk1.4.2_10/lib

After editing your /etc/profile, log out of your user session and log back in. Your environment variables should be set for you and when you su as root in the shell term.

You can see by typing in the command:

echo $CLASSPATH
echo $JAVA_HOME
echo $CATALINA_HOME

if the outputs come up blank, and you're sure you've set up your /etc/profile correctly, then just reboot the machine. Else, you should be golden.

Last edited by megaspaz; 12-19-2005 at 11:40 AM.
 
Old 12-20-2005, 01:15 AM   #7
hadiseh
Member
 
Registered: Dec 2005
Posts: 38

Original Poster
Rep: Reputation: 15
thx dear megaspaz.u solve my problem.thx a lot
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Tomcat install successful...now need help with... mpower Linux - Software 0 07-23-2004 09:39 PM
tomcat install help please. mpower Linux - Software 3 07-16-2004 08:53 PM
TOMCAT init script not working on startup -- tomcat 4.x / Mandrake Linux 8.0 jmartinph Mandriva 0 03-08-2004 01:31 AM
How to install Tomcat as a webserver davee Linux - Software 6 07-16-2003 03:32 AM
Tomcat 4.1.24 install arkopolo Linux - Software 5 07-07-2003 08:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:22 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration