Re: Tomcat 9 returning 404 for audio files

2024-03-14 Thread Christopher Schultz

Sam,

On 3/13/24 22:34, Sam wrote:

Thank you so much!

Finally issue is resolved.

Regards!

On Tue, Mar 12, 2024, 11:43 p.m. Anson Cheung 
wrote:


ok,it's a problem caused by tomcat cache. You need to disable it. Please
refer to

https://serverfault.com/questions/40205/how-do-i-disable-tomcat-caching-im-having-weird-static-file-problems

On Wed, Mar 13, 2024 at 3:46 AM Chuck Caldarale  wrote:




On Mar 12, 2024, at 13:15, Sam  wrote:

As I said earlier, 404 error is only returned 1st time.

Subsequent requests work fine.



What triggers the creation of the audio file? Is it possible that the
trigger creates a file-not-found state in the Tomcat resource cache, and
that’s what is returned the first time?


If disabling your cache "[finally resolved your issue]" then everyone 
who was asking if you were triggering a file-read through Tomcat was 
correct, even though you kept telling them they were wrong.


-chris

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



Re: Tomcat 9 returning 404 for audio files

2024-03-13 Thread Sam
Thank you so much!

Finally issue is resolved.

Regards!

On Tue, Mar 12, 2024, 11:43 p.m. Anson Cheung 
wrote:

> ok,it's a problem caused by tomcat cache. You need to disable it. Please
> refer to
>
> https://serverfault.com/questions/40205/how-do-i-disable-tomcat-caching-im-having-weird-static-file-problems
>
> On Wed, Mar 13, 2024 at 3:46 AM Chuck Caldarale  wrote:
>
> >
> > > On Mar 12, 2024, at 13:15, Sam  wrote:
> > >
> > > As I said earlier, 404 error is only returned 1st time.
> > >
> > > Subsequent requests work fine.
> >
> >
> > What triggers the creation of the audio file? Is it possible that the
> > trigger creates a file-not-found state in the Tomcat resource cache, and
> > that’s what is returned the first time?
> >
> >   - Chuck
> >
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> > For additional commands, e-mail: users-h...@tomcat.apache.org
> >
> >
>


Re: Tomcat 9 returning 404 for audio files

2024-03-12 Thread Anson Cheung
ok,it's a problem caused by tomcat cache. You need to disable it. Please
refer to
https://serverfault.com/questions/40205/how-do-i-disable-tomcat-caching-im-having-weird-static-file-problems

On Wed, Mar 13, 2024 at 3:46 AM Chuck Caldarale  wrote:

>
> > On Mar 12, 2024, at 13:15, Sam  wrote:
> >
> > As I said earlier, 404 error is only returned 1st time.
> >
> > Subsequent requests work fine.
>
>
> What triggers the creation of the audio file? Is it possible that the
> trigger creates a file-not-found state in the Tomcat resource cache, and
> that’s what is returned the first time?
>
>   - Chuck
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: Tomcat 9 returning 404 for audio files

2024-03-12 Thread Chuck Caldarale


> On Mar 12, 2024, at 13:15, Sam  wrote:
> 
> As I said earlier, 404 error is only returned 1st time.
> 
> Subsequent requests work fine.


What triggers the creation of the audio file? Is it possible that the trigger 
creates a file-not-found state in the Tomcat resource cache, and that’s what is 
returned the first time?

  - Chuck


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



Re: Tomcat 9 returning 404 for audio files

2024-03-12 Thread Sam
Hi,

Yes, path is tomcat/webapps/ROOT/wav/

As I said earlier, 404 error is only returned 1st time.

Subsequent requests work fine.


On Tue, Mar 12, 2024, 3:13 a.m. Anson Cheung 
wrote:

