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 114063 - Cannot bind component to Database table in Migrated project
Summary: Cannot bind component to Database table in Migrated project
Status: VERIFIED FIXED
Alias: None
Product: obsolete
Classification: Unclassified
Component: visualweb (show other bugs)
Version: 6.x
Hardware: PC All
: P1 blocker (vote)
Assignee: John Baker
URL:
Keywords: REGRESSION
Depends on:
Blocks:
 
Reported: 2007-08-28 23:53 UTC by Yousuf Haider
Modified: 2007-09-04 15:26 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
IDE log (47.81 KB, text/plain)
2007-08-28 23:54 UTC, Yousuf Haider
Details
Blank Creator Project (25.42 KB, application/x-compressed)
2007-08-28 23:54 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-28 23:53:51 UTC
jdk6u2
Build: 200708280259

After migrating a Creator project in NB6 you cannot bind a component to any database table. I am getting an NPE when
table is dropped on the component:

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:1401)
        at com.sun.data.provider.impl.CachedRowSetDataProvider.getFieldKeys(CachedRowSetDataProvider.java:513)
        at
org.netbeans.modules.visualweb.web.ui.dt.AbstractDesignInfo.linkDataProviderToListSelector(AbstractDesignInfo.java:619)
        at org.netbeans.modules.visualweb.web.ui.dt.AbstractDesignInfo.linkBeans(AbstractDesignInfo.java:553)


Steps to reproduce:

1. Download attached Creator Project. This project contains only one empty page.
2. Open it in NB6. Expand Project node to start Updating Legacy Project process.
3. Once complete Drag n Drop a dropdown component onto the page.
4. Then drag a table from the sample app or travel database connection and drop it on the dropdown.


NPE will be thrown.

This is a regression since this functionality was working in M10. Also as far as I can recall this was also working in
daily build 200707200000.

There is no workaround for this and since this functionality is broken I am filing it as a P1. 


Note:

I installed the RowSet plugin and tried this scenario again but it had no effect either.
Comment 1 Yousuf Haider 2007-08-28 23:54:19 UTC
Created attachment 47673 [details]
IDE log
Comment 2 Yousuf Haider 2007-08-28 23:54:41 UTC
Created attachment 47674 [details]
Blank Creator Project
Comment 3 Yousuf Haider 2007-08-28 23:56:43 UTC
Correcting priority since I filed it with the incorrect one.
Comment 4 John Baker 2007-08-29 01:46:15 UTC
getCachedRowSet().getMetaData() isn't retrieving the metadata :

e.g. getUrl(), getUsername()   are null

The data source gets created properly - all properties set
URL, username, password, data source name, driver class name, etc.

So, looks like a CachedRowSetXImpl or related issue or area I did not change since M10.

M10 build works
Comment 5 _ jimdavidson 2007-08-29 18:10:40 UTC
Using a developer build:

When I opened the project I got a dialog prompting me to install JSF1.1, but nothing about RowSets.
Comment 6 _ potingwu 2007-08-29 18:32:01 UTC
In the project.properties, your attached Creator project has:
    javac.source=${default.javac.source}
    javac.target=${default.javac.target}

That makes your project Source-Level = your NetBeans platform version, usually 1.5 or 1.6.

This feature has been fixed since NetBeans 5.5, it always uses:
    javac.source=1.4 or 1.5 or 1.6
    javac.target=1.4 or 1.5 or 1.6

The workaround is to change them to 1.4 in your project.

I don't know whether there is any auto-resolution for migrating this kind of projects. Petr may have some comment!
Comment 7 _ potingwu 2007-08-29 18:36:48 UTC
BTW, even after the fix, I still see:
SEVERE [global]
java.lang.NullPointerException
	at org.netbeans.modules.visualweb.insync.models.FacesModel.openJavaUnits(FacesModel.java:771)
	at org.netbeans.modules.visualweb.insync.models.FacesModel.syncImpl(FacesModel.java:1023)
	at org.netbeans.modules.visualweb.insync.Model.sync(Model.java:197)
	at org.netbeans.modules.visualweb.insync.models.FacesModelSet.getFacesModel(FacesModelSet.java:507)
	at org.netbeans.modules.visualweb.insync.models.FacesModelSet.getFacesModelIfAvailable(FacesModelSet.java:361)
	at
org.netbeans.modules.visualweb.dataconnectivity.datasource.DataSourceResolver$WaitForModelingListener.modelSetAdded(DataSourceResolver.java:216)
	at org.netbeans.modules.visualweb.insync.ModelSet.fireModelSetAdded(ModelSet.java:152)
	at org.netbeans.modules.visualweb.insync.ModelSet.getInstance(ModelSet.java:249)
	at org.netbeans.modules.visualweb.insync.ModelSet$1.run(ModelSet.java:190)
[catch] at java.lang.Thread.run(Thread.java:619)
Comment 8 _ potingwu 2007-08-29 18:40:48 UTC
Another thought: If the platform is now not 1.4 when you open your project before you change back to 1.4, you should
automatically get rowset package from the JDK. I think missing rowset.jar is not the real cause of this issue. Though we
still need to resolve the old ${default.javac.source} behavior.
Comment 9 _ jimdavidson 2007-08-29 19:10:49 UTC
There's a problem with Datasources.  DesignTimeContext.lookup() can't find a datasource, so things fail.

Working backwards, it looks like DatabaseSettingsImporter.getInstance().getDataSourcesInfo() should be returning some
DataSourceInfo objects, and it is not. 

Still investigating.
Comment 10 John Baker 2007-08-29 19:38:12 UTC
On Aug 14, I had made a change that executes code if the project is a legacy project.
It's possible that the code does not have to be executed for every
legacy project that has dynamic data sources


line 526 of DesignTimeDataSourceHelper

if ((JsfProjectUtils.getProjectVersion(currentProj).equals("2.0") ||
JsfProjectUtils.getProjectVersion(currentProj).equals("3.0")) && dynamicDataSources.length > 0) {
Comment 11 John Baker 2007-08-29 20:09:33 UTC
My last comment was the correct diagnosis

I'll revert back to the change that was working previouslty
Comment 12 John Baker 2007-08-29 20:12:39 UTC

Fixed; Revert back to the implementation that was working previously.

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.18; previous revision: 1.17
done
Comment 13 _ alexpetrov 2007-09-04 15:26:05 UTC
Verified on:

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