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 112927 - NPE occurs when adding the CMP entity bean to an EJB module project
Summary: NPE occurs when adding the CMP entity bean to an EJB module project
Status: VERIFIED FIXED
Alias: None
Product: serverplugins
Classification: Unclassified
Component: Sun Appserver 9 (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: _ pcw
URL:
Keywords:
: 113743 115942 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-08-15 21:04 UTC by davisn
Modified: 2007-12-03 13:03 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
messages.log (55.38 KB, application/octet-stream)
2007-08-15 21:05 UTC, davisn
Details
stack trace (11.75 KB, text/plain)
2007-10-16 23:20 UTC, _ pcw
Details
snapshot of screen (128.79 KB, image/jpeg)
2007-10-22 12:34 UTC, nouar38
Details

Note You need to log in before you can comment on or make changes to this bug.
Description davisn 2007-08-15 21:04:23 UTC
-NullPointerException occurs when adding CMP entity bean to an EJB project
-The problem only happens when user delete the project and re-create it

STEPS TO REPRODUCE
1. Install Netbean 6.0 nightly build (8/15/2007) with glassfish V2-58b build
2. Create a 1.4 J2EE EJB module project
3. Select to add CMP Entity Beans from default jdbc/sample to the project 
   (select all available tables)
4. Delete the project and re-create it (step 2-3)
BUG:
    java.lang.NullPointerException
	at org.netbeans.modules.j2ee.sun.ddloaders.DDMultiViewDataObject.writeModel(DDMultiViewDataObject.java:113)
	at org.netbeans.modules.j2ee.sun.ddloaders.DDMultiViewDataObject.writeModel(DDMultiViewDataObject.java:103)
	at org.netbeans.modules.j2ee.sun.dd.impl.cmp.SunCmpMappingsProxy.write(SunCmpMappingsProxy.java:338)
	at
org.netbeans.modules.j2ee.sun.share.configbean.SunONEDeploymentConfiguration.mapCmpBeans(SunONEDeploymentConfiguration.java:1662)
Caused: org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException: NullPointerException while setting cmp
mapping information.
	at
org.netbeans.modules.j2ee.sun.share.configbean.SunONEDeploymentConfiguration.mapCmpBeans(SunONEDeploymentConfiguration.java:1675)
	at org.netbeans.modules.j2ee.sun.ide.j2ee.ModuleConfigurationImpl.setMappingInfo(ModuleConfigurationImpl.java:160)
	at org.netbeans.modules.j2ee.deployment.config.ConfigSupportImpl.setCMPMappingInfo(ConfigSupportImpl.java:280)
	at org.netbeans.modules.j2ee.ejbcore.ejb.wizard.cmp.CmpFromDbGenerator.generateBeans(CmpFromDbGenerator.java:184)
	at org.netbeans.modules.j2ee.ejbcore.ejb.wizard.cmp.CmpGenerator.generateBeans(CmpGenerator.java:72)
	at org.netbeans.modules.j2ee.persistence.wizard.fromdb.RelatedCMPWizard.createBeans(RelatedCMPWizard.java:317)
	at org.netbeans.modules.j2ee.persistence.wizard.fromdb.RelatedCMPWizard.access$000(RelatedCMPWizard.java:58)
	at org.netbeans.modules.j2ee.persistence.wizard.fromdb.RelatedCMPWizard$1.run(RelatedCMPWizard.java:233)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:539)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:964)
Comment 1 davisn 2007-08-15 21:05:00 UTC
Created attachment 46694 [details]
messages.log
Comment 2 Rochelle Raccah 2007-08-15 21:09:45 UTC
Peter, I think this is the same as the race condition you mentioned.
Comment 3 Rochelle Raccah 2007-08-25 00:56:11 UTC
*** Issue 113743 has been marked as a duplicate of this issue. ***
Comment 4 _ pcw 2007-08-25 09:17:49 UTC
Will try to fix for beta1.
Comment 5 Vince Kraemer 2007-09-12 19:07:49 UTC
these bugs did not make it into beta1. please re-evaluate the Target milestone
settings.
Comment 6 nouar38 2007-09-13 16:58:10 UTC
reproduced this on my new host solaris-x86 without delete and recreate of the project.

NB 6.0 200709121200 & GF V2 b58g bundled & jdk 1.6u2

