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.

Bug 152170 - [65cat] NullPointerException at org.netbeans.modules.websvc.rest.codegen.model.EntityResourceModelBuilder.createItemResourceBean
Summary: [65cat] NullPointerException at org.netbeans.modules.websvc.rest.codegen.mode...
Status: RESOLVED FIXED
Alias: None
Product: webservices
Classification: Unclassified
Component: REST (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Peter Liu
URL: http://statistics.netbeans.org/except...
Keywords:
: 158172 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-11-03 09:59 UTC by rajivderas
Modified: 2009-02-19 23:29 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 82483


Attachments
stacktrace (6.60 KB, text/plain)
2008-11-03 09:59 UTC, rajivderas
Details
stacktrace (6.60 KB, text/plain)
2008-11-03 10:02 UTC, rajivderas
Details
stacktrace (6.42 KB, text/plain)
2008-12-09 14:57 UTC, Exceptions Reporter
Details

Note You need to log in before you can comment on or make changes to this bug.
Description rajivderas 2008-11-03 09:59:29 UTC
Build: NetBeans IDE Dev (Build 200811011401)
VM: Java HotSpot(TM) Client VM, 11.0-b15, Java(TM) SE Runtime Environment, 1.6.0_10-b33
OS: Windows XP, 5.1, x86

User Comments:
rajivderas: tried to add entity class

sunbiz: Creating new RESTful web services from available entity classes

sunbiz: Steps to reproduce bug:
1.) Create New Web Application
2.) Create New Entity Classes from database (select sakila DB)
3.) Follow the instructions (I selected All tables for my PU... and java.util.List as my collection class) and Finish
4.) Create New RESTful Web Services from Entity Classes
5.) Click Add all available entity classes and the exception is thrown. Probably it is because of the error message that "Some Selected Entity Classes are not valid"

rajivderas: tried to add entity class



Stacktrace: 
java.lang.NullPointerException
        at org.netbeans.modules.websvc.rest.codegen.model.EntityResourceModelBuilder.createItemResourceBean(EntityResourceModelBuilder.java:176)
        at org.netbeans.modules.websvc.rest.codegen.model.EntityResourceModelBuilder.getItemResourceBean(EntityResourceModelBuilder.java:162)
        at org.netbeans.modules.websvc.rest.codegen.model.EntityResourceModelBuilder.createContainerResourceBean(EntityResourceModelBuilder.java:150)
        at org.netbeans.modules.websvc.rest.codegen.model.EntityResourceModelBuilder.getContainerResourceBean(EntityResourceModelBuilder.java:134)
        at org.netbeans.modules.websvc.rest.codegen.model.EntityResourceModelBuilder.build(EntityResourceModelBuilder.java:117)
        at org.netbeans.modules.websvc.rest.wizard.EntitySelectionPanelVisual.refreshModel(EntitySelectionPanelVisual.java:582)
Comment 1 rajivderas 2008-11-03 09:59:34 UTC
Created attachment 73099 [details]
stacktrace
Comment 2 rajivderas 2008-11-03 10:02:43 UTC
Build: NetBeans IDE Dev (Build 200811011401)
VM: Java HotSpot(TM) Client VM, 11.0-b15, Java(TM) SE Runtime Environment, 1.6.0_10-b33
OS: Windows XP, 5.1, x86

User Comments: 


Stacktrace: 
java.lang.NullPointerException
        at org.netbeans.modules.websvc.rest.codegen.model.EntityResourceModelBuilder.createItemResourceBean(EntityResourceModelBuilder.java:176)
        at org.netbeans.modules.websvc.rest.codegen.model.EntityResourceModelBuilder.getItemResourceBean(EntityResourceModelBuilder.java:162)
        at org.netbeans.modules.websvc.rest.codegen.model.EntityResourceModelBuilder.createContainerResourceBean(EntityResourceModelBuilder.java:150)
        at org.netbeans.modules.websvc.rest.codegen.model.EntityResourceModelBuilder.getContainerResourceBean(EntityResourceModelBuilder.java:134)
        at org.netbeans.modules.websvc.rest.codegen.model.EntityResourceModelBuilder.build(EntityResourceModelBuilder.java:117)
        at org.netbeans.modules.websvc.rest.wizard.EntitySelectionPanelVisual.refreshModel(EntitySelectionPanelVisual.java:582)
Comment 3 rajivderas 2008-11-03 10:02:52 UTC
Created attachment 73100 [details]
stacktrace
Comment 4 Nathan Fiedler 2008-12-05 02:07:47 UTC
I believe this is happening because the database table is question does not have a column named "id", and the websvc
code expects that column to be present.
Comment 5 Quality Engineering 2008-12-05 06:10:16 UTC
Integrated into 'main-golden', will be available in build *200812050201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/7d2d3c28a07b
User: PeterTLiu@netbeans.org
Log: Initial fixes for IZ #152170, #152640
Comment 6 Peter Liu 2008-12-05 23:01:32 UTC
I turns out that entity classes without Id fields are invalid per the JPA spec. The reason we are getting these entity
classes without id fields is because they are generated from views in the sakila mysql sample database which do not have
primary keys. 

The fix on our side is to filter out all these entity classes without id fields so we will never hit the NPE.

I am also going to file another IZ against persistence since these entity classes shouldn't be generated in the first place.

Comment 7 Peter Liu 2008-12-05 23:32:41 UTC
Here is the issue against persistence:  http://www.netbeans.org/issues/show_bug.cgi?id=154822

Comment 8 Quality Engineering 2008-12-07 05:30:37 UTC
Integrated into 'main-golden', will be available in build *200812070201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/03b23cd2055d
User: PeterTLiu@netbeans.org
Log: More fixes for IZ #152170, #152640 (related to sikila sample database for MySQL)
Comment 9 Exceptions Reporter 2008-12-09 14:57:03 UTC
Build: NetBeans IDE Dev (Build 200807040101)
VM: Java HotSpot(TM) Client VM, 1.5.0_15-b04, Java(TM) 2 Runtime Environment, Standard Edition, 1.5.0_15-b04
OS: Windows 2003, 5.2, x86

User Comments: 


Stacktrace: 
java.lang.NullPointerException
        at org.netbeans.modules.websvc.rest.codegen.model.EntityResourceModelBuilder.createItemResourceBean(EntityResourceModelBuilder.java:175)
        at org.netbeans.modules.websvc.rest.codegen.model.EntityResourceModelBuilder.getItemResourceBean(EntityResourceModelBuilder.java:161)
        at org.netbeans.modules.websvc.rest.codegen.model.EntityResourceModelBuilder.createContainerResourceBean(EntityResourceModelBuilder.java:149)
        at org.netbeans.modules.websvc.rest.codegen.model.EntityResourceModelBuilder.getContainerResourceBean(EntityResourceModelBuilder.java:133)
        at org.netbeans.modules.websvc.rest.codegen.model.EntityResourceModelBuilder.build(EntityResourceModelBuilder.java:116)
        at org.netbeans.modules.websvc.rest.wizard.EntitySelectionPanelVisual.refreshModel(EntitySelectionPanelVisual.java:580)
Comment 10 Exceptions Reporter 2008-12-09 14:57:07 UTC
Created attachment 74751 [details]
stacktrace
Comment 11 Ayub Khan 2009-02-12 21:03:53 UTC
*** Issue 158172 has been marked as a duplicate of this issue. ***