49

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

insanely_sin
  • 986
  • 1
  • 14
  • 22

14 Answers14

57

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
Andy
  • 3,794
  • 24
  • 28
  • 1
    Just newly installed Mars and Tomcat thats the solution worked for me – surfealokesea Feb 13 '16 at 17:37
  • 3
    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. – flixe May 31 '16 at 15:36
  • Yes. I can also confirm that this doesnot work for ubuntu 16.04, eclipse neon and tomcat v8. – Kalpa Gunarathna Jul 03 '16 at 15:24
  • 5
    @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? – shyam Oct 25 '16 at 10:53
  • 2
    @shyam works for me as well on neon.1 on Ubuntu 16.04 and tomcat 8 – angeldev Nov 24 '16 at 12:15
  • didn,t worked for me then i tried http://lucasterdev.altervista.org/wordpress/2012/05/12/could-not-load-the-tomcat-server-configuration-at-serverstomcat-v7-0-server-at-localhost-config-the-configuration-may-be-corrupt-or-incomplet/ that helped – RQube Jun 21 '17 at 15:00
  • 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 `. After logging off and on again, everything works perfectly. – Konrad Holl Jan 26 '18 at 13:49
  • 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 – Pierre Monier Oct 21 '21 at 08:16
39

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.

Pierre.Vriens
  • 2,117
  • 75
  • 29
  • 42
  • 1
    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. – Ankit Jan 12 '17 at 02:15
14

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.

metropolision
  • 405
  • 4
  • 10
11

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.

chanklor
  • 487
  • 5
  • 11
3

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
Max Luan
  • 305
  • 3
  • 9
2

A quick solution in eclipse to resolve when Tomcat could not load as per the following error: Tomcat Error

Just refresh the Tomcat folder should do the trick. If it still does not work, delete all files in eclipse under the Tomcat folder, re-copy the server files then refresh the Tomcat folder. Tomcat should restart correctly after that.

Refresh Tomcat folder

Supercoder
  • 1,066
  • 1
  • 10
  • 16
1

I have Windows 8.1, Eclipse Neon, Tomcat 8.

The solution is to copy all the files from folder ".../Tomcatxxx/conf" to the ".../Workspace_directory/Servers" and try to launch server again.

Tunaki
  • 132,869
  • 46
  • 340
  • 423
ru51an
  • 113
  • 1
  • 1
  • 10
1

You tried to start Tomcat and got the following error:

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

How to solve:

  • Close Eclipse
  • Copy all files from TOMCAT_7_HOME/conf to WORKSPACE_FOLDER/Servers/Tomcat v7.0 Server at localhost-config
  • Start Eclipse
  • Expand the Servers project, click on the Tomcat 7 project and hit F5
  • Start Tomcat from Eclipse
Dev M
  • 1,519
  • 3
  • 29
  • 50
1

I know it's been a while since this question was posted, but I was just getting this exact error, and I have a really simple solution that MIGHT work for some. All I did was double click on the folder 'Servers', which then allowed me to start the server with no error message. Sometimes the solution is right in front of your eyes. This might work for some people like me who go straight to google without trying fix the issue themselves!

xcomp
  • 11
  • 6
  • 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. – Sh4d0wsPlyr Dec 07 '20 at 15:58
0

on Centos 7, this will do it, for Tomcat 7 : (my tomcat install dir: opt/apache-tomcat-7.0.79)

  • mkdir /var/lib/tomcat7
  • cd /var/lib/tomcat7
  • sudo ln -s /opt/apache-tomcat-7.0.79/conf conf
  • mkdir /var/log/tomcat7
  • cd /var/log/tomcat7
  • sudo ln -s /opt/apache-tomcat-7.0.79/logs log

not sure the log link is necessary, the configuration is the critical one.

:

theRiley
  • 1,077
  • 13
  • 16
0

Had the same issue with Kepler (after trying to add a Tomcat 7 server).

Whilst adding the server I opted to install the Tomcat binary using the download/install feature inside Eclipse. I added the server without adding any apps. After the install I tried adding an app and got the error.

I immediately deleted the Tomcat 7 server from Eclipse then repeated the same steps to add Tomcat 7 back in (obviously skipping the download/install step as the binary was downloaded first time around).

After adding Tomcat 7 a second time I tried adding / publishing an app and it worked fine. Didn't bother with any further RCA, it started working and that was good enough for me.

Moika Turns
  • 677
  • 11
  • 17
0

I had the same problem in Eclipse Oxygen with Tomcat 8 in ubuntu 16.04 LTS.

Solution: 1. Give permission to entire tomcat folder (chmod 777 -R /Tomcat) 2. Delete and re-add the server in eclipse 3. Restart eclipse 4. Start the tomcat server. It will work..........

0

In the Servers tab of eclipse, go to the properties of the server and Switch location to latest downloaded tomcat version.

This resolved the issue for me.

Tomcat Server Properties

sri
  • 1
  • 1
0

I solved this problem. DON'T USE THE .exe Unistall Tomcat and download the .zip from Tomcat's web site. Then unpack and put it in C:\Program Files. Open Eclipse and set the server. it will work.