Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tomcat [Ubuntu] - Warning: The selected directory is not a valid Tomcat home

I have installed Tomcat 9 in my PC (on Ubuntu 16.04).

Tomcat path

I also successfully started the server in port 8080.

enter image description here

The problem is, when I try to configure Intellij IDEA to run a Tomcat server, it throws the following error:

Intellij IDEA Tomcat path error

I don't know what the problem with the Tomcat home: opt/tomcat is since i have no other tomcat folder on my PC, and as shown, it works perfectly. I have tried putting inner opt/tomcat folders, like Tomcat home: opt/tomcat/bin or Tomcat home: opt/tomcat/lib (where executables are), but it doesn't work either.

like image 927
Lautaro Paskevicius Avatar asked Dec 10 '25 17:12

Lautaro Paskevicius


2 Answers

IntelliJ IDEA supports the standard Tomcat layout for the official distributions from https://tomcat.apache.org. OS specific distributions installed by the package managers may have non-standard layout. We recommend to download and use the official distribution. At least you can compare it to what you have to find out what's missing or located in a different place.

Also check that you have the current IDE version. I've verified with IntelliJ IDEA 2017.2.1 available at http://www.jetbrains.com/idea/download/index.html and with the latest Tomcat 9 version available at the moment (9.0.0.M26) and it works fine:

Tomcat 9

Tomcat structure

In your specific case IntelliJ IDEA was not able to read the files from the server installation directory because the user IDE was running from had no any permissions to the server installation directory. For development purposes it's enough to just download and unpack the server distribution into your home directory without changing any permissions for this directory. This way IDE will be able to read the files and use this installation.

Creating a separate user and limiting the permissions as described in the guide you've followed is only needed for the production servers that are open to public. It's a good security measure to limit the possible harm to the system in case the server is compromised or any security vulnerability is found in the JVM, the app server or your application running on this server.

like image 66
CrazyCoder Avatar answered Dec 13 '25 05:12

CrazyCoder


You can try this way:
xxx@yyyyyyy:cd /opt/tomcat
xxx@yyyyyyy:/opt/tomcat$ sudo chmod -R 777 ./

like image 34
Duy Piter Avatar answered Dec 13 '25 06:12

Duy Piter