Win a copy of Head First Android this week in the Android forum!

Brad Jennings

+ Follow
since Nov 04, 2016
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Brad Jennings

My original quest was misdirected. I thought I needed to configure the tomcat server by hand because I was using the RUNNING.txt file which assumed the user had extracted the tarball and was running the server as 'root'. This is way of setting up Tomcat. But, if you're a newbie and you trust that the folks in your Linux Mint 20 are smart, then my original quest was ill guided. The Linux Mint 20 offers Tomcat9 as an install package via the Software store. Because there are many smart people creating these install packages, they don't follow the standard convention, which in turn introduced confusion. If you dig around on the internet you will find that most people grab the tarball for one reason or another and set their server up in one or two hand-crafted directories. I didn't want to follow the masses, so...

I finally figured out how to get the standard Linux Mint (Ubunutu) Tomcat9 package configured for multiple tomcat instances using Apache Netbeans 11.2. This is a scenario where you have one Tomcat on the server, and multiple development instances (ie: port 8080, 8081, 8082, etc..) in multiple Netbeans installations.  There is not one single document on the interwebs to explain how to do this, and I've been able to piece together how it should be done. It's so simple, yet so complicated it makes me sick.

CAVEAT: These instructions are the result of nearly a week of researching online for help. I've written it based on memory, so there might be some blanks that need to be filled.

STEP 1: Use the Software Manager to install the following on Linux Mint 20

1) Default-jdk
2) Netbeans (not the Flathub!!)
3) Tomcat9
4) Tomcat9-admin
5) Tomcat9-docs

STEP 2: Assuming you are NOT running every application as root do the following:

1) Run '/usr/bin/tomcat9-instance-create -p <port> -c <controlport> <catalina_base>' where <port> is an unused port, <controlport> is an unused port and <catalina_base> is a new directory under you home dir.
2) 'sudo' recursively copy '/etc/tomcat9/policy.d' to <catalina_base>/conf. Then change the permissions to your local user.
3) 'sudo' recursively copy '/etc/tomcat9/Catalina' to <catalina_base>/conf, then change the permissions to your local user.
4) edit the tomcat_users.xml and add users for admin-gui, admin-script, manager-gui,manager-script, tomcat,manager.

STEP 3: Now, run Netbeans and open the Services to add a new Web Server

1) Add Server
2) Choose Tomcat or TomEE
3) Choose Server Home is '/usr/share/tomcat9'
4) Choose Catalina Base is the same directory you chose during the 'tomcat9-instance-create' above.
5) Enter the 'manager-script' username and password you chose above.
6) Click finish.

STEP 4: Now you must edit the 'server.xml' in your 'CATALINA_BASE/conf' directory and update the Connector.

1) Open $CATALINA_BASE/conf/server.xml with nano
2) Find the "Connector" section and add a 'server' entry like so

Now that the Tomcat uses a second instance in your CATALINA_BASE, and Netbeans can connect to it, and the /conf directory contains the 'manager' application files (policy.d and Catalina folder), you should be able to start your newly created server in Netbeans. Netbeans can communicate with the second Tomcat instance via the manager app and can start/stop, build and deploy your application. When you're happy with your monster you can put the .WAR file on the primary CATALINA_HOME server for the world (or your friends) to see.

Good luck!

1 year ago
Yes, I've used my ~/.bashrc file to export the variable.

I'm using the Linux Mint 20 installation of Tomcat, which happens to be Tomcat9. The installer process spreads the tomcat files across the directory structure, then sets up a systemd service to automatically start tomcat. Generally I don't like it when the installer makes many of these decisions, but decided to go with it this time because there is a lack of documentation on how to follow the "Mutliple Instances" instructions in the RUNNING.txt file provided by tomcat. I followed those instructions to the best of my knowledge but ran into this chicken and the egg problem that occurs when CATALINA_BASE isn't exported beforehand.

The installer places the lion share of tomcat (pun intended) in '/usr/share/tomcat9', and then puts the web-related (a.k.a. CATALINA_BASE) files in '/var/lib'. It also creates a 'tomcat' user and group. I ended up with this set of files with permissions.

In order to create a separate instance I followed the instructions in "Advanced Configuration - Multiple Tomcat Instances" of the RUNNING.txt file that comes with Tomcat9.

In many circumstances, it is desirable to have a single copy of a Tomcat
binary distribution shared among multiple users on the same server.  To make
this possible, you can set the CATALINA_BASE environment variable to the
directory that contains the files for your 'personal' Tomcat instance.

When running with a separate CATALINA_HOME and CATALINA_BASE, the files
and directories are split as following:


* bin  - Only the following files:
          * (*nix) or setenv.bat (Windows),
          * tomcat-juli.jar
         The setenv scripts were described above. The tomcat-juli library
         is documented in the Logging chapter in the User Guide.
* conf - Server configuration files (including server.xml)
* lib  - Libraries and classes, as explained below
* logs - Log and output files
* webapps - Automatically loaded web applications
* work - Temporary working directories for web applications
* temp - Directory used by the JVM for temporary files (


* bin  - Startup and shutdown scripts
         The following files will be used only if they are absent in
         CATALINA_BASE/bin: (*nix), setenv.bat (Windows), tomcat-juli.jar
* lib  - Libraries and classes, as explained below
* endorsed - Libraries that override standard "Endorsed Standards"
             libraries provided by JRE. See Classloading documentation
             in the User Guide for details.
             This is only supported for Java <= 8.
             By default this "endorsed" directory is absent.

So, here is what I created in my Tomcat9 directory as CATALINA_BASE

My problem is that the '/usr/share/tomcat9/bin/' script doesn't recognize my exported CATALINA_BASE when I run the application as user 'brad'.

UPDATE: If I move the '' script into my local '$CATALINA_BASE/bin' directory and then execute it from there the script will read my $CATALINA_BASE variable. I'm unsure why moving the file makes a difference. Any idea why the '' in the standard directory '/usr/share/tomcat9/bin/' doesn't read my $CATALINA_BASE variable?
1 year ago
I have CATALINA_BASE set to /home/brad/Tomcat9 in my .bashrc so it should be available to the script, which should in turn use my local directory as the CATALINA_BASE, which in turn should call, which should set the CATALINA_BASE directory. A chicken and the egg sort of problem.

Any idea why the script isn't reading my local environment variable for CATALINA_BASE as expected?

See, the CATALINA_BASE is set, but when I run the script the environment variable is ignored.

Since I'm unable to attach a file with a .zip, .txt, or no extension here is the important bit of the script.

Many thanks!
1 year ago
Agile development processes are rather new to me and my colleagues. There are many established in-house Agile practices at our company, including use of Epic Story and supporting User Stories. Unfortunately what are called "User Stories" don't fit the format of the Agile methodology. Many of our developers resort to crafting functional, technical, descriptions instead of User Stories as told from the user perspective. So, we end up with "Add this to do that" tasks instead of "As a user I would like to press a button and have magic happen". This leads to a lot of trouble when trying to craft QA Tests against these so-called User Stories. We lose focus and sprints take much longer than they should. How do you explain the best way to craft a User Story, and how can a developer communicate and document the necessary functional processes that support those stories?
I know this question will be a pain point for many people, but with the transition of Netbeans over to Apache from Oracle my favorite code editor is in flux. Combine that with the license concerns surrounding Java Is like to know which IDE is most compatible and complimentary to learning Java 11.

Many thanks and welcome to CodeRanch.

I tried, yet failed, to pass the Java 7 exam. I think a book like this would have helped immensely.