You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Greg Ward <gw...@python.net> on 2006/01/03 20:22:49 UTC
OGNL/Tapestry 3: constant values become null after restart
I'm having a weird problem accessing Java constants with Tapestry 3.0.3
and OGNL 2.6.7. Specifically, this bit of template code:
<span jwcid="@Conditional"
condition="ognl:havePrivilege(@DataModels.UserModels.PrivilegeSet@AUDIT_USERS)">
works fine after restarting the whole servlet container (Tomcat 4.1.30),
but when I restart just my app, the OGNL expression
"@DataModels.UserModels.PrivilegeSet@AUDIT_USERS" (yes, our package name
is "DataModels.UserModels" -- legacy code and all that) evaluates to
null. I have to restart Tomcat completely in order for this expression
to evaluate correctly. Annoying.
PrivilegeSet is a fairly complex beast, but at its heart it's just a
typesafe enum with a bunch of constant values; here's the relevant
snippet from DataModels/UserModels/PrivilegeSet.java:
"""
package DataModels.UserModels;
[...]
public class PrivilegeSet
{
[...]
public static final Privilege AUDIT_USERS =
Categories.ADMIN.add( "audit_users" );
[...]
}
"""
I just made a quick attempt to reproduce this problem in a trivial
"hello world" tapestry app -- no luck, it works fine.
Before I spend huge amounts of time attempting to reproduce and/or debug
this, I'm wondering if anyone has seen anything similar and knows of a
fix or workaround.
Thanks --
Greg
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: OGNL/Tapestry 3: constant values become null after restart
Posted by Kent Tong <ke...@cpttm.org.mo>.
Greg Ward <gward-tapestry <at> python.net> writes:
> works fine after restarting the whole servlet container (Tomcat 4.1.30),
> but when I restart just my app, the OGNL expression
> " <at> DataModels.UserModels.PrivilegeSet <at> AUDIT_USERS" (yes, our
> package name
> is "DataModels.UserModels" -- legacy code and all that) evaluates to
> null. I have to restart Tomcat completely in order for this expression
> to evaluate correctly. Annoying.
I'm not sure if this will help, but you may try using a
context listener that calls:
Introspector.flushCache();
on shutdown. See if it helps.
--
Author of a book for learning Tapestry (www.agileskills2.org/EWDT)
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org