> src="/wav/2B916004DFE94FA40446429E1671C893_0001053.mp3"
> Please confirm that your file is placed under the path
> "/apache-tomcat-9.0.30/webapps/ROOT/wav/"   not " /wav/ "
>
> On Tue, Mar 12, 2024 at 11:20 AM Sam  wrote:
>
> > Hi Chris,
> >
> > I'm creating the audio file dynamically from DB and  I check if the file
> > exists using File.exists() method.
> >
> > Before returning the html code with audio tag, I'm verifying that file
> > exists on File System.
> >
> > Thanks!
> >
> > On Mon, Mar 11, 2024 at 2:36 PM Christopher Schultz <
> > ch...@christopherschultz.net> wrote:
> >
> > > Sam,
> > >
> > > On 3/11/24 13:04, Sam wrote:
> > > > On the server side, I'm checking that file exists before returning
> the
> > > file
> > > > path to the browser. We are also dynamically creating pdf files this
> > way
> > > > and no issues with accessing them.
> > >
> > > How are you checking to see if the file exists? It's possible that your
> > > check-for-existance triggers the "not found" in Tomcat's 
> > > instance, then you create your file on-disk and return the path to the
> > > browser, then the browser requests the path and gets the cached "not
> > > found".
> > >
> > > > I found something interesting:
> > > > https://tomcat.apache.org/tomcat-9.0-doc/config/resources.html From
> > this
> > > > link:
> > > > *Resources are cached by default.*
> > > >
> > > > I'll try with *Cache-Control* request header and see if it helps!
> > >
> > > This isn't likey to be the problem. I think the cache you are fighting
> > > is the one Tomcat maintains for "resources" which is how Tomcat loads
> > > things from ... well, everywhere. Not caching things like "not found"
> > > makes things go very slowly.
> > >
> > > -chris
> > >
> > > > On Mon, Mar 11, 2024 at 11:46 AM Mark Thomas 
> wrote:
> > > >
> > > >> On 11/03/2024 11:31, Sam wrote:
> > > >>> Thanks for replying!!
> > > >>>
> > > >>> Yes audio files are generated dynamically from DB.in a Servlet.
> > > >>>
> > > >>> I've verified that audio file exists on file system before
> returning
> > > the
> > > >>> html code that contains audo control.
> > > >>
> > > >> Is there any chance of an attempt to access the file before it is
> > > >> created? The resources implementation can cache "not found" results
> > for
> > > >> a short period of time.
> > > >>
> > > >> You might want to test the code with a simple text file to determine
> > > >> whether file type is a factor (which seems unlikely but you never
> > know).
> > > >>
> > > >> Mark
> > > >>
> > > >>>
> > > >>>
> > > >>> On Mon, Mar 11, 2024, 5:22 a.m. Mark Thomas 
> > wrote:
> > > >>>
> > >  On 11/03/2024 02:21, Sam wrote:
> > > > I just upgraded a legacy application from Tomcat 7 to Tomcat 9.
> > It's
> > > > deployed as a war file. I'm facing a weird issue with audio files
> > >  playback.
> > > >
> > > > When loading a page that contains an audio file. First time
> Tomcat
> > >  returns
> > > > 404 error but if reloading the page, audio file is loaded
> properly
> > > and
> > > >> no
> > > > error from Tomcat.
> > > >
> > > > I'm using html 5 audio control to display the file.
> > > >
> > > > All other static resources(images, css and js files) are working
> > > >> without
> > > > any issues. Only audio files are having this issue.
> > > >
> > > > I enabled the logs for DefaultServlet in Tomcat. Follwong is the
> > log
> > >  entry
> > > > when I try to open the audio file first time. I can see 404 being
> > >  returned
> > > > from server in Chrome dev tools.
> > > >
> > > >
> > > > *09-Mar-2024 20:12:50.747 INFO DefaultServlet.serveResource:
> > Serving
> > > > resource '/wav/2B916004DFE94FA40446429E1671C893_0001053.mp3'
> > headers
> > > >> and
> > > > data*
> > > > Following is the log for 2nd attempt. This time audio is
> available
> > > and
> > > > playable in browser. *09-Mar-2024 20:13:00.371 INFO
> > > > DefaultServlet.serveResource: Serving resource
> > > > '/wav/2B916004DFE94FA40446429E1671C893_0001053.mp3' headers and
> > data
> > > *
> > > > *09-Mar-2024 20:13:01.372 INFO DefaultServlet.serveFile:
> > > > contentType='audio/mpeg'*
> > > 
> > >  Are the audio files generated dynamically on request?
> > > 
> > >  Mark
> > > 
> > > 
> > > >
> > > > Here is the audio control code:
> > > >
> > > > 
> > > >> > >>
> > > >   > > >>>
> > > > > > >> src="/wav/2B916004DFE94FA40446429E1671C893_0001053.mp3"
> > > > type="audio/mpeg" >
> > > >  
> > > >   
> > > > 
> > > > I've tried relative path and full path but result is the same in
> > both
> > >  cases.
> > > >
> > > > I've 

Re: Tomcat 9 returning 404 for audio files

2024-03-12 Thread Anson Cheung
src="/wav/2B916004DFE94FA40446429E1671C893_0001053.mp3"
Please confirm that your file is placed under the path
"/apache-tomcat-9.0.30/webapps/ROOT/wav/"   not " /wav/ "

On Tue, Mar 12, 2024 at 11:20 AM Sam  wrote:

> Hi Chris,
>
> I'm creating the audio file dynamically from DB and  I check if the file
> exists using File.exists() method.
>
> Before returning the html code with audio tag, I'm verifying that file
> exists on File System.
>
> Thanks!
>
> On Mon, Mar 11, 2024 at 2:36 PM Christopher Schultz <
> ch...@christopherschultz.net> wrote:
>
> > Sam,
> >
> > On 3/11/24 13:04, Sam wrote:
> > > On the server side, I'm checking that file exists before returning the
> > file
> > > path to the browser. We are also dynamically creating pdf files this
> way
> > > and no issues with accessing them.
> >
> > How are you checking to see if the file exists? It's possible that your
> > check-for-existance triggers the "not found" in Tomcat's 
> > instance, then you create your file on-disk and return the path to the
> > browser, then the browser requests the path and gets the cached "not
> > found".
> >
> > > I found something interesting:
> > > https://tomcat.apache.org/tomcat-9.0-doc/config/resources.html From
> this
> > > link:
> > > *Resources are cached by default.*
> > >
> > > I'll try with *Cache-Control* request header and see if it helps!
> >
> > This isn't likey to be the problem. I think the cache you are fighting
> > is the one Tomcat maintains for "resources" which is how Tomcat loads
> > things from ... well, everywhere. Not caching things like "not found"
> > makes things go very slowly.
> >
> > -chris
> >
> > > On Mon, Mar 11, 2024 at 11:46 AM Mark Thomas  wrote:
> > >
> > >> On 11/03/2024 11:31, Sam wrote:
> > >>> Thanks for replying!!
> > >>>
> > >>> Yes audio files are generated dynamically from DB.in a Servlet.
> > >>>
> > >>> I've verified that audio file exists on file system before returning
> > the
> > >>> html code that contains audo control.
> > >>
> > >> Is there any chance of an attempt to access the file before it is
> > >> created? The resources implementation can cache "not found" results
> for
> > >> a short period of time.
> > >>
> > >> You might want to test the code with a simple text file to determine
> > >> whether file type is a factor (which seems unlikely but you never
> know).
> > >>
> > >> Mark
> > >>
> > >>>
> > >>>
> > >>> On Mon, Mar 11, 2024, 5:22 a.m. Mark Thomas 
> wrote:
> > >>>
> >  On 11/03/2024 02:21, Sam wrote:
> > > I just upgraded a legacy application from Tomcat 7 to Tomcat 9.
> It's
> > > deployed as a war file. I'm facing a weird issue with audio files
> >  playback.
> > >
> > > When loading a page that contains an audio file. First time Tomcat
> >  returns
> > > 404 error but if reloading the page, audio file is loaded properly
> > and
> > >> no
> > > error from Tomcat.
> > >
> > > I'm using html 5 audio control to display the file.
> > >
> > > All other static resources(images, css and js files) are working
> > >> without
> > > any issues. Only audio files are having this issue.
> > >
> > > I enabled the logs for DefaultServlet in Tomcat. Follwong is the
> log
> >  entry
> > > when I try to open the audio file first time. I can see 404 being
> >  returned
> > > from server in Chrome dev tools.
> > >
> > >
> > > *09-Mar-2024 20:12:50.747 INFO DefaultServlet.serveResource:
> Serving
> > > resource '/wav/2B916004DFE94FA40446429E1671C893_0001053.mp3'
> headers
> > >> and
> > > data*
> > > Following is the log for 2nd attempt. This time audio is available
> > and
> > > playable in browser. *09-Mar-2024 20:13:00.371 INFO
> > > DefaultServlet.serveResource: Serving resource
> > > '/wav/2B916004DFE94FA40446429E1671C893_0001053.mp3' headers and
> data
> > *
> > > *09-Mar-2024 20:13:01.372 INFO DefaultServlet.serveFile:
> > > contentType='audio/mpeg'*
> > 
> >  Are the audio files generated dynamically on request?
> > 
> >  Mark
> > 
> > 
> > >
> > > Here is the audio control code:
> > >
> > > 
> > >> >>
> > >   > >>>
> > > > >> src="/wav/2B916004DFE94FA40446429E1671C893_0001053.mp3"
> > > type="audio/mpeg" >
> > >  
> > >   
> > > 
> > > I've tried relative path and full path but result is the same in
> both
> >  cases.
> > >
> > > I've spent days trying to solve this but no luck :(
> > >
> > > I would really appreciate any guidance to solve this issue.
> > >
> > > Thanks!
> > >
> > 
> > 
> -
> >  To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> >  For additional commands, e-mail: users-h...@tomcat.apache.org
> > 
> > 
> > >>>
> > >>
> > >> 

