users@glassfish.java.net

Re: Using JFreeChart&cewolf in a Cluster-Environment

From: Jan Luehe <Jan.Luehe_at_Sun.COM>
Date: Tue, 26 Jan 2010 17:15:55 -0800

On 01/25/10 09:28 AM, glassfish_at_javadesktop.org wrote:
> Hi there,
>
> I'm having trouble to get my JFreechart images to render.
>
> Here's the problem:
> I'm using a GF v2.1 cluster with two nodeagents. Nearly every time I call the page with my chart, I get the error "This chart has expired.Please reload."
> When I shutdown one nodeagent, everything is fine. It's also working in my local environment with only one instance.
>
> I found out that this is some kind of session-issue. When the image is about to be displayed, I "accidenty" receive another jsessionid and the image can not be found anymore.
>
>
> I found this explanation:
>
> (1) it will produce PNG graphics object, which will be temporarily cached into a application-scoped collection with 'jsessionid'. The PNG object will NOT be immediatedly responded back to the browser.
>
> (2)it will produce a text/html stream, which will be immediately responded to the requesting browser. For example it will look somthing like:
> ---- <HTML> <BODY> [....] {IMG BORDER="0" HEIGHT="300" WIDTH="300" ALT="" src ="cewolf;jsessionid=04D17456FD5B435B8D47E2384D0EDDEA?img =-956198779&amp;width=300&amp;height=300&amp;iehack=.png"} </td> </BODY> </HTML>
> ----
>

When using "replicated" persistence-mode in GlassFish, HTTP sessions
will have a
version number attached to them, in order to make it possible for a
cluster instance
servicing a request that attempts to resume an HTTP session to determine
whether the
HTTP session in its cache is up-to-date or has become stale.

I noticed that this versioning info is missing from the jsessionid in your
"img src=...". I would have expected a "jsessionidversion" parameter to be
included there.

If the client does not include any session version with its request (as
in your case),
the session manager on the cluster instance that is servicing the
request will never find
the requested session, and a new session will be created instead, which
is what you
have experienced.

How do you create the request URI for the Cewolf servlet in the "img
src=..."?

Thanks,

Jan


> The HTML contains a {img src="..."} tag. The URL of the img tag points to the Cewolf Servlet. As soon as the browser receives the HTML and find the img tag, the browser fires the second HTTP GET request to Cewolf Servlet. The second HTTP GET will go to Cewolf Servlet. The Cewolf Servlet will check the cache to find out a PNG graphics object to respond. The magic is that the src attribute of img tag will contain the Identification information which JSP has assigned and passed in order to let the Cewolf Servlet identify witch of the cached PNG object instance to be sent back.
>
> In my sun-web.xml, I use persistence-type="replicated".
>
> I also tried every storage type of these: http://cewolf.sourceforge.net/new/apidoc/de/laures/cewolf/storage/package-tree.html
>
> Does anyone have an idea? I'm out of energy for thinking :)
>
> Greetings
> Veronika
> [Message sent by forum member 'tesis_glassfish' (vbrem_at_tesis.de)]
>
> http://forums.java.net/jive/thread.jspa?messageID=382817
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>