Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Tomcat 5.5 startup detection
Tomcat 5.5 startup detection [message #224838] Mon, 08 December 2008 23:15 Go to next message
Andres Kievsky is currently offline Andres Kievsky
Messages: 5
Registered: July 2009
Junior Member
Hi,

I'm trying to use WTP with Tomcat 5.5. and an existing application that
has been developed in another IDE. From Eclipse, the application deploys
and starts up just fine and works correctly, but the server view is stuck
in "Starting..." mode, well after the application and Tomcat have
completed their startup and are serving requests.

I've seen the FAQ and googled, but none of the solutions seem to apply -
it's not running in debug mode, there's nothing strange in the tomcat
installation, etc. I would really appreciate some help with this, even if
it's just a suggestion on what I can check to identify the problem,
because I'm not sure where to start.

Thanks,
- Andres N. Kievsky
Re: Tomcat 5.5 startup detection [message #224863 is a reply to message #224838] Tue, 09 December 2008 12:41 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry Isaacs
Messages: 1303
Registered: July 2009
Senior Member
Andres Kievsky wrote:
> Hi,
>
> I'm trying to use WTP with Tomcat 5.5. and an existing application that
> has been developed in another IDE. From Eclipse, the application deploys
> and starts up just fine and works correctly, but the server view is
> stuck in "Starting..." mode, well after the application and Tomcat have
> completed their startup and are serving requests.
>
> I've seen the FAQ and googled, but none of the solutions seem to apply -
> it's not running in debug mode, there's nothing strange in the tomcat
> installation, etc. I would really appreciate some help with this, even
> if it's just a suggestion on what I can check to identify the problem,
> because I'm not sure where to start.
>
> Thanks,
> - Andres N. Kievsky
>

Which version of WTP are you using? Also, does the server exhibit this
behavior when no projects are added to it?

Cheers,
Larry
Re: Tomcat 5.5 startup detection [message #224870 is a reply to message #224863] Tue, 09 December 2008 18:11 Go to previous messageGo to next message
Andres Kievsky is currently offline Andres Kievsky
Messages: 5
Registered: July 2009
Junior Member
Thanks for the reply!

I'm using version 1.1.104.v20081006 of the Apache Tomcat Support.

The server behaves properly without any projects.

I've been looking at the WTP source code that does the pinging (classes
TomcatServerBehaviour and PingThread in
org.eclipse.jst.server.tomcat.core.internal) and what they are doing is
trying to connect to http://localhost:port. I see no reason for that to
fail, what could be wrong?

Thanks,
- Andres.
Re: Tomcat 5.5 startup detection [message #224898 is a reply to message #224870] Wed, 10 December 2008 10:54 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry Isaacs
Messages: 1303
Registered: July 2009
Senior Member
Andres Kievsky wrote:
> Thanks for the reply!
>
> I'm using version 1.1.104.v20081006 of the Apache Tomcat Support.

Thanks, this would be WTP 3.0.3.

>
> The server behaves properly without any projects.
>

Assuming there is more than one, can you identify which project, when
added, triggers the problem behavior? What is the context root
specified for that project?

> I've been looking at the WTP source code that does the pinging (classes
> TomcatServerBehaviour and PingThread in
> org.eclipse.jst.server.tomcat.core.internal) and what they are doing is
> trying to connect to http://localhost:port. I see no reason for that to
> fail, what could be wrong?

There isn't much to speculate with. Is there anything that might be
related showing up in the Console view for the Tomcat server or
Eclipse's Error Log view?

One brute force way to deal with this is to open a new workspace and get
source for org.eclipse.jst.server.tomcat.core plug-in. Run a debugging
session using this source against your normal workspace. You can then
debug through the code to see exactly what's going wrong.

Cheers,
Larry

>
> Thanks,
> - Andres.
>
Re: Tomcat 5.5 startup detection [message #224939 is a reply to message #224898] Wed, 10 December 2008 21:13 Go to previous messageGo to next message
Andres Kievsky is currently offline Andres Kievsky
Messages: 5
Registered: July 2009
Junior Member
Larry Isaacs wrote:
> Assuming there is more than one, can you identify which project, when
> added, triggers the problem behavior? What is the context root
> specified for that project?

The context root is /, and it (correctly, from the application's point of
view) returns a 404 if you try to load it. That must be why it's failing
to detect the startup. I'll try changing it and see what happens.

Regardless of the cause, I think the ping address/port/etc should be
configurable separately, what do you think?

Thanks for the help so far,
- Andres.
Re: Tomcat 5.5 startup detection [message #224947 is a reply to message #224939] Wed, 10 December 2008 21:55 Go to previous messageGo to next message
Andres Kievsky is currently offline Andres Kievsky
Messages: 5
Registered: July 2009
Junior Member
Andres Kievsky wrote:

> Larry Isaacs wrote:
>> Assuming there is more than one, can you identify which project, when
>> added, triggers the problem behavior? What is the context root
>> specified for that project?

> The context root is /, and it (correctly, from the application's point of
> view) returns a 404 if you try to load it. That must be why it's failing
> to detect the startup. I'll try changing it and see what happens.

> Regardless of the cause, I think the ping address/port/etc should be
> configurable separately, what do you think?

> Thanks for the help so far,
> - Andres.

Modifying the application to return a fixed HTML in / worked. Do you know
if there is someone I can talk to in order to add a patch to make the ping
URL configurable?

Thanks!
- Andres
Re: Tomcat 5.5 startup detection [message #224962 is a reply to message #224947] Thu, 11 December 2008 09:36 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry Isaacs
Messages: 1303
Registered: July 2009
Senior Member
Andres Kievsky wrote:
> Andres Kievsky wrote:
>
>> Larry Isaacs wrote:
>>> Assuming there is more than one, can you identify which project, when
>>> added, triggers the problem behavior? What is the context root
>>> specified for that project?
>
>> The context root is /

Technically you want to specify the "default" (i.e. ROOT) context, which
is done by specifying "" as the context root. WTP lets you specify "/",
which the Tomcat support will fix by changing it to "" in the published
server configuration.

>>, and it (correctly, from the application's point
>> of view) returns a 404 if you try to load it. That must be why it's
>> failing to detect the startup. I'll try changing it and see what happens.

In theory, any response should be fine, including 404's. I tried
creating an empty Dynamic Web Project with "" as the context root and
the ping worked fine. Does this experiment work for you too? If so, I
would be interested in finding you what in your web project causes the
ping to fail.

>
>> Regardless of the cause, I think the ping address/port/etc should be
>> configurable separately, what do you think?

The ping URL should always work. I don't think it should be possible to
configure it to something that would stop working if a project was added
or removed from the server. The advantage of the current URL is that
the Tomcat support guarantees there will be a default context on the
server. If a project isn't deployed as the default context, a default
context is provided. I think it would be more useful to figure out why
ping didn't work in your case and see if that can be fixed. The current
code which attempts to create a connection isn't all that sophisticated.

>
>> Thanks for the help so far,
>> - Andres.
>
> Modifying the application to return a fixed HTML in / worked. Do you
> know if there is someone I can talk to in order to add a patch to make
> the ping URL configurable?

I'm the primary committer for the Tomcat adapter in WTP, so that would
probably be me. As mentioned above, I think fixing ping with the
current URL would be more useful.

>
> Thanks!
> - Andres
>
Re: Tomcat 5.5 startup detection [message #224970 is a reply to message #224962] Fri, 12 December 2008 04:54 Go to previous messageGo to next message
Andres Kievsky is currently offline Andres Kievsky
Messages: 5
Registered: July 2009
Junior Member
> The ping URL should always work. I don't think it should be possible to
> configure it to something that would stop working if a project was added
> or removed from the server. The advantage of the current URL is that
> the Tomcat support guarantees there will be a default context on the
> server. If a project isn't deployed as the default context, a default
> context is provided. I think it would be more useful to figure out why
> ping didn't work in your case and see if that can be fixed. The current
> code which attempts to create a connection isn't all that sophisticated.

I rechecked, and it wasn't a 404. Instead, there was a redirection loop. I
have yet to debug the WTP code, but I just wanted to clarify it for you.
Please let me know if there's more information I can give you.

I'm a bit confused about why it shouldn't be configurable. What if I
configured tomcat to start in a remote server and want to ping that
address? Maybe there's an apache with mod_rewrite in the middle. I can
think of a few scenarios, but ultimately, it's obviously your choice;
please correct me.

Thanks for your help!

- Andres.
Re: Tomcat 5.5 startup detection [message #224994 is a reply to message #224970] Fri, 12 December 2008 08:43 Go to previous message
Larry Isaacs is currently offline Larry Isaacs
Messages: 1303
Registered: July 2009
Senior Member
Andres Kievsky wrote:
>> The ping URL should always work. I don't think it should be possible
>> to configure it to something that would stop working if a project was
>> added or removed from the server. The advantage of the current URL is
>> that the Tomcat support guarantees there will be a default context on
>> the server. If a project isn't deployed as the default context, a
>> default context is provided. I think it would be more useful to
>> figure out why ping didn't work in your case and see if that can be
>> fixed. The current code which attempts to create a connection isn't
>> all that sophisticated.
>
> I rechecked, and it wasn't a 404. Instead, there was a redirection loop.
> I have yet to debug the WTP code, but I just wanted to clarify it for
> you. Please let me know if there's more information I can give you.

The URL used doesn't end with a "/" so a redirection can be normal. Are
you saying it got in to a loop where it was continually redirecting? I
vaguely recall there being some setting available on the connection to
limit the number of redirects. At the moment, I have no idea what the
default would be.

Since it works for me using Tomcat 5.5 with it's default configuration,
I would be interested in any configuration changes you may have made
that might account for the problem. For example, is the HTTP connector
still using Coyote or something different?

>
> I'm a bit confused about why it shouldn't be configurable. What if I
> configured tomcat to start in a remote server and want to ping that
> address?

This could be useful once the WTP Tomcat adapter supported remote
servers. A patch to add remote server support would be welcome, but
would be a major undertaking.

> Maybe there's an apache with mod_rewrite in the middle. I can
> think of a few scenarios, but ultimately, it's obviously your choice;
> please correct me.

You are welcome to enter an enhancement request fro this in Bugzilla.
For this particular use case, I'm not sure how using an custom ping URL
would help overall. Apache would have to already be running since there
is no provision to start any server other than Tomcat. Thus, the
connection will be established immediately. I don't know how Apache
will react if it gets a request while Tomcat is starting up. If the
request fails early, then ping will need to be made smart enough to
realize that the response it got from Apache is telling it that Tomcat
isn't ready, rather that assuming any response means it's ok to proceed.
Making this work in a robust fashion could be challenging. I think
the current approach of pinging Tomcat directly would be a better way of
determining if Tomcat is running. For this use case, more useful would
be a way of feeding the Browser a customized URL for Run As -> Run on
Server. I'm not sure if this is what you are actually looking for.

Cheers,
Larry

>
> Thanks for your help!
>
> - Andres.
>
Previous Topic:Maven2 and WTP
Next Topic:Maven jars but publish locally but are copied into exported war file
Goto Forum:
  


Current Time: Wed Jul 30 15:35:03 EDT 2014

Powered by FUDForum. Page generated in 0.01692 seconds