98

I need to setup a Tomcat 8.5.x server version in Eclipse. When I try to create a server using Eclipse GUI, I get in Eclipse Luna as choice the latest version "Apache Tomcat v8.0". When I select it and I browse to my Tomcat 8.5.x server, I get this blocking error message:

The Apache Tomcat installation at this directory is version 8.5.0. A Tomcat 8.0 installation is expected.

The same error appears when trying TomEE 7.x, which is internally based on Tomcat 8.5.

In Eclipse Neon the latest version as choice is "Apache Tomcat v9.0" and it gives the same error. There isn't even a "Apache Tomcat v8.5" option.

Is there a way to use Tomcat 8.5 and TomEE 7.x in Eclipse? How?

informatik01
  • 16,038
  • 10
  • 74
  • 104

11 Answers11

136

You have to patch catalina.jar, as this is version number the WTP adapter looks at. It's a quite useless check, and the adapter should allow you to start the server anyway, but nobody has though of that yet.

For years and with every version of Tomcat this is always a problem.

To patch you can do the following:

  • cd [tomcat or tomee home]/lib
  • mkdir catalina
  • cd catalina/
  • unzip ../catalina.jar
  • vim org/apache/catalina/util/ServerInfo.properties

Make sure it looks like the following (the version numbers all need to start with 8.0):

server.info=Apache Tomcat/8.0.0
server.number=8.0.0
server.built=May 11 2016 21:49:07 UTC

Then:

  • jar uf ../catalina.jar org/apache/catalina/util/ServerInfo.properties
  • cd ..
  • rm -rf catalina
informatik01
  • 16,038
  • 10
  • 74
  • 104
dexter meyers
  • 2,798
  • 2
  • 18
  • 22
  • 5
    In Tomcat 8.5.3, catalina.jar is in the lib folder. – Jon Jun 24 '16 at 20:57
  • 39
    +1. For those using Windows OS, you can make the required changes right in the JAR file. Just open the _catalina.jar_ with your file archive utility (WinRar, WinZip, 7zip etc), navigate to the _org\apache\catalina\util\ServerInfo.properties_ file, make changes and save them (confirm that you want to update the archive). – informatik01 Jul 04 '16 at 09:57
  • 16
    **UPDATE** And you ONLY need to change the version in the `server.info=` line (like _server.info=Apache Tomcat/8.0.0_), and **server.number** can be left as it is. For instance I have left it untouched like this: `server.number=8.5.4.0`. Works without a problem. – informatik01 Aug 02 '16 at 18:52
  • Note that in order to do the updates to the ServerInfo.properties file, Tomcat must be stopped or else you may hit some locking issues (i.e. The file is in use by another program) . – Traker Aug 10 '16 at 20:54
  • 7
    -1: modifying the server to claim to be a different version is a bit of hack, when clearly the appropriate thing to do is to modify eclipse to accept the actual version *which has been done and is described in other answers*. – Periata Breatta Oct 24 '16 at 11:59
  • 1
    @PeriataBreatta It's a hack for sure. Perhaps you should link to those other answers ;) – dexter meyers Dec 02 '16 at 16:29
  • 3
    After applying this hack, I got "Unknown version of Tomcat was specified." error – Atmesh Mishra Mar 12 '17 at 07:38
  • 1
    @AtmeshMishra Check the file permissions of catalina.jar. – SleepyTonic Apr 21 '17 at 20:01
  • 1
    @AtmeshMishra I got the same error, and startup.bat refused to run, even when I changed catalina.jar back to the way it was orginally. Ended up having to reinstall tomcat – MRDJR97 Apr 25 '18 at 12:06
44

There is a patch for Eclipse:
https://bugs.eclipse.org/bugs/attachment.cgi?id=262418&action=edit

Download this patch and put it to the plugins directory of your Eclipse installation. It will replace the default "org.eclipse.jst.server.tomcat.core_1.1.800.v201602282129.jar".

NOTE
After you add this patch you must choose "Apache Tomcat v9.0" when adding a server runtime environment in the Eclipse (Preferences > Server > Runtime Environments).
I.e. this patch allows you to select either Tomcat version 9.x or Tomcat version 8.5.x when adding Apache Tomcat v.9.0 runtime environment.


More details on can be found on the related bug report page: https://bugs.eclipse.org/bugs/show_bug.cgi?id=494936

informatik01
  • 16,038
  • 10
  • 74
  • 104
FkJ
  • 1,609
  • 1
  • 19
  • 29
  • Note that this update now appears to be included in recent distributions of Neon, so simply choosing the Tomcat 9.x option might work without needing to update the plugin. – Periata Breatta Oct 24 '16 at 11:58
  • 3
    Did not work for Version: Luna Service Release 2 (4.4.2) my tomcat adapters are missing after the patch – adranale Apr 11 '17 at 13:58
  • I'm using the eclipse version Mars.2 (4.5.2) and applied this patch. Now the existing tomcat adapters are all gone. This is crazy patch, I'm rolling it back now. – Suresh Jul 27 '18 at 04:11
37

For Tomcat 8.5.x users

You've to change the ServerInfo.properties file of Tomcat's /lib/catalina.jar file.

ServerInfo.properties file contains the following code

server.info=Apache Tomcat/8.5.4
server.number=8.5.4.0
server.built=Jul 6 2016 08:43:30 UTC