Re: Tomcat 9 returning 404 for audio files

2024-03-11 Thread Sam
Hi Chris,

I'm creating the audio file dynamically from DB and  I check if the file
exists using File.exists() method.

Before returning the html code with audio tag, I'm verifying that file
exists on File System.

Thanks!

On Mon, Mar 11, 2024 at 2:36 PM Christopher Schultz <
ch...@christopherschultz.net> wrote:

> Sam,
>
> On 3/11/24 13:04, Sam wrote:
> > On the server side, I'm checking that file exists before returning the
> file
> > path to the browser. We are also dynamically creating pdf files this way
> > and no issues with accessing them.
>
> How are you checking to see if the file exists? It's possible that your
> check-for-existance triggers the "not found" in Tomcat's 
> instance, then you create your file on-disk and return the path to the
> browser, then the browser requests the path and gets the cached "not
> found".
>
> > I found something interesting:
> > https://tomcat.apache.org/tomcat-9.0-doc/config/resources.html From this
> > link:
> > *Resources are cached by default.*
> >
> > I'll try with *Cache-Control* request header and see if it helps!
>
> This isn't likey to be the problem. I think the cache you are fighting
> is the one Tomcat maintains for "resources" which is how Tomcat loads
> things from ... well, everywhere. Not caching things like "not found"
> makes things go very slowly.
>
> -chris
>
> > On Mon, Mar 11, 2024 at 11:46 AM Mark Thomas  wrote:
> >
> >> On 11/03/2024 11:31, Sam wrote:
> >>> Thanks for replying!!
> >>>
> >>> Yes audio files are generated dynamically from DB.in a Servlet.
> >>>
> >>> I've verified that audio file exists on file system before returning
> the
> >>> html code that contains audo control.
> >>
> >> Is there any chance of an attempt to access the file before it is
> >> created? The resources implementation can cache "not found" results for
> >> a short period of time.
> >>
> >> You might want to test the code with a simple text file to determine
> >> whether file type is a factor (which seems unlikely but you never know).
> >>
> >> Mark
> >>
> >>>
> >>>
> >>> On Mon, Mar 11, 2024, 5:22 a.m. Mark Thomas  wrote:
> >>>
>  On 11/03/2024 02:21, Sam wrote:
> > I just upgraded a legacy application from Tomcat 7 to Tomcat 9. It's
> > deployed as a war file. I'm facing a weird issue with audio files
>  playback.
> >
> > When loading a page that contains an audio file. First time Tomcat
>  returns
> > 404 error but if reloading the page, audio file is loaded properly
> and
> >> no
> > error from Tomcat.
> >
> > I'm using html 5 audio control to display the file.
> >
> > All other static resources(images, css and js files) are working
> >> without
> > any issues. Only audio files are having this issue.
> >
> > I enabled the logs for DefaultServlet in Tomcat. Follwong is the log
>  entry
> > when I try to open the audio file first time. I can see 404 being
>  returned
> > from server in Chrome dev tools.
> >
> >
> > *09-Mar-2024 20:12:50.747 INFO DefaultServlet.serveResource: Serving
> > resource '/wav/2B916004DFE94FA40446429E1671C893_0001053.mp3' headers
> >> and
> > data*
> > Following is the log for 2nd attempt. This time audio is available
> and
> > playable in browser. *09-Mar-2024 20:13:00.371 INFO
> > DefaultServlet.serveResource: Serving resource
> > '/wav/2B916004DFE94FA40446429E1671C893_0001053.mp3' headers and data
> *
> > *09-Mar-2024 20:13:01.372 INFO DefaultServlet.serveFile:
> > contentType='audio/mpeg'*
> 
>  Are the audio files generated dynamically on request?
> 
>  Mark
> 
> 
> >
> > Here is the audio control code:
> >
> > 
> >>>
> >   >>>
> > >> src="/wav/2B916004DFE94FA40446429E1671C893_0001053.mp3"
> > type="audio/mpeg" >
> >  
> >   
> > 
> > I've tried relative path and full path but result is the same in both
>  cases.
> >
> > I've spent days trying to solve this but no luck :(
> >
> > I would really appreciate any guidance to solve this issue.
> >
> > Thanks!
> >
> 
>  -
>  To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>  For additional commands, e-mail: users-h...@tomcat.apache.org
> 
> 
> >>>
> >>
> >> -
> >> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> >> For additional commands, e-mail: users-h...@tomcat.apache.org
> >>
> >>
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: Tomcat 9 returning 404 for audio files

