0

autowireing of variables Nullpointer exception

asked 2008-09-22 09:36:49 +0800

duro gravatar image duro
96 1

hi,
i use the autowireing of variables by calling

Components.wireVariables(this, this);
Components.addForwards(this, this);

and i get this error:

Cause: Unknown error: java.lang.NullPointerException.
java.lang.NullPointerException
	at org.zkoss.zk.ui.Components$Wire.getImplicit(Components.java:658)
	at org.zkoss.zk.ui.Components$Wire.myGetImplicit(Components.java:642)
	at org.zkoss.zk.ui.Components$Wire.wireImplicit(Components.java:480)
	at org.zkoss.zk.ui.Components$Wire.myWireVariables(Components.java:474)
	at org.zkoss.zk.ui.Components$Wire.wireVariables(Components.java:471)
	at org.zkoss.zk.ui.Components.wireVariables(Components.java:348)

what can be the cause? thanks

delete flag offensive retag edit

4 Replies

Sort by » oldest newest

answered 2008-09-22 09:40:25 +0800

ziccardi gravatar image ziccardi
321 7

I got the same problem some time ago: I solved it calling the setParent before calling the wireVariables instead than calling it after..
Hope this helps...

link publish delete flag offensive edit

answered 2008-09-22 10:46:27 +0800

duro gravatar image duro
96 1

i call the

Components.wireVariables(this, this);
Components.addForwards(this, this);

in aftercompose of a superclass, so it should be after the setParent call

link publish delete flag offensive edit

answered 2008-09-23 00:23:01 +0800

henrichen gravatar image henrichen
3869 2
ZK Team

duro,

By inspecting the code and your description, it is not possible to throw the NullPointerException. Would you provide sample codes that will replicate your issue so we can investigate it? Thanks.

link publish delete flag offensive edit

answered 2009-07-22 14:28:02 +0800

zktest gravatar image zktest
42

Hi,
i have the same problem with the following code:

public class LabeledTextbox extends Div implements AfterCompose {
	
	// Optionen zur Erstellung der Komponente
	private static final String TEMPLATE = "/WEB-INF/view/components/labeledTextbox.zul";

	// Autowired Felder
	protected Label label;
	protected Textbox textbox;
	
	public LabeledTextbox() {
		Executions.createComponents(TEMPLATE, this, null);
	}

	@Override
	public void afterCompose() {
		System.out.println(this);
		System.out.println(this.getFellows());
		Components.wireVariables(this, this);
	}
}

labeledTextbox.zul:

<!-- Template für beschriftete Textbox -->
<zk>
	<label id="label" />
	<textbox id="textbox" />
</zk>

Exception:

22.07.2009 16:24:13 org.zkoss.zk.ui.impl.UiEngineImpl handleError:1128
SCHWERWIEGEND: >>java.lang.NullPointerException
>>	at org.zkoss.zk.ui.Components.getImplicit(Components.java:629)
>>	at org.zkoss.zk.ui.Components$Wire.myGetImplicit(Components.java:974)
>>	at org.zkoss.zk.ui.Components$Wire.wireImplicit(Components.java:803)
>>	at org.zkoss.zk.ui.Components$Wire.myWireVariables(Components.java:793)
>>	at org.zkoss.zk.ui.Components$Wire.wireVariables(Components.java:790)
>>	at org.zkoss.zk.ui.Components.wireVariables(Components.java:418)
>>...

Hope someone can help.
Thank you in advance.

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: 2008-09-22 09:36:49 +0800

Seen: 336 times

Last updated: Jul 22 '09

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