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 120251 - Loss of data: PropertyNotFoundException when opening page with db down
Summary: Loss of data: PropertyNotFoundException when opening page with db down
Status: VERIFIED FIXED
Alias: None
Product: obsolete
Classification: Unclassified
Component: visualweb (show other bugs)
Version: 6.x
Hardware: All All
: P1 blocker (vote)
Assignee: _ deva
URL:
Keywords:
: 119098 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-10-27 08:21 UTC by John Baker
Modified: 2007-11-21 17:37 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
log file (43.65 KB, text/plain)
2007-10-27 08:24 UTC, John Baker
Details
stacktrace (3.07 KB, text/plain)
2007-11-21 13:26 UTC, javydreamercsw
Details
messages.log (40.44 KB, text/plain)
2007-11-21 16:22 UTC, _ alexpetrov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description John Baker 2007-10-27 08:21:36 UTC
DnD textfield
DnD PERSON table to SessionBean1 in the Navigator
For the textfield, bind to data to a column of the person dataprovider
Disconnect Travel
Close project
Reopen project

Page opens with Component error.
Try reconnecting Travel
Refresh page
Binding lost and can't be restored
Comment 1 John Baker 2007-10-27 08:22:58 UTC
Product Version: NetBeans IDE Dev (Build 200710231200)
Java: 1.6.0_03; Java HotSpot(TM) Client VM 1.6.0_03-b05
System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)
Userdir: C:\Documents and Settings\Owner\.netbeans\dev
Comment 2 John Baker 2007-10-27 08:24:26 UTC
Created attachment 51829 [details]
log file
Comment 3 John Baker 2007-10-28 02:57:39 UTC
An instance of CachedRowSetDataProvider is created with a null CachedRowSet
Need to find out how/why this happening
Comment 4 John Baker 2007-10-28 03:07:21 UTC
Correction, a CachedRowSetXImpl does not get loaded when the project opens

David, any ideas?
Comment 5 John Baker 2007-10-28 03:16:48 UTC
When the DataProviderELResolver tries to retrieve the field keys from the CachedRowSetDataProvider, there are no fieldkeys
found because this instance of CachedRowSetDataProvider was instantiated with a null CachedRowSetXImpl

Comment 6 John Baker 2007-10-28 03:46:56 UTC
It appears that the reason why the CachedRowSetXImpl is null is that there are no data sources found in the project.

Setting a breakpoint on line 352 of ProjectDataSourceTracker and watching the local variable, newValue (the data source
value), each time ModelSet fires an event, newValue always evaluates to an empty string.  

For projects where the data provider is in the Page Bean newValue gets set to the data source

I think this is a bug in insync in that a project with a data provider in the Session Bean, not the Page bean, the
SessionBean doesn't get modeled properly.
Comment 7 John Baker 2007-10-28 07:25:39 UTC
the comment desc7 was incorrect.

instead, in insync, LiveUnit instantiates the CachedRowSetDataProvider  using
sourceUnit.instantiateBean(beanClass);

After instantiating, the SLR instance of slparent is null.

Compared to the CRSDP is created in the Page bean, SLR instance is instead an instance of UIViewRoot

This still looks like an insync issue, but I won't reassign until I'm sure
Comment 8 Winston Prakash 2007-10-28 19:06:14 UTC
Just a info. The backing bean (Page) is associated with JSF component hierarchy.
So the Source Live Root(SLR) is an instance of UIViewRoot. However, Session Bean is
not a backing bean. So it may not have UIViewRoot as SLR.  

I really don't know what is happening here. But, keep in mind there are two EL resolving
happening here

1. Resolving dataprovider itself from the component binding
   (This seems to work fine)
2. Resolving the CachedRowset binding set to the dataprovider in the SessionBean _init() method.
   (not sure if this resolving happens correctly)

Did you check if the second binding got resolved correctly?
Comment 9 John Baker 2007-10-28 22:46:39 UTC
some findings:

Scenario 1
  DnD a database table onto the page
Result: CachedRowSetXImpl5 is instantiated

Scenario 2 
  DnD a database table onto SessionBean1 in the Navigator
Result: CachedRowSetXImpl5 is not instantiated
Comment 10 John Baker 2007-10-29 01:01:49 UTC
For the scenario where the CRSDP is created in the SessionBean,  DataProviderELResolver getValue method receives a base
instance with a property, cachedRowSet that is null

Compared to CRSDP in the Page Bean, the cachedRowSet property is an instance of CachedRowSet

...



Comment 11 Winston Prakash 2007-10-29 01:15:55 UTC
This issue is happening exactly the same reason why  http://www.netbeans.org/issues/show_bug.cgi?id=119919 is happening
which I explained in that issue.

Follow Johns steps and reproduce the issue.  After refreshing the page, CachedrowsetDataprovider fails to get the filed
keys.
- Now open the session bean and modify anything (just add some space somewhere) and save it. 
- Refresh Page1 and now the page will render correctly.
 
What happens is, insync remodels the page (as it was changed) and resets the CahedRowset to the CachedrowsetDataprovider. 

Since similar to issue #119919, the cachedrowset properties already set (during previous modeling of SessionBean), now
CahcedRowsetDataprovider behaves correctly and fieldkeys are obtained. 

Note that you can expect that similar to #119919 you could set cachedrowset to the CahcedRowsetDataprovider after
setting the properties to cachedrowset and then close and open the project (after disconnecting) would work. But it will
not. You have to modify the SessionBean for insync to remodel and reset the CahcedRowsetDataprovider. The reason is
Cachedrowset does not reset itself after the connection is modified.

This exactly the scenario what I put when John and David fixed the bug #119529. This is the comment I put

I believe John's concern is - will the "executed" flag will be correctly reset to false, 
if some programmatic change happens to the underlying cachedRowset or some user action 
happens in the designer.

For example, if in the Session Bean user re-sets the cahcedRowset "command" property,
now the fetched infomation in the CachedRowset is invalid. Dataprovider might receive 
an event that the underlying CachedRowset has changed. In that case the "executed" flag 
should be reset to false, so that next request for info will fetch the info corresponding
to the new "command".

Another scenario is, user might refresh the designer which in turn calls the CachedRowsetDataprovider.refresh().
In this case also, I think, "executed" must be reset to false, so that fresh information will be fetched from 
database in the next request.

 
Comment 12 John Baker 2007-10-29 01:56:35 UTC
 I think it's a class loading issue.  In the original order, CachedRowSet is null.
So, if there's no CachedRowSet available then it can't be executed 

It seems to me an issue in JSF or insync
Comment 13 John Baker 2007-10-29 02:20:17 UTC
As a test, I added a refresh() to the CRSDP in setCachedRowSet(...) but still get the PropertyNotFoundException
Comment 14 John Baker 2007-10-29 02:24:18 UTC
It turns out that setCachedRowSet isn't invoked at design-time

Also, when the CRSDP is used at design-time, as in getFieldKeys(...), getCachedRowSet() returns null as I explained earlier
Comment 15 John Baker 2007-10-29 02:32:05 UTC
or some reason the CRSDP is instantiated when the order of operations in SessionBean1._init() are such that the
CachedRowSet gets initialized after the rowset instead of before

        hotelRowSet.setDataSourceName("java:comp/env/jdbc/TRAVEL_ApacheDerby");
        hotelRowSet.setCommand("SELECT * FROM TRAVEL.HOTEL");
        hotelRowSet.setTableName("HOTEL");
        hotelDataProvider.setCachedRowSet((javax.sql.rowset.CachedRowSet) getValue("#{SessionBean1.hotelRowSet}"));

In this order the property binding works. 

This is the same order as when the CRSDP is created in the Page bean since the SessionBean is modeled first the order
these statements are executed in the same order.



Comment 16 John Baker 2007-10-29 02:33:23 UTC
There could still be a problem with the way the rowset is created in CachedRowSetXImpl5 ...
Comment 17 Winston Prakash 2007-10-29 03:52:30 UTC
Another thing I noticed in the following order

hotelDataProvider.setCachedRowSet((javax.sql.rowset.CachedRowSet) getValue("#{SessionBean1.hotelRowSet}"));
hotelRowSet.setCommand("SELECT * FROM TRAVEL.HOTEL");

In the above order, setCommand() seems to call release() which in turn calls initContainer()
This resets the rowsetMetadata.
    
I'm not sure if this resets any initialization set by  setCachedRowSet() by the dataprovider.

Comment 18 John Baker 2007-10-29 07:20:27 UTC
*** Issue 119098 has been marked as a duplicate of this issue. ***
Comment 19 John Baker 2007-10-29 07:28:38 UTC
from desc 18 : "setCommand() seems to call release() which in turn calls initContainer()
This resets the rowsetMetadata."

No, doesn't seem to reset initialization.

