This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Summary: | java.lang.NullPointerException from getAsObject() when updating data in JSF page with Join Table EJB | ||
---|---|---|---|
Product: | javaee | Reporter: | heckler |
Component: | JSF | Assignee: | Martin Fousek <marfous> |
Status: | VERIFIED FIXED | ||
Severity: | normal | CC: | dkonecny, jskrivanek, mmirilovic, pjiricka |
Priority: | P2 | ||
Version: | 7.2 | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | DEFECT | Exception Reporter: | |
Attachments: | changes to workaround the issue in generated sources |
Description
heckler
2012-07-18 16:13:23 UTC
Thanks heckler, that's really good catch. I updated the bug status a little bit and marked as P2 since it's a regression. :/ In addition to the reported steps, there is need to have enabled CDI in the project where are JSF pages generated. Now to the problem... As far as I (according google) understand this could be caused by JSF-CDI integration issue. This problem should be resolved in next JSF spec version but until that we are probably facing similar problem to this one: http://www.java.net/external?url=http://dominikdorn.com/2010/04/cdi-weld-manual-bean-lookup/ The Converter is created (and managed then) by JSF lifecycle, so it probably cannot resolve CDI and its injections properly. I'm attaching piece of code which can be used as workaround in generated sources. Except attached converter enhancements, there is needed to annotate facades as Named beans to be discoverable by CDI BeanManager. All this code changes are quite big especailly to WA single annotation. I propose that I will bring back ManagedBean for CDI projects until these scenarios will work. Make it sense, David? (btw. I updated ManagedBeans to Named before since more users complain about that it looks obsolete in CDI-times and it looked to be allright) Created attachment 122183 [details]
changes to workaround the issue in generated sources
Sorry I forgot to attach the converter's changes.
Makes perfect sense, Martin. Thanks for getting to the bottom of this so quickly and for providing the workaround code. Really appreciate NetBeans and all your team does! All the best, Mark Fixed in web-main #85471526855a. (In reply to comment #3) > Makes perfect sense, Martin. Thanks for getting to the bottom of this so > quickly and for providing the workaround code. Really appreciate NetBeans and > all your team does! Thanks for your kind words. I brought back the generation of ManagedBeans - you should get the fix in patch1 of NetBeans 7.2. Thanks again for reporting! Integrated into 'main-golden', will be available in build *201207201847* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/85471526855a User: Martin Fousek <marfous@netbeans.org> Log: #215703 - java.lang.NullPointerException from getAsObject() when updating data in JSF page with Join Table EJB (In reply to comment #1) > I propose that I will bring back ManagedBean for CDI projects until these > scenarios will work. Make it sense, David? (btw. I updated ManagedBeans to > Named before since more users complain about that it looks obsolete in > CDI-times and it looked to be allright) Sorry for late response. I agree with your problem resolution Martin. I remember we had a discussion about about whether to use CDI or ManagedBeans. Was there an issue requesting it or have we discusses it offline? (In reply to comment #7) > Sorry for late response. I agree with your problem resolution Martin. I > remember we had a discussion about about whether to use CDI or ManagedBeans. > Was there an issue requesting it or have we discusses it offline? Our offline discussion was related to: http://netbeans.org/projects/www/lists/netcat/archive/2012-04/message/117 Which comes a month later after fixing: issue #203986, issue #204613 Anyway I'll comment into #203986 and let's wait for JSF2.2 - what it will solve. ;) Jirko could I ask you for the verification please? Thanks in advance... Verified in NetBeans IDE Dev (Build 201208030001) with the following steps: - create java web project with CDI enabled targeting GlassFish server - Generate entities from database (include all tables from sample DB) - Create JSF pages from entities. - run project - edit and save an item from Customer table Thanks Jirko for the verification. Transplanted into release72 branch: releases #bde0e190768a : #215703 - java.lang.NullPointerException from getAsObject() when updating data in JSF page with Join Table EJB releases #34e4a1649f64 : included patch1 related changes - #215703 Integrated into 'releases', will be available in build *201209010822* or newer. Wait for official and publicly available build. Changeset: http://hg.netbeans.org/releases/rev/bde0e190768a User: Martin Fousek <marfous@netbeans.org> Log: #215703 - java.lang.NullPointerException from getAsObject() when updating data in JSF page with Join Table EJB (transplanted from 85471526855a0de5c5578ae8d653ba91569d34aa) |