Bolo
Bolo

Reputation: 31

Setup an external Tomcat (with CATALINA_HOME/CATALINA_BASE configuration) on Eclipse

I am working with a Tomcat 7 server using the CATALINA_HOME/CATALINA_BASE configuration. According with this configuration, a Tomcat server can be start with commands $CATALINA_BASE/bin/catalina.sh start or $CATALINA_BASE/bin/catalina.sh run, depending on your interest.

This approach allows some very interesting pros: the CATALINA_BASE folder can be versioned, while if you want to change the Tomcat version can be easily done changing the CATALINA_HOME folder.

The problem occurs trying to configure a Tomcat server on Eclipse, without modifying any server (CATALINA_BASE) files: in practice the Tomcat server is integrated in Eclipse and I haven't found a configuration in order to call the $CATALINA_BASE/bin/catalina.sh start script in order to completely exploit the power of the BASE/HOME config.

I am sure that can be done within IntelliJ IDEA and NetBeans, but, of course, I don't want to use these IDEs.

Do someone of you had a similar problem/request?

Upvotes: 1

Views: 2649

Answers (2)

stan4d
stan4d

Reputation: 46

I've been dealing with the same issue. At this point it appears that Eclipse (Oxygen) does not support this.

When you create a "Server" in Eclipse, it has a "Server Locations" section that lets you set "the server path (i.e. catalina.base)". I thought that was the fix. Unfortunately, that's Eclipse's target catalina.base, and the source continues to be the Tomcat installation directory.

So, when I updated the Server Path to point to my CATALINA_BASE, Tomcat ended up copying the conf files from the Tomcat installation directory on top of my conf files in CATALINA_BASE. At that point I was really glad that I had my CATALINA_BASE checked into version control.

For now, I have CATALINA_HOME and CATALINA_BASE set to the same directory, and I use .gitignore to keep the unwanted binaries in bin and lib out of my repository. It's less than optimal since it's a hassle when a new version of Tomcat comes out, but it'll have to do until Eclipse supports having separate CATALINA_HOME and CATALINA_BASE directories.

Upvotes: 0

tcosta
tcosta

Reputation: 151

Not sure if I fully understood your question, but when you create a Tomcat server in Eclipse, that represents an instance that is in practice a new directory where $CATALINA_BASE will point to. It will contain the configuration and apps you want to deploy in that instance.

The Tomcat binaries ($CATALINA_HOME) corresponds in Eclipse to the "Runtime Environment". At any time you can open server configuration and change the Tomcat binaries version by changing the "Runtime Environment" and run your existing instance configuration and apps on a new Tomcat version.

In summary, if you change the "Runtime Environment" you will be changing $CATALINA_HOME and creating a new server will "change" $CATALINA_BASE.

Did I clarify your doubts?

Upvotes: 0

Related Questions