2024-03-11 Thread Christopher Schultz

Sam,

On 3/11/24 13:04, Sam wrote:

On the server side, I'm checking that file exists before returning the file
path to the browser. We are also dynamically creating pdf files this way
and no issues with accessing them.


How are you checking to see if the file exists? It's possible that your 
check-for-existance triggers the "not found" in Tomcat's  
instance, then you create your file on-disk and return the path to the 
browser, then the browser requests the path and gets the cached "not found".



I found something interesting:
https://tomcat.apache.org/tomcat-9.0-doc/config/resources.html From this
link:
*Resources are cached by default.*

I'll try with *Cache-Control* request header and see if it helps!


This isn't likey to be the problem. I think the cache you are fighting 
is the one Tomcat maintains for "resources" which is how Tomcat loads 
things from ... well, everywhere. Not caching things like "not found" 
makes things go very slowly.


-chris


On Mon, Mar 11, 2024 at 11:46 AM Mark Thomas  wrote:


On 11/03/2024 11:31, Sam wrote:

Thanks for replying!!

Yes audio files are generated dynamically from DB.in a Servlet.

I've verified that audio file exists on file system before returning the
html code that contains audo control.


Is there any chance of an attempt to access the file before it is
created? The resources implementation can cache "not found" results for
a short period of time.

You might want to test the code with a simple text file to determine
whether file type is a factor (which seems unlikely but you never know).

Mark




On Mon, Mar 11, 2024, 5:22 a.m. Mark Thomas  wrote:


On 11/03/2024 02:21, Sam wrote:

I just upgraded a legacy application from Tomcat 7 to Tomcat 9. It's
deployed as a war file. I'm facing a weird issue with audio files

playback.


When loading a page that contains an audio file. First time Tomcat

returns

404 error but if reloading the page, audio file is loaded properly and

no

error from Tomcat.

I'm using html 5 audio control to display the file.

All other static resources(images, css and js files) are working

without

any issues. Only audio files are having this issue.

I enabled the logs for DefaultServlet in Tomcat. Follwong is the log

entry

when I try to open the audio file first time. I can see 404 being

returned

from server in Chrome dev tools.


*09-Mar-2024 20:12:50.747 INFO DefaultServlet.serveResource: Serving
resource '/wav/2B916004DFE94FA40446429E1671C893_0001053.mp3' headers

and

data*
Following is the log for 2nd attempt. This time audio is available and
playable in browser. *09-Mar-2024 20:13:00.371 INFO
DefaultServlet.serveResource: Serving resource
'/wav/2B916004DFE94FA40446429E1671C893_0001053.mp3' headers and data *
*09-Mar-2024 20:13:01.372 INFO DefaultServlet.serveFile:
contentType='audio/mpeg'*


Are the audio files generated dynamically on request?

Mark




Here is the audio control code:


  
bottom:0;"



 


   
src="/wav/2B916004DFE94FA40446429E1671C893_0001053.mp3"

type="audio/mpeg" >
 
  

I've tried relative path and full path but result is the same in both

cases.


I've spent days trying to solve this but no luck :(

I would really appreciate any guidance to solve this issue.

Thanks!



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






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






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



Re: Tomcat 9 returning 404 for audio files

2024-03-11 Thread Sam
Service is running on Windows, I've verified no access issues!

Issue occurs only the first time, Subsequently audio loads properly.

Thank you!

On Mon, Mar 11, 2024 at 12:43 PM Ivano Luberti 
wrote:

