Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Tomcat 8 in Eclipse?

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.
like image 436
ECDragon Avatar asked Jul 25 '13 20:07

ECDragon


People also ask

How do I import Tomcat into Eclipse?

Open Window -> Preferences -> Server -> Installed Runtimes to create a Tomcat installed runtime. Click on Add... to open the New Server Runtime dialog, then select your runtime under Apache (Apache Tomcat v5.

Is Tomcat 8.0 still supported?

The Apache Tomcat team announces that support for Apache Tomcat 8.0. x will end on 30 June 2018. This means that after 30 June 2018: releases from the 8.0.


1 Answers

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

like image 86
Jason Avatar answered Oct 29 '22 04:10

Jason