At least at design-time, there seems to be a problem with instantiating CachedRowSetXImpl5 through
resurrectDesignBean(...) in LiveUnit, but I can't be sure - there's lots of class loading going on here.
The reason being that just prior to setCachedRowSet the bean classes get loaded.  Once inside setCachedRowSet, the
cachedRowSet passed in is null.

I'll need to ask the insync team about this
Comment 20 John Baker 2007-10-30 00:14:18 UTC
Turns out order of statements generated in SessionBean1.

In NetBeans 5.5 the order in SessionBean1._init() is

 personRowSet.setDataSourceName("java:comp/env/jdbc/TravelPack");
        personRowSet.setCommand("SELECT * FROM TRAVEL.PERSON");
        personRowSet.setTableName("PERSON");
        personDataProvider.setCachedRowSet((javax.sql.rowset.CachedRowSet)getValue("#{SessionBean1.personRowSet}"));


In 6.0 the order is
        personDataProvider.setCachedRowSet((javax.sql.rowset.CachedRowSet)getValue("#{SessionBean1.personRowSet}"));
        personRowSet.setDataSourceName("java:comp/env/jdbc/TravelPack");
        personRowSet.setCommand("SELECT * FROM TRAVEL.PERSON");
        personRowSet.setTableName("PERSON");


Comment 21 John Baker 2007-10-30 00:17:12 UTC
*** Issue 119919 has been marked as a duplicate of this issue. ***
Comment 22 _ deva 2007-10-30 16:22:34 UTC
I see two issues
1) During design time initialization of dataprovider after initializing rowset is not making any difference, the value 
binding expression resolver returns null when the project is opened. However if we force the re-modeling of sessionbean
and go back to designer, the page looks fine.
2) Runtime seems to require rowset to be initialized before initializing dataprovider

Winston and David think the ordering of property set statement should not matter. So requires more debugging and 
analysis
Comment 23 _ deva 2007-11-01 00:09:28 UTC
The run time issue has been addressed by #119919

The design time issue is due to EL expression resolution failing when it is trigerred by an evaluation of another EL 
expression where-in the first part of the expressions are same for both. 

For example: If a text field in Page1.jsp is bound to
a dataprovider in sessionbean via a VB expression like #{SessionBean1.dataprovider.VALUE['PERSON.NAME']}, while 
evaluating this expression, SessionBean1 needs to be modeled, which requires evaluation of another VB expression #
{SessionBean1.rowset}. The later evaluation returns null and therefore we get property not found exception.

Invoking the evaluation immediately after failure does give correct results. For now we are using this
workaround.
Comment 24 _ krystyna 2007-11-01 01:31:04 UTC
Verified the pre-integration jar on 
 NetBeans IDE Dev (Build 200710311411)
Java: 1.6.0_03; Java HotSpot(TM) Client VM 1.6.0_03-b02
System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)
Comment 25 javydreamercsw 2007-11-21 13:26:39 UTC
Build: NetBeans IDE 6.0 RC1 (Build 200711131200)
VM: Java HotSpot(TM) Client VM, 1.6.0_03-b05
OS: Windows 2000, 5.0, x86

User Comments: 
Comment 26 javydreamercsw 2007-11-21 13:26:44 UTC
Created attachment 53298 [details]
stacktrace
Comment 27 _ krystyna 2007-11-21 14:17:50 UTC
javydreamercsw, the exception you have just  reported and have appended is not the same 
as this original bug. can you open a new issue including some comments. thanks. 
Comment 28 _ alexpetrov 2007-11-21 14:24:21 UTC
Guys, please, don't hurry!
I'm testing this issue and I can't reproduce this bug on RC2 200711201000...
Give me more time...
Comment 29 _ alexpetrov 2007-11-21 16:21:24 UTC
I tried to reproduce the original scenario several times on:

Product Version: NetBeans IDE 6.0 RC2 (Build 200711201000)
Java: 1.6.0_03; Java HotSpot(TM) Client VM 1.6.0_03-b02
System: Windows XP version 5.1 running on x86

It works for me. 

Though sometimes (twice) the exception 
"java.lang.RuntimeException: CommonDDAccess.addBean unexpected exception"
appeared in the "messages.log" (see the last attached file "messages.log").
Then in the dialog "Bind to Data" the item "personDataProvider" was red 
in the DropDownList "Choose a Data Provider", but in several seconds it became black.
Comment 30 _ alexpetrov 2007-11-21 16:22:22 UTC
Created attachment 53317 [details]
messages.log