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 161340

Summary: Database application (Master/Detail Form) created with errors
Product: platform Reporter: pribyl <pribyl>
Component: FilesystemsAssignee: Jiri Skrivanek <jskrivanek>
Status: VERIFIED FIXED    
Severity: blocker CC: blaha, jstola, jtulach, mmirilovic, pjiricka, tmysik, tpavek
Priority: P1 Keywords: REGRESSION
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: Messages log
Warning message in the IDE
Previous image with correct format (sorry)

Description pribyl 2009-03-27 11:59:09 UTC
Product Version: NetBeans IDE Dev (Build 200903261933)
Java: 1.6.0_13; Java HotSpot(TM) Client VM 11.3-b02
System: Windows XP version 5.1 running on x86; Cp1250; cs_CZ (nb)

-When creating new Database desktop application, the form is created with errors, and opens with "Form Loaded With
Errors" Warning.
-The same problem occurs when creating first M/D Form in any Java project
-Any subsequent M/D form is created successfully 

I tried this in WinXP and Ubuntu, with sample Derby DB and with MySQL - reproducible in all cases.

In messages.log (attached) many exceptions can be seen. 
The ergonomics cluster was ENABLED (I will try this with disabled too).
Comment 1 pribyl 2009-03-27 11:59:40 UTC
Created attachment 78966 [details]
Messages log
Comment 2 pribyl 2009-03-27 12:01:40 UTC
Created attachment 78967 [details]
Warning message in the IDE
Comment 3 pribyl 2009-03-27 12:09:10 UTC
Created attachment 78970 [details]
Previous image with correct format (sorry)
Comment 4 Jan Stola 2009-03-27 18:21:52 UTC
The root exception is

org.netbeans.modules.j2ee.persistence.provider.InvalidPersistenceXmlException
[path: C:\Documents and Settings\pavel\My Documents\NetBeansProjects\DesktopApplication7\src\META-INF\persistence.xml]
	at org.netbeans.modules.j2ee.persistence.provider.ProviderUtil.getPUDataObject(ProviderUtil.java:552)
	at org.netbeans.modules.j2ee.persistence.provider.ProviderUtil.getPUDataObject(ProviderUtil.java:585)
	at org.netbeans.modules.form.j2ee.J2EEUtils.getPersistenceXML(J2EEUtils.java:341)
[catch] at org.netbeans.modules.form.j2ee.wizard.MasterDetailWizard.instantiatePersitence(MasterDetailWizard.java:407)
	at org.netbeans.modules.form.j2ee.wizard.MasterDetailWizard.instantiate(MasterDetailWizard.java:340)
        ...

and the corresponding code from ProviderUtil.getPUDataObject()

        DataObject dataObject = null;
        try {
            dataObject = DataObject.find(fo);
        } catch (DataObjectNotFoundException ex) {
            Exceptions.printStackTrace(ex);
        }
        if (!(dataObject instanceof PUDataObject)){
            throw new InvalidPersistenceXmlException(FileUtil.getFileDisplayName(fo));
        }

e.g. the DataObject that corresponds to persistence.xml is not PUDataObject, but XMLDataObject.

It seems to be some internal problem of j2ee/persistence or some clash of j2ee/persistence and xml => reassigning to 
j2ee/persistence for evaluation.
Comment 5 Petr Jiricka 2009-03-30 12:59:35 UTC
Tomas M will help with this - thanks.

I can reproduce, and yes, persistence.xml is of type org.netbeans.modules.xml.XMLDataObject. However, after the wizard
completes when I open persistence.xml, it uses the specific multiview editor for persistence.xml, so it looks like at
that point it's a PUDataObject. Strange.

BTW, this problem is not reproducible when using the Entity Classes from Database wizard in a regular JavaSE project.
Comment 6 Petr Jiricka 2009-03-30 15:26:06 UTC
There have been no changes in this area recently, so I have no idea when and how this broke. Any ideas when this stopped
working?
Comment 7 Petr Jiricka 2009-03-30 15:38:11 UTC
This works for me correctly in build from March 17, so this is a recent regression. 
Comment 8 Marian Mirilovic 2009-03-31 11:30:51 UTC
Petr/Tomas, 
this issue is last stopper for M3. Any estimation when it could be fixed ? Thanks in advance.
Comment 9 Tomas Mysik 2009-03-31 12:27:57 UTC
I'm able to reproduce but only for the first time, once the project is created, it works for me.

Jardo, please, do you have any idea why I'm not able to get correct DataObject for persistence.xml file? I get XmlDataObject instead of
PUDataObject. As Petr wrote, there were no changes in the Persistence module itself and we are not able to reproduce with older build
(and I noticed that you made some changes in Lookup and data systems recently).

Thanks for any help/ideas.
Comment 10 Jan Stola 2009-03-31 14:25:23 UTC
> -The same problem occurs when creating first M/D Form in any Java project
> -Any subsequent M/D form is created successfully 
>
> I'm able to reproduce but only for the first time, once the project is created, it works for me.

It seems to happen every time the persistence.xml file is created e.g. if you delete this file after the first attempt 
then you will be able to reproduce the mentioned exception again.
Comment 11 Tomas Mysik 2009-03-31 14:44:53 UTC
Problem seems to be in FileSystems, in caching incorrect MIME type.
Comment 12 Jiri Skrivanek 2009-03-31 16:04:44 UTC
Fixed - http://hg.netbeans.org/core-main/rev/816ec416bbcc. I tried to create desktop DB application and it worked. I
will merge it to M3 clone.
Comment 13 Petr Jiricka 2009-03-31 16:22:55 UTC
Thanks many times!
Comment 14 Jaroslav Tulach 2009-03-31 17:35:22 UTC
The fix looks good. Btw. to simplify transfer to M3 clone, it is good to first update to release67_m3_base and then 
commit the fix. More info at: http://wiki.netbeans.org/HgHowTos#section-HgHowTos-GettingReadyForWorkWithClones
Comment 15 Jiri Skrivanek 2009-03-31 18:19:31 UTC
Transplanted into M3 (original log accidentally lost). Previously I forgot to thank to Tomas Mysik for precise evaluation.
http://hg.netbeans.org/release67_m3/rev/40a8ebbed5d3
Comment 16 pribyl 2009-04-01 10:19:30 UTC
Product Version: NetBeans IDE Dev (Build 200904010000)
Java: 1.6.0_13; Java HotSpot(TM) Client VM 11.3-b02
(WinXP and Ubuntu)

Verified. Master/Deatail form created successfully.

Comment 17 Quality Engineering 2009-04-02 07:35:30 UTC
Integrated into 'main-golden', will be available in build *200904020200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/816ec416bbcc
User: Jiri Skrivanek <jskrivanek@netbeans.org>
Log: #161340 - Do not cache any fallback MIME type.