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 130231 - Design-time completely breaks on binding to classes declared in external projects/jars
Summary: Design-time completely breaks on binding to classes declared in external proj...
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:
: 104977 129730 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-03-15 22:06 UTC by bikestain
Modified: 2008-04-03 22:41 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description bikestain 2008-03-15 22:06:31 UTC
Thank you for fixing quickly the Issue 128647.
Here is another bug that prevents us from running our existing 6.01 projects in the 6.1 release.
I am setting this bug a high priority because it is regression and it is a very common case scenario for Hibernate users.

Steps to reproduce:
1. Start from create a new Java Library project TestLibrary
2. Add a new class test.TestModel to TestLibrary
3. Add a property to the TestModel:
    private String name = "My Test Model";
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
4. Create a new VWP application (WebApplicationTest)
5. Go to the WebApplicationTest's properties | Libraries
6. Add the project TestLibrary (dist/TestLibrary.jar appears among the compile-time libs)
7. Add a property into Page1.java:
    TestModel currentModel = new TestModel();
    public TestModel getCurrentModel() {
        return currentModel;
    }
    public void setCurrentModel(TestModel currentModel) {
        this.currentModel = currentModel;
    }
8. Fix imports and build
9. Drop new static text component staticText1
10. Try to bind staticText1 to the Page1.currentModel, you will NOT see currentModel property in the binding dialog as
you would expect!
11. Now manually bind staticText1 in the JSP view:

<webuijsf:staticText id="staticText1" text="#{Page1.currentModel.name}"/>

12. Go back to the design view and you will get the exception:

javax.faces.FacesException: javax.el.ELException: javax.faces.el.EvaluationException: javax.el.ELException:
javax.faces.el.PropertyNotFoundException: currentModel
 
13. Now try to build and launch the webapp. You will see it is perfectly working in runtime displaying a page with a
static text "My Test Model"

Other test cases for this bug:
List<TestModel> or TestModel[] properties are not visible in the Data binding dialog when you try to bind data to a UI
table.
Comment 1 Winston Prakash 2008-03-16 00:02:19 UTC
Did you compile and refresh the page?. I'll try to  reproduce this on Monday.
Comment 2 bikestain 2008-03-16 01:11:00 UTC
Yes, indeed. 
Compiled, refreshed, closed/reopened project, restarted ide. Tried that all.
Comment 3 _ krystyna 2008-03-17 22:16:51 UTC
Reproduced with NetBeans IDE Dev (Build 20080317180120 - hudson trunk 1136):
currentModel property does not appear under Page1 from Bind to Data dialog
as it does in 6.0.1. What's more, also don't see Application,Request,SessionBean in
the Bind to Data, Bind to Object dialog as we used to see in 6.0.1.
Comment 4 _ krystyna 2008-03-18 01:29:23 UTC
I think this is same issue, I just discovered our "Travel Center" sample app has the same 
designtime component error with javax.faces.FacesException: javax.el.ELException: 
javax.faces.el.PropertyNotFoundException: javax.el.PropertyNotFoundException: 
java.lang.NullPointerException yet runtime works.
Comment 5 Winston Prakash 2008-03-18 22:02:31 UTC
Accepted. I'm able to reproduce this. The problem seem to be introduced by one of the performance enhancement. The
performance enhancement restricts the beaninfo search to restricted ClassLoader to avoid extensive search. Looks like
the Archive Library references (in this case <project>/dist/projectlib.jar) added to the project is not included in the
restricted classLoader. I verified this by dumping the ClassLoader using debugger. The dump did contain these jars.
Assigning to insync experts for further evaluation.
Comment 6 bikestain 2008-03-18 22:38:25 UTC
I believe that not allowing to search classes for binding externally is a step in wrong direction.
More graceful workaround would be using some sort of lazy bean browser.
The binding dialog should display initially only top-level beans in collapsed state.
Only when the user expands a node, actual introspection should take place (and only one level deep at a time).
That fix would make the binding dialog instantaneous without having to restrict class loader.
Comment 7 Winston Prakash 2008-03-21 16:03:20 UTC
*** Issue 104977 has been marked as a duplicate of this issue. ***
Comment 8 _ deva 2008-03-21 22:13:54 UTC
Winston's observation is correct. This issue is introduced because of #123532

We cannot obtain the list of archive references for a given project, therefore it is not possible to append the 
required libraries to the classpath. Therfore, we are thinking of a different strategy where-in, we will start with 
project's compile time classpath and remove the unnecessary libraries(for example: appserver libraries). There seems 
to be no good way to obtain the list of appserver libraries. We are talking to experts in projects area to resolve 
this issue quickly. 
Comment 9 Winston Prakash 2008-03-21 23:46:57 UTC
*** Issue 129730 has been marked as a duplicate of this issue. ***
Comment 10 _ deva 2008-03-27 01:28:44 UTC
classpath for project's design time classloader is computed as follows - check if classpath/packaged classpath is 
provided for the project(It is already available for maven project), if found use it, otherwise get the 
classpath/compile classpath and remove the app server jars for design time performance reasons.
Comment 11 _ krystyna 2008-04-03 22:41:55 UTC
Verified in 6.1
NetBeans IDE Dev (Build 200804030815)
Java: 1.6.0_04; Java HotSpot(TM) Client VM 10.0-b19
System: Windows XP version 5.1