JsfJpaCrud project (web Java EE 1.5) is created from IDE -samples/enterprise deploy, run, undelpoy and remove the jdbc
resources over jdbc/sample, SamplePool (used the IDE-Services/../Resources/JDBC.. "Delete". 
The "sample" DB is created and populated by this application.

New EJB - J2EE 1.4 project called as testEntityFromDBAlone is created
add CMP entity bean from database 
selected the proposed data source in the Wizard: jdbc/sample
add all the tables, NEXT
give the entity bean package name
keep the two combo boxes checked for: Generate FinderMethods for CMP Fields, Add CMP and CMR Fields to the Local Interfaces.

==>>> Warning ConfigurationException window

In the Projects/project, under Configuration Files / App_testEntityFromDBAlone.dbschema/APP_testEntityFromDBAlone
can see the mapped tables.

adding myself to cc.

When the wizard shows the list of data sources + new data source choice, the jdbc/sample data source
had been deployed, can see the message in Ouput-GlassFish V2
<<
ADM1041:Sent the event to instance:[ResourceDeployEvent -- reference-added jdbc/jdbc/sample]
CORE5004: Resource Deployed: [jdbc:jdbc/sample].
>>

Comment 7 Rochelle Raccah 2007-09-19 02:00:45 UTC
*** Issue 115942 has been marked as a duplicate of this issue. ***
Comment 8 _ pcw 2007-09-19 02:02:39 UTC
You can work around this issue by creating a trival sun-cmp-mappings.xml in the configuration folder before invoking the
wizard.
Comment 9 _ pcw 2007-10-16 23:16:52 UTC
Not just CMP.  This exception can happen when adding a JAX RPC web service to a J2EE 1.4 ejb-jar (which will attempt to
set endpoint-uri field in sun-ejb-jar.xml).

See attached trace.
Comment 10 _ pcw 2007-10-16 23:20:16 UTC
Created attachment 51070 [details]
stack trace
Comment 11 nouar38 2007-10-22 12:33:27 UTC
was able to reproduce for JAXRPC service add to an EJB on windows/xp with daily 200710211200 & jdk 1.6u3 &
gf v2 ur1-b05 (cluster setup).

got also from IDE a Warning window with:
<< Fatal errors found in sun-ejb-jar.xml file 
It is impossible to merge the latest changes with sun-ejb-jar.xml
Do you want to overwrite sun-ejb-jar.xml completely ?
>>

will add the snapshoot of the screen.
Comment 12 nouar38 2007-10-22 12:34:53 UTC
Created attachment 51398 [details]
snapshot of screen
Comment 13 _ pcw 2007-10-22 21:28:02 UTC
I have discovered the cause of this exception and tested a bandage fix to confirm that.

I am creating a proper fix now.  This will be not be fixed in beta 2 but will be fixed in trunk soon and for 6.0 release.
Comment 14 _ pcw 2007-10-24 01:00:07 UTC
Cause was premature GC of DataObject for the respective Sun Descriptor file.  So Sun DD was created, graph retrieved and
then modified.  During modification, the DataObject was GC'd, so when graph was merged for saving, a new DataObject and
new graph was created and that causes major problems (not supported scenario by API).

Fix is to ensure that DataObject is not GC'd in this manner.

http://serverplugins.netbeans.org/source/browse/serverplugins/sun/sunddapi/src/org/netbeans/modules/j2ee/sun/dd/api/DDProvider.java?r1=1.15&r2=1.16
Comment 15 nouar38 2007-10-31 13:49:10 UTC
NB daily 200710301200 & GF v2 ur1 b06 & jdk1.6 u03-b05: on windows/xp
2) Create a 1.4 J2EE EJB module project (EJBModule14)
3) Select to add CMP Entity Beans from default jdbc/sample to the project(select all available tables)

Browsing in Projects/EJBModule14/Configuration Files, can see the 3 files ejb-jar.xml, sun-cmp-mappings.xml, sun-ejb-jar.xml

4. Delete the project and re-create it (step 2-3)
==> no more exception

will continue for JaxRPC case in EJB 1.4
Comment 16 nouar38 2007-10-31 14:42:36 UTC
was able to verify on solaris-sparc using 200710291200 & gf v2 ur1 -06 & jdk 1.6 u3 (b05)
for cmp Entity Beans from jdbc/sample. No more problem for sun-cmp-mappings.xml

for Jax-RPC web service in ejb 1.4 on windows/xp did not hit the exception.

for Jax-RPC web service in ejb 1.4 on solaris-sparc : could not add the web service as hit another
exception reported to http://statistics.netbeans.org/exceptions/detail.do?id=9614

will try again with.

Comment 17 nouar38 2007-10-31 17:30:45 UTC
for Jax-RPC web service in ejb 1.4 on solaris-sparc upgraded to 200710301200 
and was able to add the web service + op.

Did not hit anymore the NPE at
org.netbeans.modules.j2ee.sun.ddloaders.DDMultiViewDataObject.writeModel(DDMultiViewDataObject.java:113)
Comment 18 nouar38 2007-12-03 13:03:57 UTC
marking this issues as Verified in 6.0 see previous comments.