> Could it be the file is created with incorrect access rights?
>
> Il 11/03/2024 16:46, Mark Thomas ha scritto:
> > On 11/03/2024 11:31, Sam wrote:
> >> Thanks for replying!!
> >>
> >> Yes audio files are generated dynamically from DB.in a Servlet.
> >>
> >> I've verified that audio file exists on file system before returning the
> >> html code that contains audo control.
> >
> > Is there any chance of an attempt to access the file before it is
> > created? The resources implementation can cache "not found" results
> > for a short period of time.
> >
> > You might want to test the code with a simple text file to determine
> > whether file type is a factor (which seems unlikely but you never know).
> >
> > Mark
> >
> >>
> >>
> >> On Mon, Mar 11, 2024, 5:22 a.m. Mark Thomas  wrote:
> >>
> >>> On 11/03/2024 02:21, Sam wrote:
>  I just upgraded a legacy application from Tomcat 7 to Tomcat 9. It's
>  deployed as a war file. I'm facing a weird issue with audio files
> >>> playback.
> 
>  When loading a page that contains an audio file. First time Tomcat
> >>> returns
>  404 error but if reloading the page, audio file is loaded properly
>  and no
>  error from Tomcat.
> 
>  I'm using html 5 audio control to display the file.
> 
>  All other static resources(images, css and js files) are working
>  without
>  any issues. Only audio files are having this issue.
> 
>  I enabled the logs for DefaultServlet in Tomcat. Follwong is the log
> >>> entry
>  when I try to open the audio file first time. I can see 404 being
> >>> returned
>  from server in Chrome dev tools.
> 
> 
>  *09-Mar-2024 20:12:50.747 INFO DefaultServlet.serveResource: Serving
>  resource '/wav/2B916004DFE94FA40446429E1671C893_0001053.mp3'
>  headers and
>  data*
>  Following is the log for 2nd attempt. This time audio is available and
>  playable in browser. *09-Mar-2024 20:13:00.371 INFO
>  DefaultServlet.serveResource: Serving resource
>  '/wav/2B916004DFE94FA40446429E1671C893_0001053.mp3' headers and data *
>  *09-Mar-2024 20:13:01.372 INFO DefaultServlet.serveFile:
>  contentType='audio/mpeg'*
> >>>
> >>> Are the audio files generated dynamically on request?
> >>>
> >>> Mark
> >>>
> >>>
> 
>  Here is the audio control code:
> 
>  
>    >
>  
>  src="/wav/2B916004DFE94FA40446429E1671C893_0001053.mp3"
>  type="audio/mpeg" >
>  
>   
>  
>  I've tried relative path and full path but result is the same in both
> >>> cases.
> 
>  I've spent days trying to solve this but no luck :(
> 
>  I would really appreciate any guidance to solve this issue.
> 
>  Thanks!
> 
> >>>
> >>> -
> >>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> >>> For additional commands, e-mail: users-h...@tomcat.apache.org
> >>>
> >>>
> >>
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> > For additional commands, e-mail: users-h...@tomcat.apache.org
> >
> --
>
> Archimede Informatica tratta i dati personali in conformità a quanto
> stabilito dal Regolamento UE n. 2016/679 (GDPR) e dal D. Lgs. 30 giugno
> 2003 n. 196
> per come modificato dal D.Lgs. 10 agosto 2018 n. 101.
> Informativa completa
> <
> http://www.archicoop.it/fileadmin/pdf/InformativaTrattamentoDatiPersonali.pdf
> >
>
> Il contenuto di questo messaggio e dei suoi eventuali allegati è
> riservato. Nel caso in cui Lei non sia il destinatario, La preghiamo di
> contattare telefonicamente o via e-mail il mittente ai recapiti sopra
> indicati e di cancellare il messaggio e gli eventuali allegati dal Suo
> sistema senza farne copia o diffonderli. Le opinioni espresse sono
> quelle dell'autore e non rappresentano necessariamente quelle della
> Società.
> This message and any attachment are confidential.If you are not the
> intended recipient, please telephone or email the sender and delete this
> message and any attachment from your system. If you are not the intended
> recipient you must not copy this message or attachment or disclose the
> contents to any other person. Any opinions presented are solely those of
> the author and do not necessarily represent those of the Company.
>
> dott. Ivano Mario Luberti
>
> Archimede Informatica società cooperativa a r. l.
> Via Gereschi 36, 56127 Pisa
>
> tel.: +39 050/580959 | fax: +39 050/8932061
>
> web: www.archicoop.it
> linkedin: www.linkedin.com/in/ivanoluberti
> facebook: www.facebook.com/archimedeinformaticapisa/
>


Re: Tomcat 9 returning 404 for audio files

2024-03-11 Thread Sam
On the server side, I'm checking that file exists before returning the file
path to the browser. We are also dynamically creating pdf files this way
and no issues with accessing them.

I found something interesting:
https://tomcat.apache.org/tomcat-9.0-doc/config/resources.html From this
link:
*Resources are cached by default.*

I'll try with *Cache-Control* request header and see if it helps!

Thank you!

On Mon, Mar 11, 2024 at 11:46 AM Mark Thomas  wrote:

> On 11/03/2024 11:31, Sam wrote:
> > Thanks for replying!!
> >
> > Yes audio files are generated dynamically from DB.in a Servlet.
> >
> > I've verified that audio file exists on file system before returning the
> > html code that contains audo control.
>
> Is there any chance of an attempt to access the file before it is
> created? The resources implementation can cache "not found" results for
> a short period of time.
>
> You might want to test the code with a simple text file to determine
> whether file type is a factor (which seems unlikely but you never know).
>
> Mark
>
> >
> >
> > On Mon, Mar 11, 2024, 5:22 a.m. Mark Thomas  wrote:
> >
> >> On 11/03/2024 02:21, Sam wrote:
> >>> I just upgraded a legacy application from Tomcat 7 to Tomcat 9. It's
> >>> deployed as a war file. I'm facing a weird issue with audio files
> >> playback.
> >>>
> >>> When loading a page that contains an audio file. First time Tomcat
> >> returns
> >>> 404 error but if reloading the page, audio file is loaded properly and
> no
> >>> error from Tomcat.
> >>>
> >>> I'm using html 5 audio control to display the file.
> >>>
> >>> All other static resources(images, css and js files) are working
> without
> >>> any issues. Only audio files are having this issue.
> >>>
> >>> I enabled the logs for DefaultServlet in Tomcat. Follwong is the log
> >> entry
> >>> when I try to open the audio file first time. I can see 404 being
> >> returned
> >>> from server in Chrome dev tools.
> >>>
> >>>
> >>> *09-Mar-2024 20:12:50.747 INFO DefaultServlet.serveResource: Serving
> >>> resource '/wav/2B916004DFE94FA40446429E1671C893_0001053.mp3' headers
> and
> >>> data*
> >>> Following is the log for 2nd attempt. This time audio is available and
> >>> playable in browser. *09-Mar-2024 20:13:00.371 INFO
> >>> DefaultServlet.serveResource: Serving resource
> >>> '/wav/2B916004DFE94FA40446429E1671C893_0001053.mp3' headers and data *
> >>> *09-Mar-2024 20:13:01.372 INFO DefaultServlet.serveFile:
> >>> contentType='audio/mpeg'*
> >>
> >> Are the audio files generated dynamically on request?
> >>
> >> Mark
> >>
> >>
> >>>
> >>> Here is the audio control code:
> >>>
> >>> 
> >>>   
> >>>  >
> >>>src="/wav/2B916004DFE94FA40446429E1671C893_0001053.mp3"
> >>> type="audio/mpeg" >
> >>> 
> >>>  
> >>> 
> >>> I've tried relative path and full path but result is the same in both
> >> cases.
> >>>
> >>> I've spent days trying to solve this but no luck :(
> >>>
> >>> I would really appreciate any guidance to solve this issue.
> >>>
> >>> Thanks!
> >>>
> >>
> >> -
> >> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> >> For additional commands, e-mail: users-h...@tomcat.apache.org
> >>
> >>
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: Tomcat 9 returning 404 for audio files

