73

I configured Tomcat 6.0.24 in Eclipse on port 8085 and started successfully with log as below:

Feb 17, 2010 4:24:31 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre6\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jre6/bin/client;C:/Program Files/Java/jre6/bin;E:\oracle\product\10.2.0\client_1\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBEM;C:\Program Files\Microsoft SQL Server\80\Tools\BINN;C:\Program Files\Common Files\Teleca Shared;C:\Program Files\Microsoft SQL Server\90\Tools\binn\;E:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\;C:\Program Files\MySQL\MySQL Server 5.0\bin;E:\komal-gohil\tools\Subversion\bin;C:\Sun\SDK\bin;e:\instantrails\ruby\bin;c:\program files\java\jdk1.6.0_11\bin;E:\komal-gohil\tools\apache-maven-2.2.1\bin;C:\program files\java\jdk1.6.0_11\bin;E:\komal-gohil\tools\Ant\bin;E:\komal-gohil\tools\apache-tomcat-5.5.17\bin;C:\Sun\SDK\lib\j2ee.jar;E:\komal-gohil\tools\android-sdk-windows-1.6_r1\tools;E:\komal-gohil\tools\Scala\bin;E:\komal-gohil\tools\pax-construct-1.4\bin
Feb 17, 2010 4:24:31 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8085
Feb 17, 2010 4:24:31 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 705 ms
Feb 17, 2010 4:24:32 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Feb 17, 2010 4:24:32 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.24
Feb 17, 2010 4:24:32 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8085
Feb 17, 2010 4:24:32 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8010
Feb 17, 2010 4:24:32 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/31  config=null
Feb 17, 2010 4:24:32 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 421 ms

But when I am trying to open http://localhost:8085 in webbrowser, it is giving me the following error:

HTTP Status 404 - /

type Status report

message /

description The requested resource (/) is not available.

Apache Tomcat/6.0.24

When I start Tomcat outside the Eclipse, then I can just open http://localhost:8085 in webbrowser.

What could be the reason for this? How do I solve this problem?

Community
  • 1
  • 1
komal
  • 743
  • 2
  • 7
  • 6

7 Answers7

185

What are you expecting? The default Tomcat homepage? If so, you'll need to configure Eclipse to take control over from Tomcat.

Doubleclick the Tomcat server entry in the Servers tab, you'll get the server configuration. At the left column, under Server Locations, select Use Tomcat installation. This way Eclipse will take full control over Tomcat, this way you'll also be able to access the default Tomcat homepage with the Tomcat Manager when running from inside Eclipse. I only don't see how that's useful while developing using Eclipse.

enter image description here

Note, when it is grayed out, read the section leading text! It literally says "Server must be published with no modules present to make changes". In other words, make sure that you've removed all modules via rightclick server and Add and remove... option, and then performed rightclick server and Publish.

The port number is not the problem. You would otherwise have gotten an exception in Tomcat's startup log, and the browser would show a browser-specific "Connection timed out" error page and thus not a Tomcat-specific error page which could impossibly be served when Tomcat was not up and running.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • 1
    Yes I am expecting for default Tomcat Homepage. I selected use tomcat installation and works fine. I am able to connect to tomcat homepage. Why we can not able to connect to default homepage with Use workspace metadata? – komal Feb 18 '10 at 09:02
  • 11
    Simply because the Tomcat homepage is not in the workspace metadata :) I.e. the Tomcat homepage is not one of the Eclipse projects. – BalusC Feb 18 '10 at 11:24
  • Thanks for your answer but you don't specify where to find this -> "Doubleclick the Tomcat server entry in the Servers tab,..." - maybe it's obvious but how does one find the Servers tab? – noogrub Jun 27 '12 at 18:35
  • 1
    @noogrub: it's in the section which appears by default at the bottom right hand side of Eclipse's viewport. See also the bottom of the screenshot. If yours is missing because you have closed it before for some reason, reopen it by *Window > Show View > Servers* – BalusC Jun 27 '12 at 18:50
  • HTTP Status 404 - /abhishek.webapp/ type Status report message /abhishek.webapp/ description The requested resource is not available. Apache Tomcat/7.0.41. I am also facing same issue but the solution given by BalusC is not working for me. Please guide me to resolve the issue – abhishek kumar gupta Jun 17 '13 at 09:47
  • @abishek: the question is about `/` not about `/something/` such as `/abishek.webapp/`. – BalusC Jun 17 '13 at 10:01
  • Keep in mind that on Windows 7 the Eclipse process doesn't have read/write permission in folders like 'C:\Program Files\Apache Software Foundation\Tomcat 7.0' – golimar Oct 09 '14 at 12:54
  • 1
    Dont forget change Deploy path to "webapps" – Phillip Kamikaze Jun 24 '15 at 16:09
  • This is the solution. But after that i got an error to copying files. With this http://stackoverflow.com/questions/18333739/error-in-publishing-the-configuration-in-eclipse i can resolve all problems. – Dominik Mar 29 '16 at 21:09
  • 1
    @Dominik: Just don't put it in "Program Files" folder :) That's only for applications installed by Windows installer. Better create a separate "Java" (orso) folder for unzipped Java applications. – BalusC Mar 29 '16 at 21:11
  • @BalusC okay but I installed Tomcat with the given installer ^^ – Dominik Mar 29 '16 at 21:22
  • 1
    @Dominik: eeew, that's only for production server environments, not for development! That installer basically installs after unzipping an additional service which makes sure it's auto-started on Windows startup. You don't at all need it during development in an IDE. Related: http://stackoverflow.com/q/5064733 – BalusC Mar 29 '16 at 21:23
  • I don't know why its not working for me, this is the port configuration port in my case `Tomcat Admin Port 8005 HTTP/1.1 8080 AJP 1.3 8009` still I am not able to access `localhost:8080` – viveksinghggits Jul 06 '16 at 19:07
  • Be careful. This setting will overwrite your `$CATALINA_HOME/conf/tomcat_users.xml`! – JonyD Sep 22 '16 at 14:58
  • @JonyD: the answer already warns that this setting will let Eclipse take over **full control** of Tomcat and that it doesn't make sense for development. – BalusC Sep 22 '16 at 15:06
  • @BalusC: yes, but the way I put it is more explicit. IMO you could refer "configuration files will be overwritten" to your answer so it is also more explicit. – JonyD Sep 22 '16 at 20:49
  • @Balus can you please take a look https://stackoverflow.com/questions/70117462/http-status-500-internal-server-not-responding – Encipher Nov 26 '21 at 07:46
