0

Why does not form binding work in zkVersion = '8.0.4.2'?

asked 2017-04-18 15:56:38 +0800

sergeymd gravatar image sergeymd
1 1

updated 2017-04-18 16:16:29 +0800

Hello,

form="@id('fx') @load(vm.user) @save(vm.user, before='saveEntity')"

Why does not form binding work in zkVersion = '8.0.4.2'?

I get files from sample: zkfiddle.org/sample/lva4jr/7-form-binding-zk-8

And put it to my app at websphere 8.5.5.11

I get error: java.lang.ClassCastException: ru.masterdm.creditcommittee.board.Person$$javassist_95 incompatible with javassist.util.proxy.Proxy

Stack trace:

[18/04/17 18:29:19:561 MSK] 000000ce webapp        E com.ibm.ws.webcontainer.webapp.WebApp logServletError SRVE0293E: [Servlet Error]-[zkLoader]: java.lang.ClassCastException: ru.masterdm.creditcommittee.board.Person_$$_javassist_95 incompatible with javassist.util.proxy.Proxy
    at org.zkoss.bind.proxy.ProxyHelper.createFormProxy(ProxyHelper.java:247)
    at org.zkoss.bind.impl.FormBindingImpl.initFormBean(FormBindingImpl.java:81)
    at org.zkoss.bind.impl.SaveFormBindingImpl.getFormBean(SaveFormBindingImpl.java:112)
    at org.zkoss.bind.impl.SaveFormBindingImpl.<init>(SaveFormBindingImpl.java:65)
    at org.zkoss.bind.impl.BinderImpl.newSaveFormBinding(BinderImpl.java:1092)
    at org.zkoss.bind.impl.BinderImpl.addFormSaveBindings0(BinderImpl.java:799)
    at org.zkoss.bind.impl.BinderImpl.addFormSaveBindings(BinderImpl.java:731)
    at org.zkoss.bind.impl.AnnotateBinderHelper.processFormSaveBindings(AnnotateBinderHelper.java:632)
    at org.zkoss.bind.impl.AnnotateBinderHelper.processFormBindings(AnnotateBinderHelper.java:537)
    at org.zkoss.bind.impl.AnnotateBinderHelper.processComponentBindings0(AnnotateBinderHelper.java:122)
    at org.zkoss.bind.impl.AnnotateBinderHelper.processAllComponentsBindings(AnnotateBinderHelper.java:87)
    at org.zkoss.bind.impl.AnnotateBinderHelper.processAllComponentsBindings(AnnotateBinderHelper.java:93)
    at org.zkoss.bind.impl.AnnotateBinderHelper.initComponentBindings(AnnotateBinderHelper.java:73)
    at org.zkoss.bind.AnnotateBinder.initAnnotatedBindings(AnnotateBinder.java:74)
    at org.zkoss.zkmax.bind.impl.AnnotateBinderEx.initAnnotatedBindings(AnnotateBinderEx.java:39)
    at org.zkoss.bind.BindComposer.doAfterCompose(BindComposer.java:175)
    at org.zkoss.zk.ui.impl.UiEngineImpl.doAfterCompose(UiEngineImpl.java:617)
    at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild0(UiEngineImpl.java:948)
    at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:895)
    at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:777)
    at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:841)
    at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:797)
    at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate(UiEngineImpl.java:740)
    at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage0(UiEngineImpl.java:460)
    at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage(UiEngineImpl.java:369)
    at org.zkoss.zk.ui.http.DHtmlLayoutServlet.process(DHtmlLayoutServlet.java:211)
    at org.zkoss.zk.ui.http.DHtmlLayoutServlet.doGet(DHtmlLayoutServlet.java:137)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:575)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1233)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:782)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:481)
    at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:136)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:97)
    at ru.masterdm.creditcommittee.board.servlet.EntityManagerFilter.doFilter(EntityManagerFilter.java:69)
    at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)
    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:967)
    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1107)
    at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.__handleRequest(CacheServletWrapper.java:87)
    at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.__xr__handleRequest(CacheServletWrapper.java)
    at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java)
    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:949)
    at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1817)
    at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:200)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:463)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:530)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:316)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:287)
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
    at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
    at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
    at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
    at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
    at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
    at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
    at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1892)

web.xml:

<listener>
    <description>ZK listener for session cleanup</description>
    <listener-class>org.zkoss.zk.ui.http.HttpSessionListener</listener-class>