2024-03-11 Thread Ivano Luberti

Could it be the file is created with incorrect access rights?

Il 11/03/2024 16:46, Mark Thomas ha scritto:

On 11/03/2024 11:31, Sam wrote:

Thanks for replying!!

Yes audio files are generated dynamically from DB.in a Servlet.

I've verified that audio file exists on file system before returning the
html code that contains audo control.


Is there any chance of an attempt to access the file before it is 
created? The resources implementation can cache "not found" results 
for a short period of time.


You might want to test the code with a simple text file to determine 
whether file type is a factor (which seems unlikely but you never know).


Mark




On Mon, Mar 11, 2024, 5:22 a.m. Mark Thomas  wrote:


On 11/03/2024 02:21, Sam wrote:

I just upgraded a legacy application from Tomcat 7 to Tomcat 9. It's
deployed as a war file. I'm facing a weird issue with audio files

playback.


When loading a page that contains an audio file. First time Tomcat

returns
404 error but if reloading the page, audio file is loaded properly 
and no

error from Tomcat.

I'm using html 5 audio control to display the file.

All other static resources(images, css and js files) are working 
without

any issues. Only audio files are having this issue.

I enabled the logs for DefaultServlet in Tomcat. Follwong is the log

entry

when I try to open the audio file first time. I can see 404 being

returned

from server in Chrome dev tools.


*09-Mar-2024 20:12:50.747 INFO DefaultServlet.serveResource: Serving
resource '/wav/2B916004DFE94FA40446429E1671C893_0001053.mp3' 
headers and

data*
Following is the log for 2nd attempt. This time audio is available and
playable in browser. *09-Mar-2024 20:13:00.371 INFO
DefaultServlet.serveResource: Serving resource
'/wav/2B916004DFE94FA40446429E1671C893_0001053.mp3' headers and data *
*09-Mar-2024 20:13:01.372 INFO DefaultServlet.serveFile:
contentType='audio/mpeg'*


Are the audio files generated dynamically on request?

Mark




Here is the audio control code:


 
bottom:0;"


    
  src="/wav/2B916004DFE94FA40446429E1671C893_0001053.mp3"

type="audio/mpeg" >
    
 

I've tried relative path and full path but result is the same in both

cases.


I've spent days trying to solve this but no luck :(

I would really appreciate any guidance to solve this issue.

Thanks!



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






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


--

Archimede Informatica tratta i dati personali in conformità a quanto
stabilito dal Regolamento UE n. 2016/679 (GDPR) e dal D. Lgs. 30 giugno 
2003 n. 196

per come modificato dal D.Lgs. 10 agosto 2018 n. 101.
Informativa completa 



Il contenuto di questo messaggio e dei suoi eventuali allegati è 
riservato. Nel caso in cui Lei non sia il destinatario, La preghiamo di 
contattare telefonicamente o via e-mail il mittente ai recapiti sopra 
indicati e di cancellare il messaggio e gli eventuali allegati dal Suo 
sistema senza farne copia o diffonderli. Le opinioni espresse sono 
quelle dell'autore e non rappresentano necessariamente quelle della Società.
This message and any attachment are confidential.If you are not the 
intended recipient, please telephone or email the sender and delete this 
message and any attachment from your system. If you are not the intended 
recipient you must not copy this message or attachment or disclose the 
contents to any other person. Any opinions presented are solely those of 
the author and do not necessarily represent those of the Company.


dott. Ivano Mario Luberti

Archimede Informatica società cooperativa a r. l.
Via Gereschi 36, 56127 Pisa

tel.: +39 050/580959 | fax: +39 050/8932061

web: www.archicoop.it
linkedin: www.linkedin.com/in/ivanoluberti
facebook: www.facebook.com/archimedeinformaticapisa/


Re: Tomcat 9 returning 404 for audio files

2024-03-11 Thread Mark Thomas

On 11/03/2024 11:31, Sam wrote:

Thanks for replying!!

Yes audio files are generated dynamically from DB.in a Servlet.

I've verified that audio file exists on file system before returning the
html code that contains audo control.


Is there any chance of an attempt to access the file before it is 
created? The resources implementation can cache "not found" results for 
a short period of time.


You might want to test the code with a simple text file to determine 
whether file type is a factor (which seems unlikely but you never know).


Mark




On Mon, Mar 11, 2024, 5:22 a.m. Mark Thomas  wrote:


On 11/03/2024 02:21, Sam wrote:

I just upgraded a legacy application from Tomcat 7 to Tomcat 9. It's
deployed as a war file. I'm facing a weird issue with audio files

playback.


When loading a page that contains an audio file. First time Tomcat

returns

404 error but if reloading the page, audio file is loaded properly and no
error from Tomcat.

I'm using html 5 audio control to display the file.

All other static resources(images, css and js files) are working without
any issues. Only audio files are having this issue.

I enabled the logs for DefaultServlet in Tomcat. Follwong is the log

entry

when I try to open the audio file first time. I can see 404 being

returned

from server in Chrome dev tools.


