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 |
Steve Cohen 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 |
Larry Isaacs 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
|
|
| | | | | |
Goto Forum:
Current Time: Thu Dec 05 15:54:46 GMT 2024
Powered by FUDForum. Page generated in 0.03668 seconds
|