How to choose which tomcat runs?

I have a Tomcat 8 installation on my Ubuntu Linux system as well as Cuba Studio. Studio deploys to the work directories inside the project, but it is running my system install rather than the local copy of Tomcat. Since the application is not installed on the system Tomcat, I can’t access it when I use “Run” from inside Studio.

This is because I have set CATALINA_HOME=/opt/tomcat in my .bashrc file.

Is there any way to tell Studio to run its own copy of Tomcat or do I have to keep removing my CATALINA_HOME setting when I want to run Studio?

Would it be better to somehow configure Studio to hot deploy to my system Tomcat? How would I do that?

The CATALINA_HOME variable is used in the deploy/tomcat/bin/catalina.sh file, so you can set it in the beginning of this file explicitly, e.g.

CATALINA_HOME=/home/myproject/deploy/tomcat

Studio will keep this file untouched until you remove the deploy/tomcat folder. After that, default Tomcat will be installed and you will have to set the variable again.

Thanks, Can I suggest that you put the following at the top of catalina.sh as the default?

unset CATALINA_HOME

This way, by default, Studio will always use the locally deployed Tomcat. A user would have to override this to use another one. Right now, the default is the reverse – it will use the system Tomcat unless you override it. But, of course, the hot deploy only goes to the local Tomcat and nothing works.

As it is, I have to go through all my current projects and modify the catalina.sh in each of them.

We try to modify the standard Tomcat scripts as little as possible, but perhaps you are right, it’s worth it.

https://youtrack.cuba-platform.com/issue/PL-10094

1 Like