Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » Tomcat embedded in Eclipse doesn't work when launched from Eclipse. What have I done wrong?(Tomcat embedded in Eclipse doesn't work when launched from Eclipse. What have I done wrong?)
Tomcat embedded in Eclipse doesn't work when launched from Eclipse. What have I done wrong? [message #1698155] Thu, 11 June 2015 16:09 Go to next message
Steve Cohen is currently offline Steve CohenFriend
Messages: 46
Registered: July 2009
Member
Newly installed Eclipse Kepler on Windows 7 32 bit. New workspace.
Open servers view, See "No servers are available. Click this link to create a new server."
Click the link.
Choose Apache Tomcat 7.0
It offers to install apache-tomcat-7.0.47. I accept this
I accept the license terms

It asks for an installation directory I specify C:\apps\apache-tomcat-7.0. This directory did not exist previously.

Everything looks fine.

I start the server in eclipse. Console is clean of errors.

...
Jun 11, 2015 8:50:31 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Jun 11, 2015 8:50:31 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Jun 11, 2015 8:50:31 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 558 ms


I open a web browser window (or do same from external browser).

I type the url http://localhost:8080

Get 404 error page

I stop server in eclipse.

In DOS window I

cd C:\apps\apache-tomcat-7.0\bin
startup

Again it starts cleanly.

Now, from either the internal eclipse browser or an external one, http://localhost:8080 shows the Tomcat welcome page.

Two differences I note: Have I done 1) Eclipse launch is using jdk 1.7, which I have set as default, while system is using jdk 1.8. Switching JREs makes no difference however.

2) the log entries are as above except I see "http-apr-8080" and "ajp-apr-8080" when running standalone instead of "http-bio-8080" and "ajp-bio-8080" when I run from within Eclipse.

I try creating some sample HelloWorld type webapps in Eclipse. These also get 404's when I try to run them.

Can someone tell me what is going on? Have I done something wrong?
This should just work, but it isn't.


[UPDATE]: I was able to install a JBoss instance to Eclipse and this works right out of the box. Deployed apps work, the default page (http://localhost:8080) works. So this is definitely an issue with the Eclipse Tomcat tooling.

[Updated on: Thu, 11 June 2015 16:33]

Report message to a moderator

Re: Tomcat embedded in Eclipse doesn't work when launched from Eclipse. What have I done wrong? [message #1698158 is a reply to message #1698155] Thu, 11 June 2015 17:22 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry IsaacsFriend
Messages: 1354
Registered: July 2009
Senior Member
On 6/11/2015 12:09 PM, Steve Cohen wrote:
> Newly installed Eclipse Kepler on Windows 7 32 bit. New workspace.
> Open servers view, See "No servers are available. Click this link to
> create a new server."
> Click the link.
> Choose Apache Tomcat 7.0
> It offers to install apache-tomcat-7.0.47. I accept this
> I accept the license terms
>
> It asks for an installation directory I specify
> C:\apps\apache-tomcat-7.0. This directory did not exist previously.
>
> Everything looks fine.
>
> I start the server in eclipse. Console is clean of errors.
>
> ..
> Jun 11, 2015 8:50:31 AM org.apache.coyote.AbstractProtocol start
> INFO: Starting ProtocolHandler ["http-bio-8080"]
> Jun 11, 2015 8:50:31 AM org.apache.coyote.AbstractProtocol start
> INFO: Starting ProtocolHandler ["ajp-bio-8009"]
> Jun 11, 2015 8:50:31 AM org.apache.catalina.startup.Catalina start
> INFO: Server startup in 558 ms
>
> I open a web browser window (or do same from external browser).
>
> I type the url http://localhost:8080
>
> Get 404 error page
>
> I stop server in eclipse.
>
> In DOS window I
>
> cd C:\apps\apache-tomcat-7.0\bin
> startup
>
> Again it starts cleanly.
>
> Now, from either the internal eclipse browser or an external one,
> http://localhost:8080 shows the Tomcat welcome page.
>
> Two differences I note: Have I done 1) Eclipse launch is using jdk 1.7,
> which I have set as default, while system is using jdk 1.8. Switching
> JREs makes no difference however.
>
> 2) the log entries are as above except I see "http-apr-8080" and
> "ajp-apr-8080" when running standalone instead of "http-bio-8080" and
> "ajp-bio-8080" when I run from within Eclipse.
>
> I try creating some sample HelloWorld type webapps in Eclipse. These
> also get 404's when I try to run them.
>
> Can someone tell me what is going on? Have I done something wrong? This
> should just work, but it isn't.
>

You haven't done anything wrong, but what the WTP Tomcat support
delivers is slightly different from what you are expecting. Please
refer to the WTP Tomcat FAQ[1] for details about what to expect.

