This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
Anytime I use a h:commandLink and h:commandButton I get the following stack trace:
java.lang.NullPointerException at javax.faces.component.UIComponentBase.getRenderer(UIComponentBase.java:1402)
I am using glassfish 3 which has JSF 2 bundled in and this richfaces jar in the pom.xml of my maven project
I really wish people would include dates on their published wisdom. Otherwise it's impossible to tell whether what they're saying applies to modern-day problems or to something that was fixed 5 years ago. In any event, Señor Squirrel is still in the "why can't JSF work just like JSPs?" stage.
One of the most frustrating things you can get in JSF is this kind of NullPointerException. You think it's related to the commandLink, but there's a high probability that in fact what it really is is a consequence of the train of events that firing the commandLink set into motion. For example, not having a proper datamodel on one of the controls on the subsequent View can give you this. And good luck trying to figure out which one it is!
What I end up having to do in cases like this is set a debugger breakpoint and walk my way up the stack. Just to make things even MORE annoying, setting a breakpoint on NullPointerException will swiftly inform you that a lot of people will throw and catch NPE's casually as part of their normal logic flow instead of using mechanisms that would require more work but be less dire.
Once you've managed to park on the NPE in getRenderer, start looking at stack frames. The variables that will tell you what you need to know are the control ID and the EL expression representing the missing/misspelled property reference. Unfortunately, I can't tell you actual names or locations, so it take a certain amount of digging.
This, by the way, is one reason why it's good practice putting IDs on your controls. If you find the offending control and its ID is "j_145", you really don't know much more than you did originally.
Customer surveys are for companies who didn't pay proper attention to begin with.
Joined: Aug 25, 2008
I would like to debug but I do not know what version of the Mojarra jar i have. Im using glass fish 3 and i searched all folders for Mojarra. Nothing came up. So where ever its pulling the UIComponentBase class from, I do not know. I need to find the correct version first and then the source code for it.
I think this may be class path issue though or something to that effect. I have tried submitting a simple for m like this and i get the stack trace. So i do not believ it to be a null component issue: