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: 1350
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 message
Larry Isaacs is currently offline Larry IsaacsFriend
Messages: 1350
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
Previous Topic:IBM Websphere Application Server V8.0X Developer Tools for Kepler
Next Topic:Content Assist for XHTML files causes eclipse to freeze
Goto Forum:
  


Current Time: Tue Jan 23 04:06:39 GMT 2018

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

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