0
votes

I have successfully setup Tomcat on my PC (Windows) and it works with sample hello world servlet. I am using Tomcat native (which I believe has its own inbuilt web server).

I have downloaded and installed Eclipse Java EE and have created a simple servlet.

In Preferences I have added the Tomcat Server and path to installation directory: D:\Program Files\Apache Software Foundation\Tomcat 7.0.

I also added the servlet-api.jar file from the Tomcat download to the project Java Build Path as an external JAR.

Error: Problem occurred 'Launching Tomcat v7.0 Server at localhost' has encountered a problem. Several ports (8080, 8009) required by Tomcat v7.0 Server at localhost are already in use. The server may already be running...

The server is already running but if I stop the service and re-run get same error. If Tomcat is running when I start to Run in Eclipse then it stops Tomcat???

In the Eclipse address bar windows I have _http://localhost:8080/MyLittleDynamicWebProject/servlet/MyFirstServlet.MyFirstServlet

and I see a view of web page HTTP Status 404 - requested resource is not available.

Could it be a problem Eclipse creating the necessary folder structure?

Anyone any ideas on how to fix this?

1

1 Answers

0
votes

There may be a problem using eclipse when running Tomcat as a service. I saw on youtube that tomcat integrated with eclipse was being started as a command line application. So I uninstalled the Tomcat which had been installed on my Windows machine using an installer. I deleted my previous eclipse workspace folder.

Then followed these steps.

  1. Create a top level folder (eg java_web_programming).
  2. Copy eclipse download into a folder called eclipse under this top level folder.
  3. At same level copied tomcat 7 download.
  4. Started eclipse in servers tab created new server, pointing to /tomcat-7 folder (under java_web_programming).

Now everything works.

Just goes to show that just doing things the same old way you used to do them... doesn't always work.