-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I'm trying using JavaRebel with ZK and context is reloaded always.
But JSP + Servlet works fine.
Have already tested that?
Thanks
Ricardo M Augusto
i use javaRebel too,but when i add an property to viewModel(i use zk 6.0.0 ee eval), reload zul will get following exception:
org.zkoss.zel.PropertyNotFoundException: Property 'aProperty' not found on type org.lym.test.test1.VM3
org.zkoss.zel.BeanELResolver$BeanProperties.get(BeanELResolver.java:258)
org.zkoss.zel.BeanELResolver$BeanProperties.access$400(BeanELResolver.java:209)
org.zkoss.zel.BeanELResolver.property(BeanELResolver.java:368)
org.zkoss.zel.BeanELResolver.getValue(BeanELResolver.java:85)
org.zkoss.zel.CompositeELResolver.getValue(CompositeELResolver.java:67)
org.zkoss.zel.CompositeELResolver.getValue(CompositeELResolver.java:67)
org.zkoss.xel.zel.XelELResolver.getValue(XelELResolver.java:71)
org.zkoss.bind.xel.zel.BindELResolver.getValue(BindELResolver.java:64)
org.zkoss.zel.impl.parser.AstValue.getValue(AstValue.java:179)
org.zkoss.zel.impl.ValueExpressionImpl.getValue(ValueExpressionImpl.java:189)
org.zkoss.xel.zel.ELXelExpression.evaluate(ELXelExpression.java:40)
org.zkoss.bind.impl.BindEvaluatorXImpl.getValue(BindEvaluatorXImpl.java:44)
org.zkoss.bind.impl.LoadPropertyBindingImpl.load(LoadPropertyBindingImpl.java:55)
org.zkoss.bind.impl.PropertyBindingHandler.doLoadBinding(PropertyBindingHandler.java:172)
org.zkoss.bind.impl.PropertyBindingHandler.doLoad(PropertyBindingHandler.java:373)
org.zkoss.bind.impl.BinderImpl.loadComponentProperties(BinderImpl.java:1758)
org.zkoss.bind.impl.BinderImpl.loadComponent(BinderImpl.java:1740)
org.zkoss.bind.impl.BinderImpl.loadComponent(BinderImpl.java:1742)
org.zkoss.bind.BindComposer.doAfterCompose(BindComposer.java:128)
org.zkoss.zk.ui.impl.UiEngineImpl.doAfterCompose(UiEngineImpl.java:526)
org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild0(UiEngineImpl.java:821)
org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:767)
org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:676)
org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:738)
org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:698)
org.zkoss.zk.ui.impl.UiEngineImpl.execCreate(UiEngineImpl.java:640)
org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage0(UiEngineImpl.java:391)
org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage(UiEngineImpl.java:313)
org.zkoss.zk.ui.http.DHtmlLayoutServlet.process(DHtmlLayoutServlet.java:214)
org.zkoss.zk.ui.http.DHtmlLayoutServlet.doGet(DHtmlLayoutServlet.java:134)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
any idea to resolve it?Thanks
i found it is because the zk cache the property of Bean at the beginning ,so Reloading of javaRebel have not effect,is there any configure argument to cancel this cache?
below is the zk's code:
private final BeanProperty property(ELContext ctx, Object base,
Object property) {
Class<?> type = base.getClass();
String prop = property.toString();
BeanProperties props = this.cache.get(type.getName());
if (props == null || type != props.getType()) {
props = new BeanProperties(type);
this.cache.put(type.getName(), props);
}
return props.get(ctx, prop);
}
i found the url:http://tracker.zkoss.org/browse/ZK-1021 talk about similar problem.
now i know it is not possible to get some easy configure arment at now ,
the question is :what is the best practice in this situation?
look into the source code of BeanELResolver, it is possible to set the cache size to 0 in your development environment. by setting system property 'org.zkoss.zel.BeanELResolver.CACHE_SIZE' to '0'
thanks dennis for reply,i try setting system property 'org.zkoss.zel.BeanELResolver.CACHE_SIZE' to '0' ,as is blow in zk.xml:
<system-property>
<name>org.zkoss.zel.BeanELResolver.CACHE_SIZE</name>
<value>0</value>
</system-property>
,the result is the same,i look into the source code of BeanELResolver,find the following code:
public ConcurrentCache(int size) {
this.size = size;
this.eden = new ConcurrentHashMap<K,V>(size);
this.longterm = new WeakHashMap<K,V>(size);
}
,it seem no use to set size to 0 for disabling the cache,when i set 'org.zkoss.zel.BeanELResolver.CACHE_SIZE' to -1, the cosole show following exception when i visit the zul page:
java.lang.IllegalArgumentException
at java.util.concurrent.ConcurrentHashMap.<init>(Unknown Source)
at java.util.concurrent.ConcurrentHashMap.<init>(Unknown Source)
at org.zkoss.zel.BeanELResolver$ConcurrentCache.<init>(BeanELResolver.java:411)
at org.zkoss.zel.BeanELResolver.<init>(BeanELResolver.java:63)
at org.zkoss.xel.zel.XelELResolver.<clinit>(XelELResolver.java:49)
at org.zkoss.bind.xel.zel.BindELContext.newELResolver(BindELContext.java:58)
at org.zkoss.xel.zel.XelELContext.<init>(XelELContext.java:47)
at org.zkoss.bind.xel.zel.BindELContext.<init>(BindELContext.java:54)
at org.zkoss.bind.xel.BindXelFactory.newELContext(BindXelFactory.java:36)
at org.zkoss.bind.xel.BindXelFactory.parseExpression(BindXelFactory.java:30)
at org.zkoss.bind.impl.BindEvaluatorXImpl.parseExpressionX(BindEvaluatorXImpl.java:69)
at org.zkoss.bind.impl.BindEvaluatorXUtil.eval(BindEvaluatorXUtil.java:54)
at org.zkoss.bind.BindComposer.initViewModel(BindComposer.java:146)
at org.zkoss.bind.BindComposer.doAfterCompose(BindComposer.java:116)
at org.zkoss.zk.ui.impl.UiEngineImpl.doAfterCompose(UiEngineImpl.java:526)
at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild0(UiEngineImpl.java:821)
at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:767)
at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:676)
at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:738)
at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:698)
at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate(UiEngineImpl.java:640)
at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage0(UiEngineImpl.java:391)
<bold>any other solution to disable the cache?</bold>
I got the same error.
I´m using a ViewModel bean and in a specific method I set the variables to null and notify the view, but seems the view uses an cache and gives the error below:
I tried to disable the cache but the same error occurs.
29/05/2012 22:45:53 org.zkoss.zk.ui.impl.UiEngineImpl handleError:1348
GRAVE: >>org.zkoss.zel.PropertyNotFoundException: Property '0' not found on type org.zkoss.zul.ListModelSet
>> at org.zkoss.zel.BeanELResolver$BeanProperties.get(BeanELResolver.java:258)
>> at org.zkoss.zel.BeanELResolver$BeanProperties.access$400(BeanELResolver.java:209)
>> at org.zkoss.zel.BeanELResolver.property(BeanELResolver.java:368)
>> at org.zkoss.zel.BeanELResolver.getValue(BeanELResolver.java:85)
>> at org.zkoss.zel.CompositeELResolver.getValue(CompositeELResolver.java:67)
>> at org.zkoss.zel.CompositeELResolver.getValue(CompositeELResolver.java:67)
>> at org.zkoss.xel.zel.XelELResolver.getValue(XelELResolver.java:71)
>> at org.zkoss.bind.xel.zel.BindELResolver.getValue(BindELResolver.java:64)
>> at org.zkoss.zel.impl.parser.AstValue.getValue(AstValue.java:179)
>> at org.zkoss.zel.impl.ValueExpressionImpl.getValue(ValueExpressionImpl.java:189)
>> at org.zkoss.xel.zel.ELXelExpression.evaluate(ELXelExpression.java:40)
>> at org.zkoss.bind.impl.BindEvaluatorXImpl.getValue(BindEvaluatorXImpl.java:44)
>> at org.zkoss.bind.impl.ReferenceBindingImpl.load(ReferenceBindingImpl.java:53)
>> at org.zkoss.bind.impl.BinderImpl.loadOnPropertyChange(BinderImpl.java:342)
>> at org.zkoss.bind.impl.BinderImpl.access$100(BinderImpl.java:92)
>> at org.zkoss.bind.impl.BinderImpl$QueueListener.onEvent(BinderImpl.java:228)
>> at org.zkoss.zk.ui.event.impl.DesktopEventQueue$QueueListener.onEvent(DesktopEventQueue.java:145)
>> at org.zkoss.zk.ui.AbstractComponent.onEvent(AbstractComponent.java:2741)
>> at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2712)
>> at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2653)
>> at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:136)
>> at org.zkoss.zk.ui.impl.EventProcessingThreadImpl.process0(EventProcessingThreadImpl.java:534)
>> at org.zkoss.zk.ui.impl.EventProcessingThreadImpl.run(EventProcessingThreadImpl.java:461)
I try to set -1 to org.zkoss.zel.BeanELResolver.CACHE_SIZE but got java.lang.ExceptionInInitializerError.
yaminglin, could you post a feature on the tracker about disabling class method cache.
jhcruvinel, I think it is another issue, could you provide a example to reproduce this. thanks.
ok, as showed in
http://tracker.zkoss.org/browse/ZK-1212
Asked: 2008-07-28 20:03:56 +0800
Seen: 668 times
Last updated: Jul 02 '12