You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Joey Cochran <Jo...@mtsu.edu> on 2024/03/11 13:14:06 UTC

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

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 <ma...@apache.org> 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:
> >
> > <div id="audioContainer" style="height:65px; width:100%;
> > visibility:visible; ">
> >     <div id="jobAudio" style="height:45px; width: 100%; left:0px;
> bottom:0;"
> >>
> >        <audio controls controlsList="nodownload" style="width: 100%;" >
> >          <source src="/wav/2B916004DFE94FA40446429E1671C893_0001053.mp3"
> > type="audio/mpeg" >
> >        </audio>
> >     </div>
> > </div>
> > 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-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

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

Posted by Robert Turner <rt...@e-djuster.ca.INVALID>.
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 <Jo...@mtsu.edu> 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 <ma...@apache.org> 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:
> > >
> > > <div id="audioContainer" style="height:65px; width:100%;
> > > visibility:visible; ">
> > >     <div id="jobAudio" style="height:45px; width: 100%; left:0px;
> > bottom:0;"
> > >>
> > >        <audio controls controlsList="nodownload" style="width: 100%;" >
> > >          <source
> src="/wav/2B916004DFE94FA40446429E1671C893_0001053.mp3"
> > > type="audio/mpeg" >
> > >        </audio>
> > >     </div>
> > > </div>
> > > 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-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
>