Could not load the Tomcat server configuration

143,214

Solution 1

I've just been encountering a very similar issue in Ubuntu while trying to get Eclipse Mars and Tomcat7 integrated because Eclipse was expecting the tomcat configuration files etc to be all in the same location, and with the necessary permissions to be able to change those files.

The following instructions from this blog article helped me in the end:

cd /usr/share/tomcat7
sudo ln -s /var/lib/tomcat7/conf conf
sudo ln -s /var/log/tomcat7 log
sudo ln -s /etc/tomcat7/policy.d/03catalina.policy conf/catalina.policy
sudo chmod -R a+rwx /usr/share/tomcat7/conf

Solution 2

I've just solved this exact problem on my Ubuntu 14.04 with Eclipse Mars 2.

This could happen when Eclipse is not finding Tomcat's configuration files where they are expected to be. This place is in

$eclipse_workspace_folder/$version_of_your_tomcat_server_at_localhost/

(by default if you didn't changed server's name). So you have to copy all the files under your $tomcat_installation_folder/conf/* to the workspace server's folder.

But it was easier to just remove the server from your server list and add it again. Eclipse will automatically recreate all these files again into the proper folders. Like in the picture below:

enter image description here

In my case I've downloaded tomcat-8.0.35 from the website, so the configuration files needed are in /opt/apache-tomcat-8.0.35/conf/ filesystem.

Just delete the desired server from the Servers view (Window -> Show View -> Servers) and then go to Window -> Preferences -> Server -> Runtime Environment -> Add and add the server again.

Solution 3

You can install tomcat7 in ~/tomcat7 instead of /usr/share/tomcat7.

  1. Close Eclipse.
  2. Delete org.eclipse.wst.server.core.prefs and org.eclipse.jst.server.tomcat.core.prefs in {workspace-directory}/.metadata/.plugins/org.eclipse.core.runtime/.settings.
  3. Launch Eclipse.
  4. Go to Window->Show View->Other... and choose the Servers.
  5. Select Tomcat v7.0 Server from the server type and press Next.
  6. Enter /home/user/tomcat7 (not /usr/share/tomcat7) into the "Tomcat installation directory" and press Download.
  7. Wait a few minutes and press Finish.

tomcat7 worked correctly with Eclipse 4.4 on my Ubuntu 15.04 in this way.

Solution 4

I know it's an old question and it has been solved already but for me the Tomcat conf/tomcat-users.xml file was created with a different encoding from the rest of the configuration files. The first line of that file looked like this:

<?xml version='1.0' encoding='cp65001'?>

All I had to do to solve the issue was change that line for:

<?xml version="1.0" encoding="UTF-8"?>

And voila.

I have no idea what 'cp65001' means or why it was created like that.

Maybe this will help other users facing the same issue.

Solution 5

The application is trying to load /usr/share/tomcat7/conf/ which doesn't exist. Eclipse assumes conf is in the same directory as bin

In Ubuntu, conf is placed in /etc/tomcat7/ and there is a symbolic link in /var/lib/tomcat7/.

To solve this, you can either

  1. Download package from Apache Tomcat, and place them in a specific directory, say /opt/ or
  2. Create a symbolic link in /usr/share/tomcat7/ pointing to /etc/tomcat7/conf
Share:
143,214

Related videos on Youtube

insanely_sin
Author by

insanely_sin

BTech. in Computer Science and Engineering from IIT Guwahati. Include me if you are building stuff that will help land the first human on Mars :P

Updated on July 09, 2022

Comments

  • insanely_sin
    insanely_sin almost 2 years

    I have installed apache tomcat7 using sudo apt get in ubuntu. I have added apache tomcat 7 to eclipse using Windows > Preferences > Server > Runtime Environment.But when I'm starting the server from server view by right clicking the shown Tomcat v7.0 Server at localhost [Stopped,Republish] It says:

    Could not load the Tomcat server configuration at /Servers/Tomcat v7.0 Server at localhost-config. The configuration may be corrupt or incomplete.

    This is the error shown while I'm trying to start the server

    The path to tomcat7 that I've provided is /usr/share/tomcat7

    • Lalit Mehra
      Lalit Mehra almost 9 years
      try removing and re-adding the tomcat server to your eclipse environment
  • surfealokesea
    surfealokesea about 8 years
    Just newly installed Mars and Tomcat thats the solution worked for me
  • flixe
    flixe almost 8 years
    Ok, this still doesn't work for me (tomcat8, eclipse neon, ubuntu 16). When i try to execute sudo ln -s /etc/tomcat8/policy.d/03catalina.policy conf/catalina.policy, it tells me that the file already exists. Eclipse, however, gives me the same error when i try to start tomcat.
  • Kalpa Gunarathna
    Kalpa Gunarathna almost 8 years
    Yes. I can also confirm that this doesnot work for ubuntu 16.04, eclipse neon and tomcat v8.
  • shyam
    shyam over 7 years
    @flixe I can confirm that this works on neon.1 on Ubuntu 16.04 and tomcat 8. Did you try removing the server from eclipse and adding it again?
  • angeldev
    angeldev over 7 years
    @shyam works for me as well on neon.1 on Ubuntu 16.04 and tomcat 8
  • Ankit
    Ankit over 7 years
    thanks it worked. In my case the above files were present under Tomcat xx/conf/ ; i copied the files to parent i.e Tomcat xx and as a result I was able to start the inhouse application server.
  • Fran Marzoa
    Fran Marzoa almost 7 years
    Me too! Thanks!
  • RQube
    RQube almost 7 years
    didn,t worked for me then i tried lucasterdev.altervista.org/wordpress/2012/05/12/… that helped
  • Stephan
    Stephan over 6 years
    This is a very solid solution!
  • Konrad Holl
    Konrad Holl over 6 years
    Worked for me with Ubuntu 17.10 and Tomcat 8 (applying the necessary modifications). However, instead of making the configuration files world accessible I added myself to the tomcat8 group using sudo usermod -a -G tomcat8 <myUserId>. After logging off and on again, everything works perfectly.
  • Kimchi Man
    Kimchi Man over 5 years
    Thanks, this saved me haha
  • Sh4d0wsPlyr
    Sh4d0wsPlyr over 3 years
    My god, so dumb but genius. Thank you for this answer, it was this simple and I totally missed it thinking it was a more complex issue.
  • Pierre Monier
    Pierre Monier over 2 years
    this line sudo chmod -R a+rwx /usr/share/tomcat7/conf could be something clever like sudo chmod -R g+rw /usr/share/tomcat7/conf. Then make sure that the owner group is tomcat and that your user is in the tomcat group