java - IllegalAccessException doing Thymeleaf/OGNL method access -
i'm new web dev , i'm trying thymeleaf template engine on app engine. has worked fine far, except java illegalaccessexception's when attempt method (as opposed simple attribute) access.
for example, line of html:
<div class="panel" th:id="${item.getwebid()}"> i get:
java.lang.illegalaccessexception: method [public java.lang.string myapp.iteminfo.getwebid()] cannot accessed. @ ognl.ognlruntime.invokemethod(ognlruntime.java:851) this happens both on dev server (win vista) , in production gae sdk's 1.9.0 , 1.8.9. i've tried current tl (2.1.2) , previous version (2.0.20). i'm not using spring.
i've found others having reflection problems (here , here) on tl forum, nothing helps.
some people using struts or spring encountered similar problems long time ago, , resolved them setting ognlruntime.setsecuritymanager(null). haven't pursued because can't see how access ognlruntime object in tl, , doesn't make sense me tl user need this.
looking @ ognlruntime v3.0.6 (here) looks easiest solution disable 'checkpermission', again, new tl, i'm hesitant make change tl doesn't expose, , no 1 else using tl seems need do. there must else wrong?
in end proceeded ognlruntime.setsecuritymanager(null) option. seems bad idea allows me proceed now.
here's code used:
public class mycontextlistener implements servletcontextlistener { @override public void contextdestroyed(servletcontextevent arg0) { } @override public void contextinitialized(servletcontextevent arg0) { ognlruntime.setsecuritymanager(null); } } and in web.xml added:
<listener> <listener-class>com.myapp.mycontextlistener</listener-class> </listener>
Comments
Post a Comment