• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

setenv.sh doesn't seem to be working

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to install a second instance (a different version) of Tomcat on the same server.  When I run ./startup.sh, I get
The BASEDIR environment variable is not defined
This environment variable is needed to run this program
 
I have tried setting BASEDIR in my setenv.sh.  I have tried setting CATALINA_HOME, CATALINA_BASE.  I have tried using EXPORT, I have tried assigning it directly.  echos within the setenv.sh show that the variables are getting set.  echos from the terminal, however, show that they are not.  (I do not know if that part is expected.)  

Here is my current setenv.sh which shows some of the things I've tried.  But I'm starting to think the problem is not my code in the setenv.sh.

 
Saloon Keeper
Posts: 21133
134
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are 2 ways of installing a second instance of Tomcat.

One is is physically unzip copies of Tomcat, each in its own directory.

The other, usable when more than one instance of a specific release of Tomcat is being created, is to clone the initial Tomcat, delete the bin and lib directories and point CATALINA_BASE at the cloned copy, leaving CATALINA_HOME to point the the primary copy.

The latest version of Tomcat I have handy is Tomcat 7, but as of that release, there was no BASEDIR environment variable used and even the basedir shell utility wasn't used.

So I have no idea where that error is coming from and thus no clue on how to remedy it. The setenv.sh script (if present) is called (sourced) from the catalina.sh script and any environment variables it sets get exported to catalina.sh and its children. If the BASEDIR reference isn't under that process tree or if it's a non-inheriting subtree of catalina, then it wouldn't matter what setenv did.
 
Tharpa Roberts
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem is at the line   in catalina.sh.  My setenv.sh is not getting called.  However, if I set CATALINA_HOME directly in my catalina.sh before that line, it fixes the problem.  
 
Tim Holloway
Saloon Keeper
Posts: 21133
134
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you do not set CATALINA_HOME before you invoke catalina.sh, then CATALINA_HOME is set by catalina.sh to be the directory containing bin/catalina.sh. If you do not set CATALINA_BASE, then it will be set to the same value as CATALINA_HOME.

It's a good idea to ensure that bin/setenv.sh is both readable and executable by the userid that launches Tomcat.
 
I am going down to the lab. Do NOT let anyone in. Not even this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!