Just open the ServerInfo.properties file by opening the catalina.jar with winrar from your Tomcat's lib folder

ServerInfo.properties file location in catalina.jar is /org/apache/catalina/util/ServerInfo.properties

Notice : shutdown the Tomcat server(if it's already opened by cmd) before doing these things otherwise your file doesn't change and your winrar shows error.

Then change the following code in ServerInfo.properties

server.info=Apache Tomcat/8.0.8.5.4
server.number=8.5.4.0
server.built=Jul 6 2016 08:43:30 UTC

Restart your eclipse(if opened). Now it'll work...

ScreenShot of eclipse

Vinoth Vino
  • 9,166
  • 3
  • 66
  • 70
  • Does it work on OS X too? I've just patched my catalina.jar and it doesn't work (nothing has changed after the patch). My Eclipse version is: Eclipse Java EE IDE for Web Developers. Version: Mars.2 Release (4.5.2) Build id: 20160218-0600 – pidabrow Aug 21 '16 at 08:55
  • Sure it'll work on OS X too.Initially, I did these changes on my Mac only. After that I planned to use Tomcat on windows. So I just did it and posted as answer here. Give it a try... @piotrdab – Vinoth Vino Aug 21 '16 at 11:46
14

As for now Eclipse Neon service release is available. So if someone is still encounters this trouble, just go to

Help → Check for Updates

and install provided updates related to : org.eclipse.jst

JRichardsz
  • 14,356
  • 6
  • 59
  • 94
Cryptor
  • 347
  • 1
  • 3
  • 9
  • Note that you still need to select *Apache Tomcat v9.0* from the list of server runtimes, which is a little counter-intuitive, but it does work. – Periata Breatta Oct 24 '16 at 12:24
  • 1
    I have _Eclipse Java EE IDE for Web Developers_ version _Neon.1 Release (4.6.1)_. Among older Tomcat vestions I also have `v8.0`, `v8.5` and `v9.0` available in _Define a New Server_ window. Maybe Eclipse version you use is different. – Cryptor Oct 25 '16 at 07:37
  • 3
    I confirm that *Eclipse Neon.1 (4.6.1)* add a *Tomcat v8.5 Server* – Ortomala Lokni Oct 25 '16 at 09:37
  • Hmm.. I have 4.6.0 with WST upgraded via the suggested action and still don't have Tomcat 8.5 on the list... but Tomcat 9.0 does work. Bizarre. – Periata Breatta Oct 26 '16 at 16:14
  • Eclipse Neon.3 (4.6.3) also has a Tomcat v8.5 Server – albciff May 22 '17 at 13:49
  • I had the same exact issue, running on ubuntu 18.04, Tomcat v8.5.50 and eclipse v4.11 . and this solution worked for me perfectly. – David NIWEWE Jan 23 '20 at 09:24
4

This workaround worked for me. I edited the serverInfo.properties file as given below:

server.info=Apache Tomcat/8.0.0
server.number=8.0.0.0
server.built=Oct 6 2016 20:15:31 UTC
srodrb
  • 1,304
  • 13
  • 23
Vikd
  • 121
  • 1
  • 8
3

I had similar issues with Eclipse Kepler v3.8 I had tomcat v8.5.37 installed. I couldn't see Apache v8.5 as an option. By skimming through StackOverflow I found Apache v9.0 is available on Eclipse Neon. Cool thing is you don't have to change your eclipse version. In your current Eclipse. Download WTP(Web Tools Package) by following the steps:

Step 1: Help >>> Install New Software. Copy this link in the Work with: http://download.eclipse.org/webtools/repository/neon

Step 2: Select JST Server Adapters and JST Server Adapters Extensions from the first package you see. Install those.

Step 3: Windows >>> Preferences >>> Server >>> Runtime Environments >>> Add..

You'll see Apache v9.0 there! It works!

  • Thanks! I had just (re)installed Eclipse 2019-03 on my MacBook, and Tomcat is always the hardest plugin for me to find. I used https://download.eclipse.org/webtools/repository/2019-03/ – Thad Apr 16 '19 at 16:07
2

Install the latest version of eclipse(). It would have the option to add Tomcat 8.5.

1

Go to the preview version of tomcat e.g. : tomcat 8.3 and copy catalina.jar file and paste into the existing tomcat which you have facing the issue

Sanjay
  • 11
  • 1
0

Forgive me for invoking old problem. But it is like legendary, always happen for new users. The reason I am here is I want to purpose different answer. Rather simple. Please fo to windows->preference->Runtime Environment->search and select the folder where you download the server. It will automatically detect the server and you are good to go.

parlad
  • 1,143
  • 4
  • 23
  • 42
0

I'm guessing that you are running Eclipse Mars, or an even earlier release. You need to upgrade to Eclipse Neon or later

0
Navigate to /apache-tomcat-8.5.65/lib/org/apache/catalina/util/ServerInfo.properties
Then change 
server.info=Apache Tomcat/8.5.65
server.number=8.5.4.0
server.built=Jul 6 2021 00:29:43 UTC




server.info=Apache Tomcat/8.0.8.5.4
server.number=8.5.4.0
server.built=Jul 6 2016 08:43:30 UTC
Sy.Moh
  • 1
  • 1