0

NullPointerException Executions.createComponentsDirectly

asked 2019-07-10 06:28:17 +0800

nsaazn gravatar image nsaazn
13 2

I'am trying to create components without current execution (inside quartz job):
Component[] cmps = Executions.createComponentsDirectly(FormWebAppInit.getWebApp(), new StringReader(form.getView()), "zul", args);

UiUtils try to set attribute in execution, but request is null (bacause execution is a fake) Any ideas how i can create components inside quartz job? Is it bug or not?


Stack trace:
java.lang.NullPointerException at org.zkoss.zk.ui.http.ExecutionImpl.getAttribute(ExecutionImpl.java:488) ~[zk-8.6.0.1.jar:8.6.0.1] at org.zkoss.zk.ui.impl.Utils.getComponentInfos(Utils.java:117) ~[zk-8.6.0.1.jar:8.6.0.1] at org.zkoss.zk.ui.impl.Utils.setComponentInfo(Utils.java:129) ~[zk-8.6.0.1.jar:8.6.0.1] at org.zkoss.zk.ui.impl.AbstractUiFactory.newComponent(AbstractUiFactory.java:137) ~[zk-8.6.0.1.jar:8.6.0.1] at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild0(UiEngineImpl.java:919) ~[zk-8.6.0.1.jar:8.6.0.1] at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:889) ~[zk-8.6.0.1.jar:8.6.0.1] at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:776) ~[zk-8.6.0.1.jar:8.6.0.1] at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:836) ~[zk-8.6.0.1.jar:8.6.0.1] at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:794) ~[zk-8.6.0.1.jar:8.6.0.1] at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate(UiEngineImpl.java:740) ~[zk-8.6.0.1.jar:8.6.0.1] at org.zkoss.zk.ui.impl.UiEngineImpl.createComponents(UiEngineImpl.java:1143) ~[zk-8.6.0.1.jar:8.6.0.1] at org.zkoss.zk.ui.impl.AbstractExecution.createComponentsDirectly(AbstractExecution.java:399) ~[zk-8.6.0.1.jar:8.6.0.1] at org.zkoss.zk.ui.Executions.createComponentsDirectly(Executions.java:502) ~[zk-8.6.0.1.jar:8.6.0.1] at org.sinnlabs.dbvim.form.FormFieldResolver.<init>(FormFieldResolver.java:68) ~[dbvim-forms-0.0.2-SNAPSHOT.jar:?] at org.sinnlabs.dbvim.form.FormFieldResolverFactory.getResolver(FormFieldResolverFactory.java:42) ~[dbvim-forms-0.0.2-SNAPSHOT.jar:?] at org.sinnlabs.dbvim.script.impl.ScriptApiImpl.query(ScriptApiImpl.java:162) ~[dbvim-scriptapi-0.0.2-SNAPSHOT.jar:?] at jdk.nashorn.internal.scripts.Script$Recompilation$96$23A$\^eval_.execute(<eval>:13) ~[?:?] at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:639) ~[nashorn.jar:?] at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:494) ~[nashorn.jar:?] at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:393) ~[nashorn.jar:?] at jdk.nashorn.api.scripting.ScriptObjectMirror.callMember(ScriptObjectMirror.java:199) ~[nashorn.jar:?] at jdk.nashorn.api.scripting.NashornScriptEngine.invokeImpl(NashornScriptEngine.java:386) ~[nashorn.jar:?] at jdk.nashorn.api.scripting.NashornScriptEngine.invokeFunction(NashornScriptEngine.java:190) ~[nashorn.jar:?] at org.sinnlabs.dbvim.script.impl.JSScriptManager.eval(JSScriptManager.java:137) ~[dbvim-scriptapi-0.0.2-SNAPSHOT.jar:?] at org.sinnlabs.dbvim.scheduler.impl.QuartzSpringJobImpl.execute(QuartzSpringJobImpl.java:59) ~[dbvim-scheduler-0.0.2-SNAPSHOT.jar:?] at org.sinnlabs.dbvim.scheduler.impl.QuartzJob.execute(QuartzJob.java:33) ~[dbvim-scheduler-0.0.2-SNAPSHOT.jar:?] at org.quartz.core.JobRunShell.run(JobRunShell.java:202) ~[quartz-2.3.0.jar:?]

delete flag offensive retag edit

1 Answer

Sort by » oldest newest most voted
0

answered 2019-07-10 15:07:50 +0800

cor3000 gravatar image cor3000
4596 2 7
ZK Team

updated 2019-07-10 15:08:05 +0800

You have a valid point, this used to work back in ZK 5, it looks like a bug - so I posted ZK-4340.

However this seems to be broken since ZK 6, and hasn't been reported/considered since then. Likely no one ever used this and a complete fix might be not feasible at all.

Feel free to try out the prototypic fix/patch attached to the bug ticket, and share your results in a more complex scenario.

link publish delete flag offensive edit

Comments

I check the existence of the executor if not, i then i use patch. Solution is ok for me. Thx for advise

nsaazn ( 2019-07-11 16:18:55 +0800 )edit

thanks for getting back, if the problem gets worse let us know so we can fine tune the workaround until a fix is available

cor3000 ( 2019-07-17 11:05:42 +0800 )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
1 follower

RSS

Stats

Asked: 2019-07-10 06:28:17 +0800

Seen: 5 times

Last updated: Jul 10

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