Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9180691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:06:58+00:00 2026-06-17T18:06:58+00:00

I have the following problem: I am using Tomcat 6.0.32 and Java JDK 6.0_26.

  • 0

I have the following problem:

I am using Tomcat 6.0.32 and Java JDK 6.0_26. I have installed it successfully and the Tomcat start page is visible in the browser at port 8080.

I have also created $CATALINA_HOME/setenv.sh script and put some webapp-specific environment variables in it (along with the CATALINA_HOME, JAVA_HOME and CLASSPATH).

I have created a new user “tomcat”, set a new home directory for him, and also passwd-ed it.

This script is being sourced from within a init script I created to start and stop Tomcat automatically on reboot. I do not use the standart startup.sh and shutdown.sh found in $CATALINA_HOME, but rather then jsvc daemon starter, so I can use port 8080 from a non-root process (Tomcat itself).

The actual problem is that, after restarting Tomcat my webapp does not receive or see the environment variable I set in setenv.sh and so it won’t start.

I have tried to put the environment variable definition in various places:

  • .bashrc in the tomcat home directory
  • /etc/init.d/tomcat script
  • $CATALINA_HOME/bin/setenv.sh
  • $CATALINA_HOME/webapps/myapp/META-INF/context.xml

to no avail, after start of Tomcat my webapp does not see the required environment variables.

My question is – what the heck am I doing worng? Any suggsetions? How am I supposed to transfer env vars to an webapp if the setenv.sh does not work? What could make this mechanism faulty (allegedly this is the way to hand env vars to webapps)?

Here is the startup script I worte:

#!/bin/sh
### BEGIN INIT INFO
# Provides:          allfaweb
# Required-Start:    $syslog $apache $apache2 $httpd
# Should-Start:
# Required-Stop:     $syslog $apache $apache2 $httpd
# Should-Stop:
# Default-Start:     3 5
# Default-Stop:      0 1 2 6
# Short-Description: ALLFAweb service
### END INIT INFO

ALLFAWEB_BIN=/install/apache-tomcat-6.0.32-allfaweb/bin/jsvc
test -x $ALLFAWEB_BIN || { echo "$ALLFAWEB_BIN not installed";
        if [ "$1" = "stop" ]; then exit 0;
        else exit 5; fi; }

# Check for existence of setenv.sh file and read it
ALLFAWEB_CONFIG=/install/apache-tomcat-6.0.32-allfaweb/bin/setenv.sh
test -r $ALLFAWEB_CONFIG || { echo "$ALLFAWEB_CONFIG not existing";
        if [ "$1" = "stop" ]; then exit 0;
        else exit 6; fi; }


. /etc/rc.status
rc_reset

. /install/apache-tomcat-6.0.32-allfaweb/bin/setenv.sh;


case "$1" in
    start)
        echo -n "Starting ALLFAweb ";
        $ALLFAWEB_BIN \
           -user tomcat \
           -home $JAVA_HOME \
           -Dcatalina.home=$CATALINA_HOME \
           -pidfile $ALLFAWEB_PID \
           -outfile $CATALINA_HOME/logs/catalina.out \
           -errfile $CATALINA_HOME/logs/catalina.err \
           -cp $CLASSPATH org.apache.catalina.startup.Bootstrap

        rc_status -v
        ;;
    stop)
        echo -n "Shutting down ALLFAweb "
        $ALLFAWEB_BIN \
            -stop \
            -pidfile $ALLFAWEB_PID \
            org.apache.catalina.startup.Bootstrap

        rc_status -v
        ;;
    restart)
        $0 stop
        $0 start
        rc_status
        ;;
    status)
        echo -n "Checking for service ALLFAweb ";
        /sbin/checkproc $ALLFAWEB_BIN
        rc_status -v
        ;;
    *)
        echo "Usage: $0 {start|stop|status|restart}"
        exit 1
        ;;
esac
rc_exit

The system I am using is a SUSE SP2:

# uname -a
Linux testmachine 3.0.51-0.7.9-default #1 SMP Thu Nov 29 22:12:17 UTC 2012  x86_64 x86_64 x86_64 GNU/Linux

Any help would be highly appreciated! Thanks in advance 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T18:06:59+00:00Added an answer on June 17, 2026 at 6:06 pm

    I found it. Allegedly the reason is that at first I started Tomcat 6 as root, and then changed the ownership of files to user “tomcat”. The root process had written files all over the file system wiht the appropriate permissions, that is, the “tomcat” user could not read them.

    The default shell of the “tomct” user was /bin/sh and not /bin/bash

    I also deleted the files in $CATALINA_HOME/work and renamed the directory to which my custom env var was pointing to (and the env var accordingly).

    There were also some logfiles generated from log4j in the / dicrectory, those are gone too and now everything works as expected 🙂

    Thanks for all the feedback, you kept me going during these 3 days of frustration 🙂

    Cheers!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using GWT/JAVA for development. I have following problem: I want to remove
I have the following problem. I have a Preferences Page that stores preferences using
I'm using PostgreSQL 8.2.9, Solr 3.1, Tomcat 5.5 I have following problem: When I
I have the following problem in a Database using Access 2007 as front end
I have a following problem: I compiled my application on Linux Ubuntu 9.10 using
I have the following problem. I am using Entity Framework to connect to a
I have the following problem. I have embedded a map using Google Maps' API.
I have the following problem. I have a tabbed application implemented using a ViewPager.
Hello i have the following problem, I record a video using red5 like this:
I am using CSS rounded corners for firefox and I have the following problem

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.