0

zk databinding + spring web flow causes problem

asked 2009-01-30 14:54:19 +0800

lendle gravatar image lendle
213 3

Hello, I've tried to use zk data binding with zk + spring web flow integration,
but I got some strange exception.

the zul file is like the following

<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit"?>
<?variable-resolver class="org.zkoss.spring.DelegatingVariableResolver"?>

<zk:zk     xmlns="http://www.zkoss.org/2005/zk/native"
    xmlns:zul="http://www.zkoss.org/2005/zul"
    xmlns:zk="http://www.zkoss.org/2005/zk">
    <zul:window title="My First window" border="normal">
        <zul:grid model="@{flowBean1.banks}">
            <zul:columns>
                <zul:column label="ID"/>
                <zul:column label="Name"/>
            </zul:columns>
            <zul:rows>
                <zul:row self="@{each='bank'}">
                    <zul:textbox value="@{bank.bankPK.noBank}"/>
                    <zul:textbox value="@{bank.nameBank}"/>
                </zul:row>
            </zul:rows>
        </zul:grid>
        <zul:button self="@{action(finish)}" label="Finish"/><br/>
        <zul:button self="@{action(restart)}" label="Restart"/>
    </zul:window>
</zk:zk>

If I click Restart or Finish button, I always get the following exception

>>java.lang.IncompatibleClassChangeError: Found interface org.springframework.binding.mapping.MappingResult, but class was expected
>>        at org.zkoss.spring.webflow.execution.ZkFlowView$PropertyNotFoundError.test(ZkFlowView.java:262)
>>        at org.springframework.binding.mapping.impl.DefaultMappingResults.getResults(DefaultMappingResults.java:91)
>>        at org.zkoss.spring.webflow.execution.ZkFlowView.onlyPropertyNotFoundErrorsPresent(ZkFlowView.java:191)
>>        at org.zkoss.spring.webflow.execution.ZkFlowView.hasMappingErrors(ZkFlowView.java:187)
>>        at org.zkoss.spring.webflow.execution.ZkFlowView.processUserEvent(ZkFlowView.java:96)
>>        at org.springframework.webflow.engine.ViewState.resume(ViewState.java:187)
>>...

However, if I remove the "grid" part, i.e., the zul file becomes:

<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit"?>
<?variable-resolver class="org.zkoss.spring.DelegatingVariableResolver"?>

<zk:zk     xmlns="http://www.zkoss.org/2005/zk/native"
    xmlns:zul="http://www.zkoss.org/2005/zul"
    xmlns:zk="http://www.zkoss.org/2005/zk">
    <zul:window title="My First window" border="normal">
        <!--zul:grid model="@{flowBean1.banks}">
            <zul:columns>
                <zul:column label="ID"/>
                <zul:column label="Name"/>
            </zul:columns>
            <zul:rows>
                <zul:row self="@{each='bank'}">
                    <zul:textbox value="@{bank.bankPK.noBank}"/>
                    <zul:textbox value="@{bank.nameBank}"/>
                </zul:row>
            </zul:rows>
        </zul:grid-->
        <zul:button self="@{action(finish)}" label="Finish"/><br/>
        <zul:button self="@{action(restart)}" label="Restart"/>
    </zul:window>
</zk:zk>


Then the exception will not happen.

So, is there conflict between zk's tranditional data binding with zk + spring web flow integration?

Thanks!

delete flag offensive retag edit

8 Replies

Sort by ยป oldest newest

answered 2009-01-31 13:40:06 +0800

lendle gravatar image lendle
213 3

After some further test,
it appears that the problem is caused by data binding to Collections with
"self" attribute

If remove the self attribute from <zul:row self="@{each='bank'}">,
the problem would disappear.

However, the self attribute is essential for collection binding,
I don't know if there exists any alternative for that?

link publish delete flag offensive edit

answered 2009-02-02 07:54:37 +0800

hideokidd gravatar image hideokidd
750 1 2

Hi,

It's not easy to figure out solution, but I search on google by keyword "but class was expected", there are some weird solutions.

1.Upgrade something -> here

2.Clean tomcat work directory -> here

link publish delete flag offensive edit

answered 2009-02-02 14:39:16 +0800

lendle gravatar image lendle
213 3

Hello, hideokidd:
Thanks for the reply,

However, if I remove all configuration for zk's integration for spring web flow, all problem gone.
That is, if all configuration for org.zkoss.spring.web.servlet.view.ZkResourceViewResolver,
<zksp:flow-controller id="flowController" flow-executor="flowExecutor"/>, and
<zksp:flow-builder-services id="zkFlowBuilderServices" /> are removed, and stick to original spring web flow
configuration, all works as expected.

Of course, this way does have penalty, e.x.,
<zul:button self="@{action(runQuery)}" label="RunQuery"/>
can't be used, and this is very inconvenient.

By the way, I use glassfish instead of tomcat as the testing environment.

Hence, I believe the problem resides on the zk part rather than spring web flow part.

link publish delete flag offensive edit

answered 2009-02-03 02:20:49 +0800

henrichen gravatar image henrichen
3869 2
ZK Team

lendle,

Would you test your case in Tomcat and see if the exception still happen? It would help us to reduce the "error scope". Thanks.

link publish delete flag offensive edit

answered 2009-02-03 14:18:11 +0800

lendle gravatar image lendle
213 3

Hello, henrichen:

I setup a test case for tomcat, and I got exactly the same result.
The tomcat console still shows the following error message:

ๅšด้‡็š„: >>java.lang.IncompatibleClassChangeError: Found interface org.springframework.binding.mapping.MappingResult, but class was expected
>>        at org.zkoss.spring.webflow.execution.ZkFlowView$PropertyNotFoundError.test(ZkFlowView.java:262)
>>        at org.springframework.binding.mapping.impl.DefaultMappingResults.getResults(DefaultMappingResults.java:91)
>>        at org.zkoss.spring.webflow.execution.ZkFlowView.onlyPropertyNotFoundErrorsPresent(ZkFlowView.java:191)
>>        at org.zkoss.spring.webflow.execution.ZkFlowView.hasMappingErrors(ZkFlowView.java:187)
>>        at org.zkoss.spring.webflow.execution.ZkFlowView.processUserEvent(ZkFlowView.java:96)
>>        at org.springframework.webflow.engine.ViewState.resume(ViewState.java:187)
>>...

Hope this information helps.

Thank you!

link publish delete flag offensive edit

answered 2009-02-05 02:01:13 +0800

henrichen gravatar image henrichen
3869 2
ZK Team

lendle,

This is a weird bug actually. Seems an interface rather than a class is passed through by Spring. Would you post this to ZK Bugs? Let us track from there. Thanks.

link publish delete flag offensive edit

answered 2009-02-05 02:52:22 +0800

lendle gravatar image lendle
213 3

Sure
I've post it to ZK Bugs with Request id=2566429

And thanks for your help :)

link publish delete flag offensive edit

answered 2010-12-01 07:34:03 +0800

giovanni1982 gravatar image giovanni1982
3

Hi,
no one solution or work around for this bug?
I have the same problem.

Thank you for help,
Giovanni

link publish delete flag offensive edit
Your reply
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

RSS

Stats

Asked: 2009-01-30 14:54:19 +0800

Seen: 707 times

Last updated: Dec 01 '10

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