0

ZK Debugging

asked 2010-08-09 11:37:18 +0800

eptx gravatar image eptx
130 3

I'm using the MVC approach with GenericForwardComposer. Occasionally I get zul code and the controller out of sync (usually due to a misspelling or dropping a component no longer needed when re-factoring). All I get is a very unhelpful error message like below. I really like being able to do the layout in zul, but its value is significantly reduced in the overall development process if debugging support is poor. Any ideas appreciated? Thanks.

SEVERE: Servlet.service() for servlet zkLoader threw exception
java.lang.NullPointerException
at org.zkoss.zkplus.databind.Binding.registerLoadEvents(Binding.java:548)
at org.zkoss.zkplus.databind.DataBinder.registerLoadEvents(DataBinder.java:860)
at org.zkoss.zkplus.databind.DataBinder.init(DataBinder.java:664)
at org.zkoss.zkplus.databind.DataBinder.loadAll(DataBinder.java:551)
at org.zkoss.zkplus.databind.AnnotateDataBinderInit.doAfterCompose(AnnotateDataBinderInit.java:175)
at org.zkoss.zk.ui.impl.RealInits.doAfterCompose(Initiators.java:82)
at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage0(UiEngineImpl.java:377)
at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage(UiEngineImpl.java:291)
at org.zkoss.zk.ui.http.DHtmlLayoutServlet.process(DHtmlLayoutServlet.java:238)
at org.zkoss.zk.ui.http.DHtmlLayoutServlet.doGet(DHtmlLayoutServlet.java:159)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:83)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:637)

delete flag offensive retag edit

6 Replies

Sort by ยป oldest newest

answered 2010-08-09 12:19:55 +0800

robertpic71 gravatar image robertpic71
1275 1

It looks like a syntaxerror for the databinding load-event.
Something is wrong after load-when or load-after.

Post your zul-file, if you don't find the fault.

/Robert

link publish delete flag offensive edit

answered 2010-08-09 13:12:49 +0800

eptx gravatar image eptx
130 3

Robert, This scenario is actually from a solved issue where I had a bad component reference in a load-after attribute:
<listbox id="personLb" model="@{controller.model.personData,load-after='searchTbWrongReferenceHere.onOK,indiSave.onClick'}" >
The way I found it was by commenting out sections of code until something worked, then putting stuff back in until it broke--kind of a binary-hunt-peck-search for the offending code. Is there a better solution from ZK than this? Do I drop ZUL and write richlets? Ease of layout process vs. code debug and maintenance? Thanks -ep

link publish delete flag offensive edit

answered 2010-08-09 20:30:21 +0800

jimmyshiau gravatar image jimmyshiau
4921 5
http://www.zkoss.org/ ZK Team

Hi eptx
could you post your sample code ?

link publish delete flag offensive edit

answered 2010-08-09 22:46:11 +0800

robertpic71 gravatar image robertpic71
1275 1

updated 2010-08-09 22:47:16 +0800

@as1225: eptx has found the fault, the question is: is there a better do find errors is binding-code?


@eptx
>> Is there a better solution from ZK than this? Do I drop ZUL and write richlets?
1. ZUL-Code is checked by the ZK-Studio-Plugin - "only" the bindingcode" is unchecked.
2. I do not know a better way to search this error.


The unchecked bindingcodes is in fact a weak point, there are already feature requests i.e. this one.

However, one way to reduce bindingcode is to fire the load and save-events inside the controller, i.e.

Composer/Controller (with autowire and autoforward) {

Listbox personLb;  // autowired     OR
Component personLb;     // Component

public void onClick$indiSave() {
    // your code here
    binder.load(personLb);
}

load-when, load-after is nice, but without syntax check i use javacode.

Note:
you can create scopes with every Component i.e.

<hbox id="output">
<label value="@{model.bean.value}"/>
....
</hbox>


Component output;   // autowired by composer
...
binder.load(output);
binder.save(output);
...

/Robert

link publish delete flag offensive edit

answered 2010-08-10 20:14:07 +0800

jimmyshiau gravatar image jimmyshiau
4921 5
http://www.zkoss.org/ ZK Team

Hi Robert
OK, We will evaluate and improve zul editor for annotation checking in next ZK studio version

link publish delete flag offensive edit

answered 2010-08-10 23:51:45 +0800

robertpic71 gravatar image robertpic71
1275 1

Hi Jimmy,

my personal number 1 feature request. :-)

Thx Robert

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: 2010-08-09 11:37:18 +0800

Seen: 683 times

Last updated: Aug 10 '10

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