51

EDIT 2014-02-07: Eclipse Luna is here, and support for Tomcat 8 is included in the bundled WTP : ) Happy days!

Tomcat 8 is still in development, but you can get it here. Now there is a RC version on the main Apache Tomcat page. Update 2/27/14: 8 is released now, and adapters built for WTP, just not integrated into eclipse bundles yet. Soon!

In Eclipse Kepler though, there is no supported adapter in the add server list for Tomcat 8. the Tomcat 7 adapter doesn't work, and it doesn't look like there's a new extension for it to download in the "Install new Extension" dialog.

Is my only option to get it (Tomcat 8) running locally outside of Eclipse and maybe hook a remote debugger into it for stepping through code? Will that even work for Eclipse Kepler + Tomcat 8? IntelliJ IDEA 12 couldn't do it in the 30 minutes of time I put into that path.

If you're wondering why I'm trying to do this at all, I'm playing around with Spring 4.0.0.M1 and 4.0.0.M2 WebSocket stuff. They (per Rossen Stoyanchev's Spring 4.0 blog post and examples) use JSR-356, which is implemented in Tomcat 8, theoretically to be back-ported at some point to Tomcat 7.

An answer to the broader question of "How can I easily get a development environment going for Spring 4 WebSocket support?" would be nice, but it would also still be nice to know how to plug in unsupported web servers to Eclipse.

Cheers, E

**Update 8/7/13 - Rossen Stoyanchev updated the Spring 4.0.0.M2 blog and added some jpda wisdom and shared that yeah, he's using remote debugging:

That said, it's not very hard to debug with Tomcat 8 inside Eclipse. Just change the last line in bin/startup.sh to be (note the addition of "jpda"):

 exec "$PRGDIR"/"$EXECUTABLE" jpda start "$@"

Inside Eclipse create a remote debugging configuration for localhost port 80, launch it after starting Tomcat, and you can put breakpoints in the source code.

Thanks Rossen!

**Update 9/29/13 - Eclipse Kepler SR1 just arrived, but alas! No WTP support for Tomcat 8. Tomcat 8 is up to RC3.

**Updates 12/5/13

  • Blog url fix.
  • Tomcat 8 up to RC5.
  • Bug to track WTP fix in Eclipse to support Tomcat 8 HERE.
  • IntelliJ IDEA new version 13 says it now supports Tomcat 8. Haven't tried yet personally.
Maarten Bodewes
  • 90,524
  • 13
  • 150
  • 263
ECDragon
  • 512
  • 1
  • 4
  • 7
  • check this out, works perfect for me with 0 problem! http://stackoverflow.com/questions/25164774/how-to-add-tomcat-8-to-eclipse-kepler-without-installing-the-big-whole-wtp-packa – huao Apr 30 '15 at 19:12

11 Answers11

59

UPDATE: Eclipse Mars EE and later have native support for Tomcat8. Use this only if you have an earlier version of eclipse.


The latest version of Eclipse still does not support Tomcat 8, but you can add the new version of WTP and Tomcat 8 support will be added natively. To do this:

  • Download the latest version of Eclipse for Java EE
  • Go to the WTP downloads page, select the latest version (currently 3.6), and download the zip (under Traditional Zip Files...Web App Developers). Here's the current link.
  • Copy the all of the files in features and plugins directories of the downloaded WTP into the corresponding Eclipse directories in your Eclipse folder (overwriting the existing files).

Start Eclipse and you should have a Tomcat 8 option available when you go to deploy. enter image description here

Jason
  • 13,563
  • 15
  • 74
  • 125
14

I follow Jason's step, but not works.

And then I find the WTP Update site http://download.eclipse.org/webtools/updates/.

Help -> Install new software -> Add > WTP:http://download.eclipse.org/webtools/updates/ -> OK

Then Help -> Check for update, just works, I don't know whether Jason's affect this .

wener
  • 7,191
  • 6
  • 54
  • 78
  • 1
    Thank you for the answer. The provided solution works. For Eclipse Kepler another URL should be used: `http://download.eclipse.org/releases/kepler/` and subsequently install `Web, XML, Java EE and OSGi Enterprise Development`. – 030 Jun 05 '14 at 18:13
  • @wener it is showing error "could not find http://download.eclipse.org/webtools/updates" – Sagar Jul 09 '14 at 21:06
  • Followed these steps but it showed no softwares when you check for updates. If you follow Jason's steps first then it shows some stuff to install but I was able to get Tomcat 8 showup even without doing anything else – FearlessHyena Jul 11 '14 at 17:38
  • @wener Which Eclipse version are you using, Luna ? – Christophe Roussy Oct 27 '14 at 13:29
  • no, Luna released at 25 June 2014, But my post date is 2014-4-21. – wener Oct 28 '14 at 03:12
13

The only thing the eclipse plugin is checking is the tomcat version inside:

catalina.jar!/org/apache/catalina/util/ServerInfo.properties

I replaced the properties file with the one in tomcat7 and that fixed the issue for eclipse

In order to be able to deploy the spring-websockets sample app you need to edit the following file in eclipse:

.settings/org.eclipse.wst.common.project.facet.core.xml

And change the web version to 2.5

