Re: ClassCastException trying to show WOStats
Re: ClassCastException trying to show WOStats
- Subject: Re: ClassCastException trying to show WOStats
- From: Chuck Hill <email@hidden>
- Date: Wed, 10 Dec 2008 11:19:14 -0800
There were some (IMO) unfortunate and inconsistent API changes in 5.4.x:
sessionsStats.setObjectForKey(getAverageSessionMemory(), "Avg. Memory
Per Session");
public HashMap getAverageSessionMemory()
....
return avg.hashMap();
So the exception is correct, "Avg. Memory Per Session" _is_ a
HashMap. It looks like WOStatsPage needs to be changed to cast these
all to Map and use the Java Collections API to extract the values as
WOApplication.application().statistics() returns a dictionary of
different object types.
Chuck
On Dec 10, 2008, at 12:33 AM, Paul Hoadley wrote:
Hello,
I'm using WO 5.4.3, and some Wonder frameworks, though this
particular app does not extend ERXApplication. The following
happens in development (OS X) and deployment (CentOS, JavaMonitor).
I've got -WOStatisticsPassword set. When I hit wa/WOStats, I get
this:
Application.handleException: Handling an Exception:
java.lang.ClassCastException: java.util.HashMap
at
com.webobjects.woextensions.WOStatsPage._initIvars(WOStatsPage.java:
81)
at
com
.webobjects
.woextensions.WOStatsPage.appendToResponse(WOStatsPage.java:94)
at
com
.webobjects
.appserver.WOComponent._appendPageToResponse(WOComponent.java:1574)
at
com
.webobjects
.appserver.WOComponent._generateResponseInContext(WOComponent.java:
1543)
at
com
.webobjects.appserver.WOComponent.generateResponse(WOComponent.java:
1538)
at
com
.webobjects
.appserver
._private
.WOActionRequestHandler._handleRequest(WOActionRequestHandler.java:
278)
at
com
.webobjects
.appserver
._private
.WOActionRequestHandler.handleRequest(WOActionRequestHandler.java:158)
at
com
.webobjects
.appserver.WOApplication.dispatchRequest(WOApplication.java:1687)
at
com
.webobjects
.appserver._private.WOWorkerThread.runOnce(WOWorkerThread.java:144)
at
com
.webobjects
.appserver._private.WOWorkerThread.run(WOWorkerThread.java:226)
at java.lang.Thread.run(Thread.java:613)
The offending lines up to and including 81 in
WOStatsPage._initIvars() are:
statsDict = WOApplication.application().statistics();
pagesDict = (NSDictionary)statsDict.objectForKey("Pages");
directActionsDict =
(NSDictionary)statsDict.objectForKey("DirectActions");
detailsDict = (NSDictionary)statsDict.objectForKey("Details");
transactions =
(NSDictionary)statsDict.objectForKey("Transactions");
memoryDict = (NSDictionary)statsDict.objectForKey("Memory");
sessionsDict =
((NSDictionary)statsDict.objectForKey("Sessions")).mutableClone();
sessionMemoryDict =
(NSDictionary)sessionsDict.removeObjectForKey("Avg. Memory Per
Session");
So it's just trying to pull stuff out of
WOApplication.statistics(). Why are we getting the class mismatch
here, and, more importantly, does anyone know how to fix/work around
it?
Google shows a few references to this problem, but, as far as I
could find, no solution.
--
Paul.
w http://logicsquad.net/
h http://paul.hoadley.name/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden