How to install and configure Tomcat for eclipse IDE in macOS? - eclipse

Yes I know there are various similar questions like.
eclipse how to configure tomcat that install from package manager?
but not finding any solution to the problem I am facing.
What I am trying to do:
Install Eclipse on macOS
Install Tomcat 8/8.5 on same machine
Configure Tomcat to test Servlet developed in eclipse
What I have done so far:
1. Installed Eclipse
2. Installed tomcat using brew install tomcat#8 :nothing else done
3. Tried adding Server in Eclipse with path : /usr/local/Cellar/tomcat#8

Step 01 :Download Files Required
First Download the Version you Need for your project.
Make sure you download Core zip file from the link below:
Download Apache 7 Tomcat from this link.
Download Apache 8 Tomcat from this link.
Download Apache 9 Tomcat from this link.
Download Apache 10 (Alpha) Tomcat from this link.
Select .Zip from above section
Once you have downloaded it, unzip it to a location
Step 02 :Setting up Server in Eclipse
Open Eclipse Environment
Click on Servers Tab
Click on No servers are available. Click this link to create a new server...
Click Tomcat v(your downloaded version) Server and Next
Choose the extracted folder as path and runtime.
DONE!

Related

How to use Tomcat 8.5.x and TomEE 7.x with Eclipse?

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?
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
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
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...
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
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
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!
Install the latest version of eclipse(). It would have the option to add Tomcat 8.5.
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
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.
I'm guessing that you are running Eclipse Mars, or an even earlier release. You need to upgrade to Eclipse Neon or later
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

root path glassfish v4 eclipse luna

I had just installed eclipse luna and I use the marketplace to install oracle package to use glassfish v4.0. Everything went ok but when I'm trying to install it they still show me an error at the server root path (Error: The specified directory is not a valid GlassFish installation.)...I don't know why? this happen even giving it a path. have anyone resolve this issue?.
I got caught by this trying to following along with the Lynda.com tutorial on web services with Java EE. You need to download and install Glassfish and then point the server root to the glassfish directory. Here are the steps I took:
download glassfish from here: https://glassfish.java.net/download.html
unzip the zip file: this is essentially the install step
navigate into the installation to the glassfish folder: this what you point eclipse to
The high level answer is here: How do I use Glass fish server with eclipse luna for Java EE?
Possible duplicate of How do I use Glass fish server with eclipse luna for Java EE?
However, you need to specify the "glassfish" folder under the extracted GlassFish files, for example ...\glassfish4\glassfish
First Download full platform from https://glassfish.java.net/download.html
Unzip it.
At the window you read this error, go to the browse for server root and find the glassfish folder inside your unzipped folder. Click on it and your error will be gone.

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.
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.
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 .
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"/>
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.
I have tried below and it worked for me.
In eclipse go to Help->Eclipse Marketplace
Type JST extension in search box.
Install JSP Adapters for Luna
Restart the eclispe
You should be able to see Tocmat 8 server while adding new server.
In addition to #Jason's answer I had to do a bit more to get my app to run.
Download & unzip Eclipse IDE for Java EE Developers (Note the EE edition)
Download & unzip Eclipse's Web Tools Platform Stable (Milestone) 3.6+
Overwrite the two folders in the Eclipse IDE, with the WTP folder(s) (features & plugins folders)
Download and unzip Tomcat 8
In eclipse new -> other -> server -> Tomcat 8 (choose the unzipped location)
If you get a 404, click the Tomcat 8 in the Servers view -> Server Locations -> Change to Use Tomcat installation, and change the Deploy path: to webapps *
(If you can't edit this, delete any published webapps)
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
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!
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/
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
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.

Apache Tomcat is missing in Eclipse 3.7

I am planning to using Apache Tomcat for my development purpose in Eclipse IDE. I have created a webservice application, for this I need to configure Installed runtime as Tomcat Server, to run the service.
When I try to install it, I find it was missing in the list of servers.
How can I resolve this?
Window > Show View > Servers. From there, Right click > New > Server and you should see a first group called Apache, with plenty of Tomcats to choose from.
It might depend on the version of Eclipse you are using. I know for sure that Eclipse for Java EE Developers contains these servers, Eclipse Classic or Eclipse for Java Developers might not include them.
I got this problem and found this solution, may be it can help you:
- 1st: Copy file servlet-api.jar in folder install tomcat:ex:C:\tomcat\common\lib\servlet-api.jar into folder install java ex: C:\Program Files\java\jdk1.5\jre\lib\ext.
-2nd: open: C:\tomcat\conf\context.xml
add Text:
< Context reloadable = “true”>
WEB-INF/web.xml
…….
3rd: Download file tomcatPlugin….
unzip into "plugin" folder of eclipse
Start eclipse, go to Window\preference\
In Preference Tab:
Chose Tomcat and config:
+Tomcat version: Your installed tomcat version
+Tomcat home: link to folder that you unzip tomcat (C:\Tomcat5.5)
Manager App username: admin
Manager App password: admin
Clik OK
Restart Eclipse
OK. GOOD LUCK ^^
Source: http://maivanha.blogspot.com/2007/11/i.html

Tomcat server type unavailable in Fedora 15 Eclipse package

I have installed Tomcat server on my Fedora 15, I can run it, and it's avaible at the localhost:8080. Then I tryed adding it into eclipse, File->New->Servers->Server But the list is empty. I am reading this guide http://vaadin.com/book/-/page/getting-started.first-project.html And this is how it should be
(source: vaadin.com)
And this is how I see it
howiseeit http://img42.imageshack.us/img42/8320/38149731.png
Maybe you don't have Eclipse WTP (Web Tools Project) installed. Try installing it on top of your Eclipse-Installation or get startet with the Eclipse IDE for Java EE Developers where this is already included.
In your first image.. .try to click Installed runtimes. Locate your tomcat installation directory and select it.
I think the server is not detected because it's either stopped or eclipse cannot find the installation directory.
Hope that helps. :)