*09-Mar-2024 20:12:50.747 INFO DefaultServlet.serveResource: Serving
resource '/wav/2B916004DFE94FA40446429E1671C893_0001053.mp3' headers and
data*
Following is the log for 2nd attempt. This time audio is available and
playable in browser. *09-Mar-2024 20:13:00.371 INFO
DefaultServlet.serveResource: Serving resource
'/wav/2B916004DFE94FA40446429E1671C893_0001053.mp3' headers and data *
*09-Mar-2024 20:13:01.372 INFO DefaultServlet.serveFile:
contentType='audio/mpeg'*


Are the audio files generated dynamically on request?

Mark




Here is the audio control code:


 
bottom:0;"




  

 

I've tried relative path and full path but result is the same in both

cases.


I've spent days trying to solve this but no luck :(

I would really appreciate any guidance to solve this issue.

Thanks!



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






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



Re: [EXTERNAL] Re: Tomcat 9 returning 404 for audio files

2024-03-11 Thread Robert Turner
It's also possible you may need to support the "Range" HTTP header for
fetching parts of the audio file for playback. IIRC, we had to do that to
support the HTML 5 audio control properly.

On Mon, Mar 11, 2024 at 9:15 AM Joey Cochran  wrote:

> Thanks for replying!!
>
> Yes audio files are generated dynamically from DB.in a Servlet.
>
> I've verified that audio file exists on file system before returning the
> html code that contains audo control.
>
> I do NOT see this as a server side issue.
> This reads like a client/DOM cache of resource issue with the HTML5 audio
> control.
> simple fix could be (on the return/callback handler) to either
> refresh/reload just that tag on the DOM or even throw a whole DOM reload
> (more than one way to accomplish these, hence keeping it a pseudo code
> response)  -Hope this helps!
> -Joey
>
> On Mon, Mar 11, 2024, 5:22 a.m. Mark Thomas  wrote:
>
> > On 11/03/2024 02:21, Sam wrote:
> > > I just upgraded a legacy application from Tomcat 7 to Tomcat 9. It's
> > > deployed as a war file. I'm facing a weird issue with audio files
> > playback.
> > >
> > > When loading a page that contains an audio file. First time Tomcat
> > returns
> > > 404 error but if reloading the page, audio file is loaded properly and
> no
> > > error from Tomcat.
> > >
> > > I'm using html 5 audio control to display the file.
> > >
> > > All other static resources(images, css and js files) are working
> without
> > > any issues. Only audio files are having this issue.
> > >
> > > I enabled the logs for DefaultServlet in Tomcat. Follwong is the log
> > entry
> > > when I try to open the audio file first time. I can see 404 being
> > returned
> > > from server in Chrome dev tools.
> > >
> > >
> > > *09-Mar-2024 20:12:50.747 INFO DefaultServlet.serveResource: Serving
> > > resource '/wav/2B916004DFE94FA40446429E1671C893_0001053.mp3' headers
> and
> > > data*
> > > Following is the log for 2nd attempt. This time audio is available and
> > > playable in browser. *09-Mar-2024 20:13:00.371 INFO
> > > DefaultServlet.serveResource: Serving resource
> > > '/wav/2B916004DFE94FA40446429E1671C893_0001053.mp3' headers and data *
> > > *09-Mar-2024 20:13:01.372 INFO DefaultServlet.serveFile:
> > > contentType='audio/mpeg'*
> >
> > Are the audio files generated dynamically on request?
> >
> > Mark
> >
> >
> > >
> > > Here is the audio control code:
> > >
> > > 
> > >  > >>
> > >
> > >   src="/wav/2B916004DFE94FA40446429E1671C893_0001053.mp3"
> > > type="audio/mpeg" >
> > >
> > > 
> > > 
> > > I've tried relative path and full path but result is the same in both
> > cases.
> > >
> > > I've spent days trying to solve this but no luck :(
> > >
> > > I would really appreciate any guidance to solve this issue.
> > >
> > > Thanks!
> > >
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> > For additional commands, e-mail: users-h...@tomcat.apache.org
> >
> >
>


Re: [EXTERNAL] Re: Tomcat 9 returning 404 for audio files

2024-03-11 Thread Joey Cochran
Thanks for replying!!

Yes audio files are generated dynamically from DB.in a Servlet.

I've verified that audio file exists on file system before returning the
html code that contains audo control.

I do NOT see this as a server side issue.
This reads like a client/DOM cache of resource issue with the HTML5 audio 
control.
simple fix could be (on the return/callback handler) to either refresh/reload 
just that tag on the DOM or even throw a whole DOM reload (more than one way to 
accomplish these, hence keeping it a pseudo code response)  -Hope this helps!
-Joey

On Mon, Mar 11, 2024, 5:22 a.m. Mark Thomas  wrote:

> On 11/03/2024 02:21, Sam wrote:
> > I just upgraded a legacy application from Tomcat 7 to Tomcat 9. It's
> > deployed as a war file. I'm facing a weird issue with audio files
> playback.
> >
> > When loading a page that contains an audio file. First time Tomcat
> returns
> > 404 error but if reloading the page, audio file is loaded properly and no
> > error from Tomcat.
> >
> > I'm using html 5 audio control to display the file.
> >
> > All other static resources(images, css and js files) are working without
> > any issues. Only audio files are having this issue.
> >
> > I enabled the logs for DefaultServlet in Tomcat. Follwong is the log
> entry
> > when I try to open the audio file first time. I can see 404 being
> returned
> > from server in Chrome dev tools.
> >
> >
> > *09-Mar-2024 20:12:50.747 INFO DefaultServlet.serveResource: Serving
> > resource '/wav/2B916004DFE94FA40446429E1671C893_0001053.mp3' headers and
> > data*
> > Following is the log for 2nd attempt. This time audio is available and
> > playable in browser. *09-Mar-2024 20:13:00.371 INFO
> > DefaultServlet.serveResource: Serving resource
> > '/wav/2B916004DFE94FA40446429E1671C893_0001053.mp3' headers and data *
> > *09-Mar-2024 20:13:01.372 INFO DefaultServlet.serveFile:
> > contentType='audio/mpeg'*
>
> Are the audio files generated dynamically on request?
>
> Mark
>
>
> >
> > Here is the audio control code:
> >
> > 
> >  >>
> >
> >   > type="audio/mpeg" >
> >
> > 
> > 
> > I've tried relative path and full path but result is the same in both
> cases.
> >
> > I've spent days trying to solve this but no luck :(
> >
> > I would really appreciate any guidance to solve this issue.
> >
> > Thanks!
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: Tomcat 9 returning 404 for audio files

