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 113115 - NPE on Migrating Legacy Project that uses Datasources
Summary: NPE on Migrating Legacy Project that uses Datasources
Status: VERIFIED FIXED
Alias: None
Product: obsolete
Classification: Unclassified
Component: visualweb (show other bugs)
Version: 6.x
Hardware: PC All
: P2 blocker (vote)
Assignee: John Baker
URL:
Keywords: REGRESSION
Depends on:
Blocks:
 
Reported: 2007-08-17 18:11 UTC by Yousuf Haider
Modified: 2007-08-21 19:26 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Ide log (58.64 KB, text/plain)
2007-08-17 18:11 UTC, Yousuf Haider
Details
Creator project that uses mysql connection on jbrave-pc1 (5.67 MB, application/x-compressed)
2007-08-17 18:50 UTC, Yousuf Haider
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yousuf Haider 2007-08-17 18:11:27 UTC
jdk6u2
Build:200708161200

Steps to reproduce:
1. Import Creator project that uses a data source in NB6 with fresh userdir.
2. Expand project node.
3. Once Updating data sources is finished open page.

NPE will be thrown and design view does not come up:

java.lang.NullPointerException
	at
org.netbeans.modules.visualweb.project.jsf.services.DesignTimeDataSourceServiceImpl.updateResourceReference(DesignTimeDataSourceServiceImpl.java:144)
	at
org.netbeans.modules.visualweb.dataconnectivity.sql.DesignTimeDataSourceHelper.updateDataSource(DesignTimeDataSourceHelper.java:547)
	at org.netbeans.modules.visualweb.dataconnectivity.naming.DesignTimeContext.updateBindings(DesignTimeContext.java:284)
	at org.netbeans.modules.visualweb.dataconnectivity.naming.DesignTimeContext.lookup(DesignTimeContext.java:134)



Seems like the exception is coming from line 547 in DesignTimeDataSourceHelper.java. 

From Fisheye it seems that there was a addition/change made to DesignTimeDataSourceHelper.java to fix issue 112367
(Resource reference is added to the wrong file) on Aug 15. This apparently has caused a regression.

Workaroud:

Workaround is to close the page and open it again. Then the page will come up fine.
Attaching messages.log
Comment 1 Yousuf Haider 2007-08-17 18:11:54 UTC
Created attachment 46802 [details]
Ide log
Comment 2 John Baker 2007-08-17 18:39:41 UTC
Works for me.  Can you attach a project
Comment 3 John Baker 2007-08-17 18:41:38 UTC
Note, if you have not registered Glassfish then an error will occur.
I filed a bug against serverplugins
Comment 4 John Baker 2007-08-17 18:44:54 UTC
 see also 106591
Comment 5 Yousuf Haider 2007-08-17 18:50:12 UTC
Created attachment 46809 [details]
Creator project that uses mysql connection on jbrave-pc1
Comment 6 John Baker 2007-08-17 19:03:09 UTC
Still no NPE occurs using the attached project.
Comment 7 Yousuf Haider 2007-08-17 19:04:39 UTC
Is the design View coming up fine for the page?
Comment 8 Yousuf Haider 2007-08-17 22:48:49 UTC
I can reproduce this consistently on builds 200708161200 and 200708171200.
Also the NPE will occur on the design view when the page is opened.
Comment 9 Yousuf Haider 2007-08-17 23:14:44 UTC
Krys can also reproduce the issue on her machine: WinXP, jdk5u12
Comment 10 John Baker 2007-08-17 23:47:29 UTC
I installed clean 817 Web J2EE build (nightly) and downloaded the project again and unzipped then started with a clean
userdir.

Then opened the project and expanded.  No page opens and no NPE occurred.
Comment 11 John Baker 2007-08-17 23:47:58 UTC
I'm on Win XP and JDK 1.5.0_12
Comment 12 John Baker 2007-08-17 23:49:12 UTC
While opening the page an NPE occurs (different stack trace) 
Comment 13 Yousuf Haider 2007-08-18 00:06:39 UTC
OK, I think the problem is that you don't have Creator userdir with that datasource defined in it. You are probably getting:

java.lang.NullPointerException
	at com.sun.sql.rowset.CachedRowSetXImpl.getConnection(CachedRowSetXImpl.java:4239)
	at com.sun.sql.rowset.CachedRowSetXImpl.getMetaData(CachedRowSetXImpl.java:2384)
	at com.sun.data.provider.impl.CachedRowSetDataProvider.getMetaData(CachedRowSetDataProvider.java:1388)
	at com.sun.data.provider.impl.CachedRowSetDataProvider.getFieldKeys(CachedRowSetDataProvider.java:507)


Try this scenario:

1. Create a new project in Creator and create a new db connection to jdbc:mysql://jbrave-pc1.sfbay.sun.com:3306/travel
2. Bind a component to databse table, build and close page and project. 
3. Open Creator Project in NB6 with fresh userdir and expand project node. 
4. Once Updating data sources process is completed open Page. 

You will see the exception in the design view.
Comment 14 John Baker 2007-08-18 00:10:17 UTC
the attached project must have been invalid

I can reproduce the NPE by creating a new Creator 2 project.
Expand the project then open the page.

However, the page opens and binding is successful, just that an NPE occurs

Comment 15 John Baker 2007-08-18 00:11:27 UTC
removing INCOMPLETE
Comment 16 Yousuf Haider 2007-08-18 00:24:37 UTC
Has this been resolved and fixed ?
Comment 17 Yousuf Haider 2007-08-18 00:54:55 UTC
I am reopening this issue assuming that you have marked it as resolved and fixed by mistake when removing INCOMPLETE
keyword. 
Comment 18 John Baker 2007-08-18 02:32:31 UTC
Fixed.
No need to update the Resource References when opening a project

Checking in
visualweb/dataconnectivity/src/org/netbeans/modules/visualweb/dataconnectivity/sql/DesignTimeDataSourceHelper.java;
/cvs/visualweb/dataconnectivity/src/org/netbeans/modules/visualweb/dataconnectivity/sql/DesignTimeDataSourceHelper.java,v
 <--  DesignTimeDataSourceHe
lper.java
new revision: 1.16; previous revision: 1.15
done
Comment 19 _ alexpetrov 2007-08-20 18:12:26 UTC
This bug is still reproduced on:

Product Version: NetBeans IDE Dev (Build 200708200000) 
Java: 1.6.0_02; Java HotSpot(TM) Client VM 1.6.0_02-b06 
System: Windows XP version 5.1 running on x86

Let's discuss, please:

if you open the attached project "DBTestMySqL" without the appropriate MySQL-connection, 
no NPE will appear, but:
- no warnings about UNRESOLVED data sources will appear too
- root project tree node won't be red in the window "Projects"
- there will be no project popup menu item for resolving of required data sources.

Should this bug be reopened or should I file new REGRESSION-bug?
Comment 20 John Baker 2007-08-20 18:17:54 UTC
The latest comments are not related to this issue.
Marking as fix verified
Comment 21 John Baker 2007-08-20 18:26:08 UTC
Answers to latest comments.  A separate issue can be filed

if you open the attached project "DBTestMySqL" without the appropriate MySQL-connection, 
no NPE will appear, but:
- no warnings about UNRESOLVED data sources will appear too
- root project tree node won't be red in the window "Projects"
- there will be no project popup menu item for resolving of required data sources.

Expanding the project will add a MySQL connection if the connection exists from a Creator 2/ or NetBeans 5.5/5.5.1 project

Otherwise, if no required connection is available then the project node will be badged and turn red.
The limitation is detection of missing connections cannot be determined until the project data sources are determined.
At this time there are no connection changes being made so the project node badging won't occur.

No project popup menu will be available also
Comment 22 _ alexpetrov 2007-08-20 18:29:49 UTC
Verified on:

Product Version: NetBeans IDE Dev (Build 200708200000) 
Java: 1.6.0_02; Java HotSpot(TM) Client VM 1.6.0_02-b06 
System: Windows XP version 5.1 running on x86
Comment 23 John Baker 2007-08-21 19:26:08 UTC
Agreed this is a Regression