</listener>
<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
    <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>

<servlet>
    <description>ZK loader for ZUML pages</description>
    <servlet-name>zkLoader</servlet-name>
    <servlet-class>org.zkoss.zk.ui.http.DHtmlLayoutServlet</servlet-class>
    <init-param>
        <param-name>update-uri</param-name>
        <param-value>/zkau</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>zkLoader</servlet-name>
    <url-pattern>*.zul</url-pattern>
</servlet-mapping>
<servlet-mapping>
    <servlet-name>zkLoader</servlet-name>
    <url-pattern>*.zhtml</url-pattern>
</servlet-mapping>

<servlet>
    <description>The asynchronous update engine for ZK</description>
    <servlet-name>auEngine</servlet-name>
    <servlet-class>org.zkoss.zk.au.http.DHtmlUpdateServlet</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>auEngine</servlet-name>
    <url-pattern>/zkau/*</url-pattern>
</servlet-mapping>

<filter>
    <filter-name>springSecurityFilterChain</filter-name>
    <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
    <filter-name>springSecurityFilterChain</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>ERROR</dispatcher>
</filter-mapping>

<filter>
    <filter-name>charsetFilter</filter-name>
    <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
    <init-param>
        <param-name>encoding</param-name>
        <param-value>UTF-8</param-value>
    </init-param>
</filter>
<filter-mapping>
    <filter-name>charsetFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

<security-role>
    <role-name>ROLE_CRS</role-name>
</security-role>
<security-constraint>
    <display-name>crsSecurityConstraint</display-name>
    <web-resource-collection>
        <web-resource-name>crsResources</web-resource-name>
        <url-pattern>/*</url-pattern>
        <http-method>GET</http-method>
        <http-method>POST</http-method>
        <http-method>OPTIONS</http-method>
        <http-method>HEAD</http-method>
        <http-method>PUT</http-method>
        <http-method>DELETE</http-method>
        <http-method>TRACE</http-method>
        <http-method>CONNECT</http-method>
    </web-resource-collection>
    <auth-constraint>
        <role-name>ROLE_CRS</role-name>
    </auth-constraint>
</security-constraint>

<login-config>
    <auth-method>CLIENT-CERT</auth-method>
</login-config>

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>META-INF/spring/crs-web-config.xml</param-value>
</context-param>

zk.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xml>
<zk>
    <system-config>
        <label-location>/layout.properties</label-location>
        <label-location>/pages/common.properties</label-location>
        <label-location>/pages/welcome.properties</label-location>
        <disable-zscript>true</disable-zscript>
    </system-config>
</zk>
delete flag offensive retag edit

3 Answers

Sort by ยป oldest newest most voted
0

answered 2017-04-19 11:32:26 +0800

chillworld gravatar image chillworld flag of Belgium
5357 4 9
https://github.com/chillw...

zk can't proxy a already proxy class, for ZK 8 the form is changed big, so please look : http://books.zkoss.org/zk-mvvm-book/8.0/databinding/formbinding.html and http://books.zkoss.org/zk-mvvm-book/8.0/syntax/immutable.html

link publish delete flag offensive edit
0

answered 2017-08-25 04:52:51 +0800

hawk gravatar image hawk
3225 1 5
http://hawkphoenix.blogsp... ZK Team

updated 2017-08-25 07:17:47 +0800

If you are using a persistence framework like hibernate, it will create a proxy for one-to-many or many-to-one properties of an Entity object. So form binding has problems on creating a proxy on the entity. You can check http://tracker.zkoss.org/browse/ZK-3149 But it's fixed in 8.0.2, so either you encounter another issue or zk version you use might not be 8.0.4.2

If nothing above helps you find the root cause, I need a reproducible example. Since the zkfiddle example works correctly on the zkfiddle, I can't reproduce the issue.

link publish delete flag offensive edit
0

answered 2017-08-25 03:58:45 +0800

hawk gravatar image hawk
3225 1 5
http://hawkphoenix.blogsp... ZK Team

The line 247 in ProxyHelper.java in 8.0.4.2 is:

List<String> classes = Library.getProperties("org.zkoss.bind.proxy.IgnoredProxyClasses");

it's not inside createFormProxy(). So it doesn't match your stack trace. Could you double check zk version?

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
2 followers

RSS

Stats

Asked: 2017-04-18 15:56:38 +0800

Seen: 49 times

Last updated: Aug 25 '17

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More