2024-03-11 Thread Sam
Thanks for replying!!

Yes audio files are generated dynamically from DB.in a Servlet.

I've verified that audio file exists on file system before returning the
html code that contains audo control.


On Mon, Mar 11, 2024, 5:22 a.m. Mark Thomas  wrote:

> On 11/03/2024 02:21, Sam wrote:
> > I just upgraded a legacy application from Tomcat 7 to Tomcat 9. It's
> > deployed as a war file. I'm facing a weird issue with audio files
> playback.
> >
> > When loading a page that contains an audio file. First time Tomcat
> returns
> > 404 error but if reloading the page, audio file is loaded properly and no
> > error from Tomcat.
> >
> > I'm using html 5 audio control to display the file.
> >
> > All other static resources(images, css and js files) are working without
> > any issues. Only audio files are having this issue.
> >
> > I enabled the logs for DefaultServlet in Tomcat. Follwong is the log
> entry
> > when I try to open the audio file first time. I can see 404 being
> returned
> > from server in Chrome dev tools.
> >
> >
> > *09-Mar-2024 20:12:50.747 INFO DefaultServlet.serveResource: Serving
> > resource '/wav/2B916004DFE94FA40446429E1671C893_0001053.mp3' headers and
> > data*
> > Following is the log for 2nd attempt. This time audio is available and
> > playable in browser. *09-Mar-2024 20:13:00.371 INFO
> > DefaultServlet.serveResource: Serving resource
> > '/wav/2B916004DFE94FA40446429E1671C893_0001053.mp3' headers and data *
> > *09-Mar-2024 20:13:01.372 INFO DefaultServlet.serveFile:
> > contentType='audio/mpeg'*
>
> Are the audio files generated dynamically on request?
>
> Mark
>
>
> >
> > Here is the audio control code:
> >
> > 
> >  >>
> >
> >   > type="audio/mpeg" >
> >
> > 
> > 
> > I've tried relative path and full path but result is the same in both
> cases.
> >
> > I've spent days trying to solve this but no luck :(
> >
> > I would really appreciate any guidance to solve this issue.
> >
> > Thanks!
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: Tomcat 9 returning 404 for audio files

2024-03-11 Thread Mark Thomas

On 11/03/2024 02:21, Sam wrote:

I just upgraded a legacy application from Tomcat 7 to Tomcat 9. It's
deployed as a war file. I'm facing a weird issue with audio files playback.

When loading a page that contains an audio file. First time Tomcat returns
404 error but if reloading the page, audio file is loaded properly and no
error from Tomcat.

I'm using html 5 audio control to display the file.

All other static resources(images, css and js files) are working without
any issues. Only audio files are having this issue.

I enabled the logs for DefaultServlet in Tomcat. Follwong is the log entry
when I try to open the audio file first time. I can see 404 being returned
from server in Chrome dev tools.


*09-Mar-2024 20:12:50.747 INFO DefaultServlet.serveResource: Serving
resource '/wav/2B916004DFE94FA40446429E1671C893_0001053.mp3' headers and
data*
Following is the log for 2nd attempt. This time audio is available and
playable in browser. *09-Mar-2024 20:13:00.371 INFO
DefaultServlet.serveResource: Serving resource
'/wav/2B916004DFE94FA40446429E1671C893_0001053.mp3' headers and data *
*09-Mar-2024 20:13:01.372 INFO DefaultServlet.serveFile:
contentType='audio/mpeg'*


Are the audio files generated dynamically on request?

Mark




Here is the audio control code:





   
 
   


I've tried relative path and full path but result is the same in both cases.

I've spent days trying to solve this but no luck :(

I would really appreciate any guidance to solve this issue.

Thanks!



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



Tomcat 9 returning 404 for audio files

2024-03-10 Thread Sam
I just upgraded a legacy application from Tomcat 7 to Tomcat 9. It's
deployed as a war file. I'm facing a weird issue with audio files playback.

When loading a page that contains an audio file. First time Tomcat returns
404 error but if reloading the page, audio file is loaded properly and no
error from Tomcat.

I'm using html 5 audio control to display the file.

All other static resources(images, css and js files) are working without
any issues. Only audio files are having this issue.

I enabled the logs for DefaultServlet in Tomcat. Follwong is the log entry
when I try to open the audio file first time. I can see 404 being returned
from server in Chrome dev tools.


*09-Mar-2024 20:12:50.747 INFO DefaultServlet.serveResource: Serving
resource '/wav/2B916004DFE94FA40446429E1671C893_0001053.mp3' headers and
data*
Following is the log for 2nd attempt. This time audio is available and
playable in browser. *09-Mar-2024 20:13:00.371 INFO
DefaultServlet.serveResource: Serving resource
'/wav/2B916004DFE94FA40446429E1671C893_0001053.mp3' headers and data *
*09-Mar-2024 20:13:01.372 INFO DefaultServlet.serveFile:
contentType='audio/mpeg'*

Here is the audio control code:


   
  

  
   

I've tried relative path and full path but result is the same in both cases.

I've spent days trying to solve this but no luck :(

I would really appreciate any guidance to solve this issue.

Thanks!