Re: Tomcat9 silently ignores web application

2023-07-11 Thread Christopher Schultz

Graham,

(Sorry, just getting back to your messages in this thread.)

On 7/8/23 06:20, Graham Leggett wrote:

On 08 Jul 2023, at 10:08, Graham Leggett 
wrote:


Another data point - when starting the application up under tomcat9
in eclipse, there is also no mention in the logs of the web
application having been deployed, however I am able to hit the
application with curl and receive a sensible result. The
application has been silently started.

On the target machine, we get no log line same as under eclipse,
and no application (404 Not Found). The application might have been
silently started at a different URL and with no log line we’ll
never know, or it silently failed to start and with no error we’ll
never know.


Having switched from declaring a context in server.xml to
Catalina/localhost we now get the startup line - it seems that
applications defined in server.xml are silently deployed, but the
behaviour hasn’t changed, we still get 404 on the application.
Maybe this is what Konstantin meant when he said that server.xml-defined 
applications don't quite behave the same way.



08-Jul-2023 11:59:59.016 INFO [main]
org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of
deployment descriptor
[/var/lib/tomcats/xxx-service-test/conf/Catalina/localhost/xxx-service-test.xml]
 has finished in [5,334] ms


Well, that's encouraging.


A further data point - the access_log as defined by default under the Host is 
created but stays empty:

   

 
 

 
 

   

In summary, the client hits tomcat, tomcat returns 404 on the request, and 
there is no trace in the access logfile that the client was ever there.

Anyone seen behaviour like this before?



Absolutely stupid question: are you sure that the port number you are 
contacting to is being served by /this/ Tomcat process?


-chris

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Tomcat9 silently ignores web application

2023-07-08 Thread Graham Leggett
On 08 Jul 2023, at 11:20, Graham Leggett  wrote:

> In summary, the client hits tomcat, tomcat returns 404 on the request, and 
> there is no trace in the access logfile that the client was ever there.

I've traced it to one level up - there is an httpd above this that was routing 
requests destined to this application to a second independent tomcat running on 
the same machine. This second tomcat was (correctly) returning 404.

When the logfile says no hits coming in, it means the hits are going somewhere 
else.

Now to pull apart httpd...

Regards,
Graham
—


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Tomcat9 silently ignores web application

2023-07-08 Thread Graham Leggett
On 08 Jul 2023, at 10:08, Graham Leggett  wrote:

> Another data point - when starting the application up under tomcat9 in 
> eclipse, there is also no mention in the logs of the web application having 
> been deployed, however I am able to hit the application with curl and receive 
> a sensible result. The application has been silently started.
> 
> On the target machine, we get no log line same as under eclipse, and no 
> application (404 Not Found). The application might have been silently started 
> at a different URL and with no log line we’ll never know, or it silently 
> failed to start and with no error we’ll never know.

Having switched from declaring a context in server.xml to Catalina/localhost we 
now get the startup line - it seems that applications defined in server.xml are 
silently deployed, but the behaviour hasn’t changed, we still get 404 on the 
application.

08-Jul-2023 11:59:59.016 INFO [main] 
org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of 
deployment descriptor 
[/var/lib/tomcats/xxx-service-test/conf/Catalina/localhost/xxx-service-test.xml]
 has finished in [5,334] ms

A further data point - the access_log as defined by default under the Host is 
created but stays empty:

  







  

In summary, the client hits tomcat, tomcat returns 404 on the request, and 
there is no trace in the access logfile that the client was ever there.

Anyone seen behaviour like this before?

Regards,
Graham
—



Re: Tomcat9 silently ignores web application

2023-07-08 Thread Graham Leggett
On 07 Jul 2023, at 23:23, Graham Leggett  wrote:

>> When you start Tomcat, do you get a message about /foo/bar being 
>> deployed in catalina.out? For example, I get this for every deployment:
>> 
>> Jul 06, 2023 4:09:33 PM org.apache.catalina.startup.HostConfig 
>> deployDirectory
>> INFO: Deploying web application directory [/full/path/to/web/application]
>> Jul 06, 2023 4:09:39 PM org.apache.catalina.startup.HostConfig 
>> deployDirectory
>> INFO: Deployment of web application directory 
>> [/full/path/to/web/application] has finished in [6,007] ms
> 
> In tomcat7 I see that line logged, in tomcat9 I do not.

