24

I installed Tomcat using this guide: https://help.ubuntu.com/13.04/serverguide/tomcat.html

When I successfully run it from the console, but when I try to run it using Intellij Idea error occurs: "Error running Tomcat : Can't find directory '/usr/share/tomcat7/conf'"

Application server configuration in Idea:

Tomcat Home: /usr/share/tomcat7
Tomcat Base: /var/lib/tomcat7
user1691070
  • 363
  • 2
  • 3
  • 9
  • Why tomcat home and base are too different folders ? where do you run tomcat from (start.sh) ? – Nir Alfasi Aug 14 '13 at 21:38
  • /usr/share/tomcat7/bin/catalina.sh - running from. Setting up Tomcat base to /usr/share/tomcat7 doesn't help. – user1691070 Aug 14 '13 at 21:45
  • Does a `conf` folder exist under that base ? – Nir Alfasi Aug 14 '13 at 21:46
  • Download and unpack Tomcat 7 `tar.gz` from the official site, point IDEA to it. Ubuntu package will not work because of the different layout. – CrazyCoder Aug 14 '13 at 21:48
  • Well, after I copied folder conf to /usr/share/tomcat7 new error occured : Error running Tomcat : Error copying configuration files from /var/lib/tomcat7/conf to /home/exceptis/.IntelliJIdea12/system/tomcat/Tomcat__ChatIM/conf : /var/lib/tomcat7/conf/tomcat-users.xml (Permission denied) – user1691070 Aug 14 '13 at 21:56
  • do u need to fix your permissions? – vikingsteve Aug 15 '13 at 08:57
  • Well I tried to fix my permission, but it didn't help. I followed CrazyCoder's advice and installed it manually, also this tutorial helped http://diegobenna.blogspot.com/2011/01/install-tomcat-7-in-ubuntu-1010.html. Now it works! – user1691070 Aug 15 '13 at 16:30

3 Answers3

23

In my case, creating a soft link and changing the access permission solved the problem

    cd /usr/share/tomcat7
    ln -s /etc/tomcat7 conf
    chmod -R 655 /etc/tomcat7/

I have replied to the similar question here

Kayvan Tehrani
  • 3,070
  • 2
  • 32
  • 46
15

The problem is that the layout is as they call "non-standard"

The problem has been marked as solved here: IntelliJ needs to copy tomcat conf dir to project directory

Note that Tomcat installed using the package manager on some Linux systems has non-standard layout and permissions, and therefore will not work with IDEA.

Community
  • 1
  • 1
mish
  • 1,055
  • 10
  • 29
  • By the way, NetBeans automatically configures the layout of your external Tomcat "base" folder to be "standard", so this entire problem is non-existent. Annoying that IntelliJ 2018 still cannot perform this simple chore of configuring the Tomcat base folder. – Basil Bourque May 11 '18 at 22:17
0

I encountered the same problem earlier and followed these steps to get it working:

  1. create a new group for tomcat sudo groupadd tomcat

  2. create a tomcat user and add this user to the tomcat group created earlier sudo useradd -M -s /bin/nologin -g tomcat -d /opt/tomcat tomcat

  3. Update permissions for tomcat on the installation directory (e.g., /opt/tomcat as used above)

sudo chgrp -R tomcat /opt/tomcat (this gives tomcat ownership over the directory)
sudo chmod -R g+r conf
sudo chmod g+x conf (this and the one above gives tomcat read/write perm on conf dir)
sudo chown -R tomcat webapps/ work/ temp/ logs/ (makes user, tomcat, owner of the following dirs)
4. Open tomcat installation parent directory, i.e., /opt, as root, right click on the tomcat folder -> properties -> permissions -> folder access, change to create and delete files.```

And Jesus said, "It is finished."
Ercross
  • 519
  • 6
  • 17