5

I got the same problem with the questions here : Tomcat started in eclipse but unable to connect to link to http://localhost:8085/, that means I can't open http://localhost:8080/ at the browser :

HTTP Status 404 - /
type Status report
message /
description The requested resource (/) is not available.
Apache Tomcat/7.0.27

//Console info when tomcat started//

Apr 10, 2012 4:26:32 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to                   org.eclipse.jst.jee.server:SimpleServletProject' did not find a matching property.
Apr 10, 2012 4:26:32 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Apr 10, 2012 4:26:33 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Apr 10, 2012 4:26:33 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 880 ms
Apr 10, 2012 4:26:33 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Apr 10, 2012 4:26:33 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.27
Apr 10, 2012 4:26:33 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Apr 10, 2012 4:26:33 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Apr 10, 2012 4:26:33 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 495 ms

I'm using Tomcat 7.0.27, Eclipse Europa and Java 1.6.0_32. I saw BalusC's answer, but the problem is that I couldn't select Tomcat installation (the picture below).

What could be wrong here?

enter image description here

EDIT1 : When I tried to create demo webpage, it couldn't be opened too (with the same error).

EDIT2: Followed this thread Why tomcat server location property is greyed in Eclipse I can open http://localhost:8080/ in the browser, but still cant access the demo web page..

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"        xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-  app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
    <display-name>SimpleServletProject</display-name>
    <welcome-file-list>
          <welcome-file> index.html</welcome-file>
    </welcome-file-list>
</web-app>

PS : It seems that there's no more space to me to post index.hmtl (it's just a normal html )..

Community
  • 1
  • 1
TU_HEO DAKAI
  • 2,197
  • 8
  • 28
  • 39

5 Answers5

8

I am using apache 7. When started in command prompt everything works as expected but if I start same from eclipse then I was not able to access it and find the settings.

Looks like eclipse uses by default 'Use workspace metadata' and deploy path to 'wtpwebapps' in server settings. Follow the below steps to change these and you will be able access localhost:8080 when you start server in eclipse.

  1. In eclipse servers tab at bottom, right click, where you can see start, stop etc, and select properties.
  2. In properties window, select general, then select Switch Location.
  3. Now you can see Tomcat v7.0 Server at localhost in the servers tab, double click on it.
  4. a. If there are any modules deployed, temporarily remove them and close out tab to save this change, otherwise go directly to step 4c below.
  5. b. If you removed any modules, restart server after step 4a and proceed to step 4c.
  6. c. In server location, select radio button 'Use tomcat installation', and select 'webapps' in deploy path.

Save and start server in eclipse. Now you will be able to access the server.

aniketzr
  • 73
  • 1
  • 6
user1571273
  • 81
  • 1
  • 1
7

You want to access the root application (http://server:port/) but I'm quite sure that Eclipse wont install a root application. Try to access the application you deployed within the (eclipse managed) tomcat under http://server:port/yourapp.

magomi
  • 6,599
  • 5
  • 31
  • 38
  • For me it looks like either you didn't install any application to your tomcat server or the startup of your application failed. For the second case you should see any log entry in tomcats or your applications log files. How have you deployed your application to the tomcat instance? – magomi Apr 10 '12 at 10:58
1
In eclipse servers tab at bottom, right click, where you can see start, stop etc, and select properties.

****This works fine:****

In properties window, select general, then select Switch Location. Now you can see Tomcat v7.0 Server at localhost in the servers tab, double click on it. a. If there are any modules deployed, temporarily remove them and close out tab to save this change, otherwise go directly to step 4c below. b. If you removed any modules, restart server after step 4a and proceed to step 4c. c. In server location, select radio button 'Use tomcat installation', and select 'webapps' in deploy path.

manhunt
  • 11
  • 1
0

Please check your sample application request context path.

Sai Ye Yan Naing Aye
  • 6,622
  • 12
  • 47
  • 65
-3

It seems you want to connect to the same port as eclipse (8080). same as running skype and running a server will by default clash because they want to send data through the same port.

Try configurating the server connection ports you might want to set the localhost to port 3000 and try if that works.

dennis
  • 2,000
  • 18
  • 26
  • 1
    I think your are wrong. Tomcat will not start if the assigned port is already occupied by another process. – magomi Apr 10 '12 at 09:47
  • Therefor it return an error wich is logged (the console output above) 404 resource not available. meaning it is either occupied or not accesable but the ability to run it without running eclipse makes it obvious its occupied and therefor does not start. – dennis Apr 10 '12 at 09:51
  • 1
    Tomcat is most certainly running, as @heikkim mentioned it returned the error message. – David Apr 10 '12 at 10:32