2

Eclipse hooks Dynamic Web projects into tomcat and maintains it's own configuration but does not deploy the standard tomcat ROOT.war. As http://localhost:8085/ link returns 404 does indeed show that tomcat is up and running, just can't find a web app deployed to root.

By default, any deployed dynamic web projects use their project name as context root, so you should see http://localhost:8085/yourprojectname working properly, but check the Servers tab first to ensure that your web project has actually been deployed.

Hope that helps.

beny23
  • 34,390
  • 5
  • 82
  • 85
  • But If the server in running inside the eclipse then I must be able to connect to default tomcat homepage outside the eclipse, that is what I am not able to connect. – komal Feb 18 '10 at 08:43
  • The server is running in Eclipse but the default page (which is actually an application called ROOT.war) is not deployed in the configuration that Eclipse uses. Eclipse uses it's own config (in a location like workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\conf\server.xml), which is why you won't see the default homepage, but any web projects you deploy through the server tab will work. – beny23 Feb 18 '10 at 09:08
  • @beny23 Can you please check https://stackoverflow.com/questions/70117462/http-status-500-internal-server-not-responding – Encipher Nov 26 '21 at 07:47
1

Right-click on your project's name in Eclipse's Project Explorer, then click Run As followed by Run on Server. Click the Next button. Make sure your project's name is listed in the Configured: column on the right. If it is, then you should be able to access it with this URL:

http://localhost:8085/projectname/

Additionally, whenever you make new additions (such as new JSPs, graphics or other resources) to your project, be sure to refresh the project by clicking on its name and then hitting F5. Otherwise Eclipse does not know that those new resources are available and will not make them available to Tomcat to serve.

Brian Showalter
  • 4,321
  • 2
  • 26
  • 29
0

You can change the port number:

Open the server tab in eclipse -> right click open click on open---->you can change the port number.

Run the application with http://localhost:8080/Applicationname it will give output and also check http://localhost:8080/Applicationname/index.jsp

Ravi Bhatt
  • 1,930
  • 1
  • 14
  • 27
Karthik Reddy
  • 2,902
  • 1
  • 18
  • 9
0

You need to start the Apache Tomcat services.

Win+R --> sevices.msc

Then, search for Apache Tomcat and right click on it and click on Start. This will start the service and then you'll be able to see Apache Tomcat homepage on the localhost .

Germa Vinsmoke
  • 3,541
  • 4
  • 24
  • 34
0

In my case, Struts 2.5 need to use Tomcat 9.0, use Tomcat 10.0 get 404 error.

reference to https://issues.apache.org/jira/browse/WW-5110

yu yang Jian
  • 6,680
  • 7
  • 55
  • 80
-1

I may be out fishing here, but doesn't Tomcat by default open to port 8080? Try http://localhost:8080 instead.

mikek
  • 1,555
  • 17
  • 30