<installed facet="jst.web" version="2.5"/>
  • 2
    I got the latest Tomcat 8.0.0 RC1, replaced it's ServerInfo.properties in it's catalina.jar with 7.0.42's version, and when I go to add a Tomcat 7 server to Eclipse, still get "Unknown version of Tomcat was specified" error and cannot proceed. Also tried replacing ServerInfo.class with 7.0.42 version, because there is a version number in there, too, to no avail. – ECDragon Aug 29 '13 at 19:44
  • It's definitely the catalina.jar that Eclipse is checking in Tomcat to validate the version. After comparing 7.0.42 and 8.0.0.RC1 catalina.jars, it looks like significant changes were made. – ECDragon Aug 31 '13 at 14:24
  • 1
    After digging into the Eclipse source, I found TomcatVersionHelper->checkCatalinaVersion() indeed opens server/lib/catalina.jar and checks org/apache/catalina/util/ServerInfo.properties for the server.info property. It takes the number after the first "/" as the version. – ECDragon Sep 05 '13 at 21:22
  • Another thing I found in Eclipse source was that it caches this info based on last update time of the file I believe. That could be the hangup I was having. Or it could be that I was not re-packing the jar correctly. Either way, I got this to work using your hack and substituting 7.0.42 ServerInfo.properties into the 8.0.0-RC1 catalina.jar, which answers my original question if you don't feel like setting up tomcat manually and doing remote debugging. – ECDragon Sep 05 '13 at 21:27
  • 1
    As a summary of steps I took on my mac: 1) rename catalina.jar to catalina.zip for 7.0.42 and 8.0.0-RC1. 2) Unzip catalina.zip(s) (a double-click on mac). 3) Replace the 8.0 version of org/apache/catalina/util/ServerInfo.properties with the 7.0 version 4) jar up the modified 8.0 catalina directory. I used this command from inside the exploded catalina directory: "jar cmf META-INF/MANIFEST.MF catalina.jar *" – ECDragon Sep 05 '13 at 21:31
  • Note that if you are using JAVA 1.7, the above trick will fail because Tomcat 7 doesn't support JAVA 1.7. – Manu Dec 24 '13 at 15:22
  • Manu, I don't think it's true. I've been able to run Tomcat 7 with a Java 7 installation. did you face any error/exception with this combo? – asgs Feb 03 '14 at 17:06
  • I would NOT use such a trick unless you are sure you know what you are doing... use the proper WTP update and Eclipse version. – Christophe Roussy Oct 27 '14 at 13:32
7

This should be a comment under the accepted answer, but I don't have 50 reputation yet.

At http://download.eclipse.org/webtools/downloads/

I first selected Released 3.5.2, which like others did not work for me. Then I picked Integration 3.6.0, and saw Tomcat 8 for New Project of Dynamic Web Project.

Wildly Stunted
  • 147
  • 1
  • 6
6

I have tried below and it worked for me.

  1. In eclipse go to Help->Eclipse Marketplace
  2. Type JST extension in search box.
  3. Install JSP Adapters for Luna
  4. Restart the eclispe
  5. You should be able to see Tocmat 8 server while adding new server.
manali
  • 61
  • 1
  • 1
2

In addition to @Jason's answer I had to do a bit more to get my app to run.

Community
  • 1
  • 1
lko
  • 8,161
  • 9
  • 45
  • 62
2

To add the Tomcat 9.0 (Tomcat build from the trunk) as a server in Eclipse.

Update the ServerInfo.properties file properties as below.

server.info=Apache Tomcat/@VERSION@
server.number=@VERSION_NUMBER@
server.built=@VERSION_BUILT@


server.info=Apache Tomcat/7.0.57
server.number=7.0.57.0
server.built=Nov 3 2014 08:39:16 UTC

Build the tomcat server from trunk and add the server as tomcat7 instance in Eclipse.

ServerInfo.properties file location : \tomcat\java\org\apache\catalina\util\ServerInfo.properties

G 1
  • 643
  • 7
  • 18
0

The latest version of Springsource STS (3.6) supports Tomcat 8. It is based on eclipse Luna 4.4 and supports Java 8. Have at it!

TechTrip
  • 4,299
  • 2
  • 21
  • 16
0

Alternatively we can use eclipse update site (Help -> Install New Features -> Add Site (urls below) -> Select desired Features).

For Luna: http://download.eclipse.org/webtools/repository/luna

For Kepler: http://download.eclipse.org/webtools/repository/kepler

For Helios: http://download.eclipse.org/webtools/repository/helios

For older version: http://download.eclipse.org/webtools/updates/

Yogendra Singh
  • 33,927
  • 6
  • 63
  • 73
0

Downloaded Eclipse Luna and installed WTP using http://download.eclipse.org/webtools/repository/luna

Downloaded Tomcat 8 and configured new server in Eclipse. I am able to setup tomcat 8 now in Eclipse luna

Kishore Guruswamy
  • 1,901
  • 1
  • 12
  • 5
0

If you have untarred your own version of tomcat v8 with a root user into a custom directory (linux) then the default permissions on the TOMCATROOT/lib directory do not allow normal user access.

Eclipse will not be able to see the catalina.jar to check the version. So no amount of fiddling aorund with the server.properties will help!

just add chmod u+x lib/ to allow normal user access to the libs.