Got the mistake i did apparently the line of code
// create a media viewer with stats enabled
IMediaViewer mediaViewer = ToolFactory.makeViewer(true);
// add a viewer to the reader, to see the decoded media
mediaReader.addListener(mediaViewer);
was the one creating a viewer for all the video request i make.This code for some reasons doesn't work for web apps. removed this and it worked.