Another data point - when starting the application up under tomcat9 in eclipse, 
there is also no mention in the logs of the web application having been 
deployed, however I am able to hit the application with curl and receive a 
sensible result. The application has been silently started.

On the target machine, we get no log line same as under eclipse, and no 
application (404 Not Found). The application might have been silently started 
at a different URL and with no log line we’ll never know, or it silently failed 
to start and with no error we’ll never know.

In the absence of both an error message, and confirmation of web application 
deployment, we’re flying blind.

Digging into the source, we find three similar strings to say we’re finished 
deploying a web application. Setting a breakpoint on all three, none of them 
are hit (or I’m using jdb wrong):

main[1] stop
No breakpoints set.
main[1] stop in org.apache.catalina.startup.HostConfig.deployDirectory
Deferring breakpoint org.apache.catalina.startup.HostConfig.deployDirectory.
It will be set after the class is loaded.
main[1] stop in org.apache.catalina.startup.HostConfig.deployDescriptor
Deferring breakpoint org.apache.catalina.startup.HostConfig.deployDescriptor.
It will be set after the class is loaded.
main[1] stop in org.apache.catalina.startup.HostConfig.deployWAR
Deferring breakpoint org.apache.catalina.startup.HostConfig.deployWAR.
It will be set after the class is loaded.
main[1] resume
All threads resumed.
> Set deferred breakpoint org.apache.catalina.startup.HostConfig.deployWAR
Set deferred breakpoint org.apache.catalina.startup.HostConfig.deployDescriptor
Set deferred breakpoint org.apache.catalina.startup.HostConfig.deployDirectory

> 

Regards,
Graham
—



Re: Tomcat9 silently ignores web application

2023-07-07 Thread Graham Leggett
On 2023/07/07 13:44:07 Christopher Schultz wrote:

> When you start Tomcat, do you get a message about /foo/bar being 
> deployed in catalina.out? For example, I get this for every deployment:
> 
> Jul 06, 2023 4:09:33 PM org.apache.catalina.startup.HostConfig 
> deployDirectory
> INFO: Deploying web application directory [/full/path/to/web/application]
> Jul 06, 2023 4:09:39 PM org.apache.catalina.startup.HostConfig 
> deployDirectory
> INFO: Deployment of web application directory 
> [/full/path/to/web/application] has finished in [6,007] ms

In tomcat7 I see that line logged, in tomcat9 I do not.

> Are you seeing that, and does it include (a) the expected path to your 
> application and (b) no errors indicating that deployment has failed?

There are no errors indicating that deployment has failed. In addition, there 
are many expected loglines showing that the application has been initialised 
(various application specific lines that I expect to see).

In short:

- the application is going through all the motions of being deployed 
successfully.
- no log line appears to say the application was deployed at the expected path.
- all URLs return 404 with no error.

It is failing silently at some point.

Regards,
Graham
—


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Tomcat9 silently ignores web application

2023-07-07 Thread Christopher Schultz

Graham,

On 7/7/23 08:48, Graham Leggett wrote:

1. Please read
https://tomcat.apache.org/tomcat-9.0-doc/config/context.html#Defining_a_context 


You are injecting a Context into a Host at the time when the
server.xml file is parsed. It does not go through the proper
"deployment" processing at start time.


I understand the different places that tomcat looks for contexts, I don’t 
understand “It does not go through the proper “deployment” processing at start 
time”. Can you clarify?


2. What result did you expect?


What I have is a context that is tightly bound to the tomcat that contains it. 
The whole tomcat generated is autogenerated, so creating lots of little files 
and somehow mapping their filenames safely on the filesystem is complexity I 
would rather avoid. One single server.xml is perfect in this case.