Basically, because Tomcat conveniently lets you create multiple server
instances from a single installation, the default behavior in WTP when
creating a Tomcat server is to create a separate instance to avoid
altering your existing installation. In your case, this probably isn't
important, but it could be for others. As a result, this separate
instance gets an "empty" ROOT webapp, which is why http://localhost:8080
gives 404 when starting from Eclipse. When you start Tomcat outside of
Eclipse, you are starting a different Tomcat server, i.e. the default
Tomcat instance provided by your installation.

Hopefully the FAQ will explain things well enough for you to understand
what is going on. If not, post back with your question.

Cheers,
Larry

[1] http://wiki.eclipse.org/WTP_Tomcat_FAQ
Re: Tomcat embedded in Eclipse doesn't work when launched from Eclipse. What have I done wrong? [message #1698169 is a reply to message #1698158] Thu, 11 June 2015 19:38 Go to previous messageGo to next message
Steve Cohen is currently offline Steve CohenFriend
Messages: 46
Registered: July 2009
Member
Thanks, Larry, this helps some but not 100%. I knew there was that "Open" functionality but had forgotten where to find it.
My situation now is this:

I have two "Hello World" apps, one built as a "Dynamic Web" project and the other built as Spring MVC (which also has the Dynamic Web facet). Both apps run correctly when run on a JBoss Server, but when using the Tomcat server (configured to use the Tomcat Installation server instance) only the Dynamic Web project works, the Spring MVC app does not.
Re: Tomcat embedded in Eclipse doesn't work when launched from Eclipse. What have I done wrong? [message #1698180 is a reply to message #1698169] Thu, 11 June 2015 20:53 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry IsaacsFriend
Messages: 1354
Registered: July 2009
Senior Member
On 6/11/2015 3:38 PM, Steve Cohen wrote:
> Thanks, Larry, this helps some but not 100%. I knew there was that
> "Open" functionality but had forgotten where to find it.
> My situation now is this:
>
> I have two "Hello World" apps, one built as a "Dynamic Web" project and
> the other built as Spring MVC (which also has the Dynamic Web facet).
> Both apps run correctly when run on a JBoss Server, but when using the
> Tomcat server (configured to use the Tomcat Installation server
> instance) only the Dynamic Web project works, the Spring MVC app does not.

I'm afraid I don't know that much about Spring MVC projects. Can you
elaborate on what is not working about it? Is the JBoss Server being
run separately from Eclipse, or are you running it from Eclipse as well?

Cheers,
Larry
Re: Tomcat embedded in Eclipse doesn't work when launched from Eclipse. What have I done wrong? [message #1781755 is a reply to message #1698155] Tue, 13 February 2018 04:07 Go to previous messageGo to next message
syafiqah ramly is currently offline syafiqah ramlyFriend
Messages: 1
Registered: February 2018
Junior Member
i have this issues. When i run the eclipse it shows no error but i cannot open localhost. is there any that you can guide me with.

thank you
  • Attachment: localhost.png
    (Size: 31.19KB, Downloaded 270 times)
Re: Tomcat embedded in Eclipse doesn't work when launched from Eclipse. What have I done wrong? [message #1781916 is a reply to message #1781755] Wed, 14 February 2018 15:47 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry IsaacsFriend
Messages: 1354
Registered: July 2009
Senior Member
See if this link answers your question:

https://wiki.eclipse.org/WTP_Tomcat_FAQ#If_I_start_my_Tomcat_server_and_try_to_display_Tomcat.27s_default_page.2C_why_do_I_see_a_directory_listing_or_404_error_page.3F

Cheers,
Larry
Re: Tomcat embedded in Eclipse doesn't work when launched from Eclipse. What have I done wrong? [message #1802634 is a reply to message #1781916] Wed, 13 February 2019 04:58 Go to previous message
Hudson73 Paul is currently offline Hudson73 PaulFriend
Messages: 1
Registered: February 2019
Junior Member
Larry Isaacs wrote on Wed, 14 February 2018 15:47
See if this link answers your question:

https://wiki.eclipse.org/WTP_Tomcat_FAQ#If_I_start_my_Tomcat_server_and_try_to_display_Tomcat.27s_default_page.2C_why_do_I_see_a_directory_listing_or_404_error_page.3F[/url]

Cheers,
Larry


Hi, i tried those method but didnt work for me...

Any new solution ???

9apps

[Updated on: Fri, 15 February 2019 04:28]

Report message to a moderator

Previous Topic:I keep seeing this error repeated on new installation of Servoy.
Next Topic:Cannot start gradle built project on eclipse tomcat
Goto Forum:
  


Current Time: Fri Dec 27 00:52:51 GMT 2024

Powered by FUDForum. Page generated in 0.06146 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top