struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dale Newfield <>
Subject ognl method lookup failure
Date Sat, 12 Dec 2009 21:44:49 GMT
Often when I'm stumped writing a detailed "help!" message leads me to 
the bug and I never have to send it.  This time I was not so lucky, and 
since I've already wasted two days on this I was hoping someone here 
might have an idea to get me out of the weeds.

I've got an abstract class "Comment" and a bunch of concrete subclasses 
thereof.  I've got a "displayComment.tag" file that calls itself 
recursively to display a tree of comments.  Among other things this 
checks the extant subscriptions on the comment in question and displays 
various subscribe/unsubscribe buttons as appropriate.

Mostly this works.  There are a couple concrete subclasses of Comment 
that break in a bizarre way, and I've been stuck on this for two days, 
so I'm hoping someone here might have a suggestion.

I go through the normal annoying dance to push ognl accessible objects 
into jstl-el accessible locations, passing those as attributes into the 
.tag file and then set them inside the tag into a namespace accessible 
from ognl:  (yes, I tried with #attr, too--same behavior)

inside the .tag:
<%@ attribute name="currentUser" required="true" 
type="mumble.model.User" rtexprvalue="true"%>
<%@ attribute name="commentToDisplay" required="true" 
type="mumble.model.Comment" rtexprvalue="true"%>

<c:set var="currentUserInTag" scope="request" value="${currentUser}"/>
<c:set var="commentInTag" scope="request" value="${commentToDisplay}"/>

Simple tests:  <s:property value="%{#request.currentUserInTag.class}"/> 
and <s:property value="%{#request.commentInTag.class}"/> show the 
appropriate (concrete) classes.

Whereas in most instances this OGNL logic works:

for these two specific concrete classes (due I believe to 
struts.ognl.logMissingProperties=true) it results in a log entry:
Could not find method 

I am able to interrogate the object and find the expected methods:
<s:property value="%{#request.commentInTag.class.methods.{?'isUserSubscribedViaEmail'}[0]}"/> results in "public 

but I'm also unable to get further with that: <s:property 

results in the log entry:  Could not find method 

Maybe related: if I try to access the Class method "Method 
getMethod(String name, Class... parameterTypes)" directly to get the 
right one (instead of getting all of them and looking for one with the 
right name) I end up with this log message:

Caught an exception while evaluating expression 

against value stack
java.lang.IllegalArgumentException: java.lang.ClassCastException@ab1dea
         at sun.reflect.GeneratedMethodAccessor1387.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(
         at ognl.OgnlRuntime.invokeMethod(

Again, this works with some concrete subclasses of Comment, but not 
others.  There are no substantial differences between them as far as I 
can tell.  Any ideas/leads/suggestions/suppositions welcome.

I'm using struts, ognl 2.7.3, yes I have javassist-3.8.1.jar in 
WEB-INF/lib.  Running under glassfish if that matters.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message