Where I am getting stuck is that tomcat is being coy with the deployment - I 
see tomcat complain loudly if you point at an appBase that doesn’t exist, but 
you change it to an appBase that does exist and tomcat starts fine, says 
nothing, and every URL returns a 404. Something has gone wrong somewhere, but 
without being given a clue as to what it is, I’m stuck.


When you start Tomcat, do you get a message about /foo/bar being 
deployed in catalina.out? For example, I get this for every deployment:


Jul 06, 2023 4:09:33 PM org.apache.catalina.startup.HostConfig 
deployDirectory

INFO: Deploying web application directory [/full/path/to/web/application]
Jul 06, 2023 4:09:39 PM org.apache.catalina.startup.HostConfig 
deployDirectory
INFO: Deployment of web application directory 
[/full/path/to/web/application] has finished in [6,007] ms


Are you seeing that, and does it include (a) the expected path to your 
application and (b) no errors indicating that deployment has failed?


-chris

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Tomcat9 silently ignores web application

2023-07-07 Thread Graham Leggett
Hi,

> 1. Please read
> https://tomcat.apache.org/tomcat-9.0-doc/config/context.html#Defining_a_context
>  
> 
> 
> You are injecting a Context into a Host at the time when the
> server.xml file is parsed. It does not go through the proper
> "deployment" processing at start time.

I understand the different places that tomcat looks for contexts, I don’t 
understand “It does not go through the proper “deployment” processing at start 
time”. Can you clarify?

> 2. What result did you expect?

What I have is a context that is tightly bound to the tomcat that contains it. 
The whole tomcat generated is autogenerated, so creating lots of little files 
and somehow mapping their filenames safely on the filesystem is complexity I 
would rather avoid. One single server.xml is perfect in this case.

Where I am getting stuck is that tomcat is being coy with the deployment - I 
see tomcat complain loudly if you point at an appBase that doesn’t exist, but 
you change it to an appBase that does exist and tomcat starts fine, says 
nothing, and every URL returns a 404. Something has gone wrong somewhere, but 
without being given a clue as to what it is, I’m stuck.

Regards,
Graham
—



Re: Tomcat9 silently ignores web application

2023-07-02 Thread Konstantin Kolinko
вс, 2 июл. 2023 г. в 01:50, Graham Leggett :
>
> Hi all,
>
> I have for a while now been moving various web applications onto a new 
> machine running tomcat9, and things have been working great. I have suddenly 
> reached one web application which is silently ignored.
>
> Tomcat starts up without any error, makes no mention of the webapp. If the 
> webapp points to a bogus directory, tomcat complains very loudly, point 
> tomcat to the correct directory, tomcat ignores the webapp.
>
> Any attempt to hit the webapp returns the dreaded tomcat 404 page. 
> Interestingly hitting /foo/bar returns a redirect to /foo/bar/ (as you would 
> expect it to), but /foo/bar/ returns a tomcat 404.
>
> The webapp is not being newly developed, and works fine on tomcat7 on the old 
> machine.
>
> Is there anything that can be done to coax an error message or any message 
> out of tomcat when it fails to deploy something?
>
> Snip of server.xml looks like this:
>
>unpackWARs="true" autoDeploy="true">
>
> 
> 
>
> 
>  directory="logs"
>prefix="localhost_access_log" suffix=".txt"
>pattern="%h %l %u %t "%r" %s %b" />
>
> 
>
> 

1. Please read
https://tomcat.apache.org/tomcat-9.0-doc/config/context.html#Defining_a_context

You are injecting a Context into a Host at the time when the
server.xml file is parsed. It does not go through the proper
"deployment" processing at start time.

2. What result did you expect?

The default behaviour is to look for a welcome-file, such as
"index.html". Do you have one?

The possible names of welcome files are configured by
"welcome-file-list" setting in the WEB-INF/web of a web application.
(The defaults, shared by all web applications, are configured with the
conf/web.xml file in Tomcat configuration.)

Alternatively, you may reconfigure the DefaultServlet (by copying its
servlet and servlet-mapping configuration from the conf/web.xml file
into your web application) and enable directory listings. Those are
off by default.

https://tomcat.apache.org/tomcat-9.0-doc/default-servlet.html

Best regards,
Konstantin kolinko

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org