We're using Jasper (for a number of reasons) inside Weblogic, and have seen
similar problems, but only intermittently -- usually either at startup or
during heavy load testing. I put a JspFactory.setDefaultFactory(....) call
in our code to try to force Jasper (rather than allow Weblogc to sneak in
), but I don't like the solution. Do you have any more details on why this
occurs? We haven't had time to find a better solution.
[EMAIL PROTECTED] on 19/12/2000 16:40:43
Please respond to [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
cc: (bcc: Ken X Horn)
Subject: Re: Jasper Compiler -- when things go really wrong
This seems right. I'll put the fix in tomorrow unless someone objects.
[no need to send a patch].
-- Pierre
"Bucknam, Brian" wrote:
>
> It's a long story, but I'm working on a project where Jasper 3.x is
embedded
> inside a servlet, which can then be deployed to the container of our
> customer's choice. The servlet uses JSP files as templates, which is
where
> Jasper comes in.
>
> In this type of environment, sometimes thing can go really wrong, and the
> compiled JSP might, in some cases, fail to get a JspFactory, PageContext,
or
> JspWriter.
>
> Here is a much-snipped version of what JspParseEventListener (in 3.2 and
> 4.0) generates for the _jspService() method:
> ------------------------------------------------
> JspFactory _jspxFactory = null;
> PageContext pageContext = null;
> HttpSession session = null;
> JspWriter out = null;
> try {
> _jspxFactory = JspFactory.getDefaultFactory();
> pageContext = _jspxFactory.getPageContext(this, request, response,
> "", true, 4096, true);
>
> out = pageContext.getOut();
>
> // HTML stuff here
> out.write("...my happy JSP page...");
> // end
> } catch (Exception ex) {
> if (out.getBufferSize() != 0)
> out.clearBuffer();
> pageContext.handlePageException(ex);
> } finally {
> out.flush();
> _jspxFactory.releasePageContext(pageContext);
> }
> ------------------------------------------------
>
> If any of _jspxFactory, pageContext, or out fail to be created, the catch
{}
> and finally{} clauses just throw NPE's.
>
> I would propose that the catch{} and finally{} should generated as
following
> instead:
> ------------------------------------------------
> } catch (Exception ex) {
> if (out != null && out.getBufferSize() != 0)
> out.clearBuffer();
> if (pageContext != null) pageContext.handlePageException(ex);
> } finally {
> if (out != null) out.flush();
> if (_jspxFactory != null)
> _jspxFactory.releasePageContext(pageContext);
> }
> ------------------------------------------------
>
> These seem to me like non-functionality-impacting changes.
>
> If this seems right, I will generate patch files if requested.
>
> Thanks,
> Brian
>
> Brian Bucknam
> WebGain, Inc.
> [EMAIL PROTECTED]