views:

158

answers:

4

I am having some trouble getting Spring and Tomcat up and running and recognized by eclipse. I have looked around on google with no luck. Specifically, I am having trouble having eclipse recognize tomcat (I am running linux, and when I browse to the relevant jar file in the runtime environments configuration, eclipse wont allow me to select it). Could somebody please point me to (or describe here) how to get Spring and Tomcat working properly in eclipse and possible provide a "Hello World" example so I can test my first Spring application? Thank you very much.

A: 

Not familiar with Spring, but here's a link that helped me get Tomcat up and running in Eclipse:

http://www.windofkeltia.com/j2ee/wtp-tutorial.html

Chris Persichetti
A: 

you can try eclipse web tools platform for doing this.

You can go to your project then choose

Debug As --> Debug On Server

I think the server adapter for tomcat is installed by default.

You can download the JEE Distribution Of Eclipse to have this functionality out of the box.

grassbl8d
+2  A: 
  1. You must have WTP (Web Tools Platform). It is bundled in the JEE version of Eclipse
  2. Go to Window -> Preferences -> Server -> Runtime environment and click "add"
  3. Choose and setup your server following the wizard
  4. When finished, Go to Window > Show view > Other and locate Servers
  5. It will appear in the bottom panel. Now you can double-click it to set some options of your preference
  6. Right click your project > Debug > Debug on server (The project must be a "web project")

It's generally this. There might be some troubles in the last step, but use google or the link given by Chris for that.

Bozho
I was having problems with your step (3). I am running linux and when I browse to the jar file that it indicates, it won't allow me to select it...
Tms
More specifically...it asks me to locate my tomcat 6 installation directory. Perhaps I am just giving it the wrong location (/usr/share/tomcat6..). I am running Ubuntu.
Tms
Make sure you are selecting the tomcat directory not a jar... also eclipse will log errors in more detail in the Error Log View ( Window > Show View > Error Log) or you can go into your Eclipse workspace directory and find the actual log file... it might give more explanation about what is failing.
cjstehno
/usr/share/tomcat6 should be OK, in case you have the right permissions
Bozho
+1  A: 

Have a look at the Spring Tools Suite - essentially Eclipse with Spring specific extensions.

Chris Harcourt