5

I have Tomcat 6.0 installation on my Win7 PC. I used 64/32bit windows installation. In Eclipse I was able to set paths and set server to use my Tomcat installation. Everything seems working fine until I run server from inside Eclipse.

I noticed that http://localhost:8080/index.html page is not available (Tomcat default home page). I also can't access http://localhost:8080/axis2. I have Axis2 installed too.

Since I am struggling to make simple axix2 web service for long time, I am thinking maybe this Eclipse instance of Tomcat is adding to my issues?

When I start Tomcat from windows GUI everything works as I expect.

Any ideas?

Thanks.

bobetko
  • 5,019
  • 14
  • 58
  • 85
  • How are you running tomcat ? Via the SysDeo eclipse plugin for tomcat OR you have a web app on your eclipse j2ee perspective and deploying the web app as "Run on server" from the "Run as" menu ? – Anubis05 Aug 18 '11 at 21:33
  • @ganguly: "SysDeo" and "j2ee", are you sure you're developing with most recent tools? I haven't seen them in Eclipse for over 5 years. – BalusC Aug 18 '11 at 21:57
  • that was a oops moment for me .. lemme see what am I missing :( – Anubis05 Aug 18 '11 at 22:01
  • @ganguly: "Eclipse for Java EE" should be all what you need. http://www.eclipse.org/home/categories/index.php?category=enterprise – BalusC Aug 18 '11 at 22:10
  • @BalusC I am using the same. Sysdeo is a plugin I have been using for 4 years now which gives you three small icons in your eclipse to start/stop/restart your tomcat. I do not use it any more , but was under the opinion lot of people must be using it . I was clearly wrong. Any ways thanks a lot for your effort at directing me to the right path .. kudos :) – Anubis05 Aug 18 '11 at 22:15

2 Answers2

10

Eclipse does by default not take control over the Tomcat installation and all of its pre-deployed webapps, instead it just uses its sole server engine and uses the workspace metadata as deploy space. When you start such a server configuration from inside Eclipse, all of the pre-deployed webapps will just be plain ignored, including Tomcat's default homepage.

To let Eclipse take control over the Tomcat installation, you need to doubleclick the Tomcat server entry in Servers view to get its configuration, then at the left column, under Server Locations, you need to select Use Tomcat installation (note, when it is grayed out, read the section leading text! It needs to be published without any projects).

enter image description here

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • This is a good answer BalusC, but I feel like everytime I do this Eclipse ends up trashing my Tomcat instance at some point and I have to reinstall everything. – jonathan.cone Aug 18 '11 at 21:41
  • @jonathan: Rightclick > *Clean* is magnificient. Also, you should realize that this Tomcat instance is supposed to be used *exclusively* by Eclipse this way. If you want a standalone Tomcat without Eclipse's intervention, then just setup another one, perhaps on a different port. – BalusC Aug 18 '11 at 21:43
  • Yes. It is grayed out. I am trying my best. But I really don't understand what does this mean: "Specify the server path (i.e. catalina.base) and deploy path. Server must be published with no modules present to make changes." – bobetko Aug 18 '11 at 21:44
  • Rightclick Tomcat, in *Add and Remove projects* remove all projects, then rightclick and *Publish* Tomcat. This way it's published with no modules present. – BalusC Aug 18 '11 at 21:45
  • Clean usually works for simple projects, but more complex deployments involving a dozen projects generally cause problems. – jonathan.cone Aug 18 '11 at 21:46
  • @jonathan: Then you first need to do a *Project > Clean*. Or even close and reopen those projects. I've never had the need to reinstall the server or something and I use it this way for almost a decade. – BalusC Aug 18 '11 at 21:47
  • Thanks a lot. Clean worked. Excuse my ignorance. I don't get this concept of publishing a tomcat server? So server is visible to projects? Also my configuration path in Server Overview showing an error. right now it is showing "/Servers2/Tomcat v6.0 Server at localhost-config" (with little red X). What should I put there? – bobetko Aug 18 '11 at 21:52
  • "Publishing" is the step of copying/refreshing/removing source files in the deploy space. As to the error, what's the error message? Check *Markers* tab if you can't find it. – BalusC Aug 18 '11 at 21:54
  • No specific info about error. It just says "1 error detected"... Anyway I clicked Browse button next to it and selected Server/Tomcat... (instead of Server2/Tomcat...). Error disappeared. Thanks for all your help. – bobetko Aug 18 '11 at 22:01
1

Yes, this is normal. In the Package Explorer, you can click the Servers folder and view the configuration files that the Eclipse instance is using, specifically server.xml and context.xml. You can edit this configuration to match your specific requirements.

You may also want to check out the section titled Tomcat Publishing Options in this link here: http://www.eclipse.org/webtools/releases/2.0/newandnoteworthy/server.php

I favor this approach because when WTP inevitably corrupts my configuration once every two weeks, I don't have to reinstall Tomcat, I can just delete the server and reconfigure it.

jonathan.cone
  • 6,592
  • 2
  • 30
  • 30