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.
In the "Open Project" dialog, moving to the "Module Project" to open, i got this message in the "Project Name" field on many of my "Platform Modules": Error in project.xml: Invalid content was found starting with element 'class-path-extension'. One of '{".../nb-module-project/3":module-dependencies}' is expected. My project.xml is: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://www.netbeans.org/ns/project/1"> <type>org.netbeans.modules.apisupport.project</type> <configuration> <data xmlns="http://www.netbeans.org/ns/nb-module-project/3"> <code-name-base>org.apache.derby</code-name-base> <suite-component/> <module-dependencies> <dependency> <code-name-base>org.openide.modules</code-name-base> <build-prerequisite/> <compile-dependency/> <run-dependency> <specification-version>7.6</specification-version> </run-dependency> </dependency> <dependency> <code-name-base>org.openide.util</code-name-base> <build-prerequisite/> <compile-dependency/> <run-dependency> <specification-version>7.12.0.1</specification-version> </run-dependency> </dependency> </module-dependencies> <class-path-extension> <runtime-relative-path>ext/derbyLocale_de_DE.jar</runtime-relative-path> <binary-origin>release/modules/ext/derbyLocale_de_DE.jar</binary-origin> </class-path-extension> <class-path-extension> <runtime-relative-path>ext/derby.jar</runtime-relative-path> <binary-origin>release/modules/ext/derby.jar</binary-origin> </class-path-extension> <class-path-extension> <runtime-relative-path>ext/derbyclient.jar</runtime-relative-path> <binary-origin>release/modules/ext/derbyclient.jar</binary-origin> </class-path-extension> <public-packages> <package>org.apache.derby.jdbc</package> </public-packages> </data> </configuration> </project> Opening this module is not possible and the icon before the module directory indicates a normal folder, not a project folder.
Created attachment 67451 [details] project.xml
sorry, in the module, including the project.xml atteched to thie issue, the error is: Error in project.xml: Invalid content was found starting with element 'class-path-extension'. One of '{".../nb-module-project/3":test-dependencies, ".../nb-module-project/3":public-packages, ".../nb-module-project/3":friend-packages}' is expected.
the xml check from netbeans give me a long description of this error: Referenced entity at "nbfs://nbhost/SystemFileSystem/ProjectXMLCatalog/project/1.xsd". Referenced entity at "nbfs://nbhost/SystemFileSystem/ProjectXMLCatalog/nb-module-project/3.xsd". cvc-complex-type.2.4.a: Invalid content was found starting with element 'class-path-extension'. One of '{"http://www.netbeans.org/ns/nb-module-project/3":test-dependencies, "http://www.netbeans.org/ns/nb-module-project/3":public-packages, "http://www.netbeans.org/ns/nb-module-project/3":friend-packages}' is expected. [26] XML validation finished.
ok, i got it. it was because of a wrong sequence of the xml elements. <public-packages> has to be before <class-path-extension> in netbeans 6.1 it was not relevant and my project.xml is generated from the platform itself. here the corrected project.xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://www.netbeans.org/ns/project/1"> <type>org.netbeans.modules.apisupport.project</type> <configuration> <data xmlns="http://www.netbeans.org/ns/nb-module-project/3"> <code-name-base>org.apache.derby</code-name-base> <suite-component/> <module-dependencies> <dependency> <code-name-base>org.openide.modules</code-name-base> <build-prerequisite/> <compile-dependency/> <run-dependency> <specification-version>7.6</specification-version> </run-dependency> </dependency> <dependency> <code-name-base>org.openide.util</code-name-base> <build-prerequisite/> <compile-dependency/> <run-dependency> <specification-version>7.12.0.1</specification-version> </run-dependency> </dependency> </module-dependencies> <public-packages> <package>org.apache.derby.jdbc</package> </public-packages> <class-path-extension> <runtime-relative-path>ext/derbyLocale_de_DE.jar</runtime-relative-path> <binary-origin>release/modules/ext/derbyLocale_de_DE.jar</binary-origin> </class-path-extension> <class-path-extension> <runtime-relative-path>ext/derby.jar</runtime-relative-path> <binary-origin>release/modules/ext/derby.jar</binary-origin> </class-path-extension> <class-path-extension> <runtime-relative-path>ext/derbyclient.jar</runtime-relative-path> <binary-origin>release/modules/ext/derbyclient.jar</binary-origin> </class-path-extension> </data> </configuration> </project>
XML schema validation issue. See issue #142079 for details
I just tried the Library Wrapper Module wizard today with 6.1 and it generated a correct project.xml....?
It is not at all projects. From my module suite with 13 modules, 2 have this problem (Both are library wapper). But there are another 3 library wrapper without it. From other projects, the proportion is identical.
Strange. Were all these lib wrapper modules created at the same time? Using NB 6.1?
The defect modules are some of the oldest ones, created with nb6.1. I had no problems with newly created. i think, they are build with the version of nb6.1. available on march 2008.
It might be possible to internally resort the subelements of <data> before loading so as to make the document valid. I would need to look into how difficult this would be to implement.
Can do something about it.
I have implemented a special phase during project open. If the project.xml is invalid, and one of the following conditions holds: 1. Incrementing the /nnn namespace on <data> (and subelements) makes it valid. (E.g. NBM projects trying to use <test-dependencies> in /2.) 2. The validation message says that an element is unexpected. This element can be found in <data> (as a direct child). Shifting some later elements (starting after any run of other elements with the same unexpected name) to before the unexpected element, keeping their relative order, makes it valid. For example, shifting <public-packages> above the first <class-path-extension> in the example here. then the project is loaded. If project.xml is writable, it is corrected immediately; or if some in-IDE customization writes out a new document, it will be corrected then. I hope that this will take care of most of the cases people have reported of validation errors. It is of course impossible to correct every possible error so I have concentrated on the common cases. It may be possible to retighten some schemas which were previously relaxed to permit out-of-order elements, if all the known problematic documents would fall into case #2. Related bugs: issue #140300: <explicit-platform> in the wrong place; fixed IDE's writing code but maybe didn't help old projects issue #140515: <explicit-platform> in the wrong place; schemas relaxed? issue #142079: same problem as originally reported here; error messages improved issue #142594: /2 vs. /3 for <test-dependencies>; can fix IDE's writing code but would not help old projects (hence #1 above) core-main #5d3d4a15ac2c
I've reverted changes done to workaround issue 140515 but now testing it it does not seem to work properly: my schema says: <xsd:sequence> <xsd:element name="name" type="xsd:token"/> <xsd:element name="minimum-ant-version" minOccurs="0"/> <xsd:element name="explicit-platform" minOccurs="0"/> <xsd:element name="use-manifest" minOccurs="0"/> <xsd:element name="included-library" type="libraryType" minOccurs="0" maxOccurs="unbounded"/> <xsd:element name="web-services" minOccurs="0" maxOccurs="1" type="webServicesType"/> <xsd:element name="web-service-clients" minOccurs="0" maxOccurs="1" type="webServiceClientsType"/> <xsd:element name="source-roots"/> <xsd:element name="test-roots"/> </xsd:sequence> my XML says (<explicit-platform> is in wrong order): <name>EnterpriseApplication3-ejb</name> <minimum-ant-version>1.6.5</minimum-ant-version> <use-manifest/> <explicit-platform explicit-source-supported="true" /> <source-roots> <root id="src.dir" name="Source Packages"/> </source-roots> and in console I get (and project is not opened): Caused: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'explicit-platform'. One of '{"http://www.netbeans.org/ns/j2ee-ejbjarproject/3":included-library, "http://www.netbeans.org/ns/j2ee-ejbjarproject/3":web-services, "http://www.netbeans.org/ns/j2ee-ejbjarproject/3":web-service-clients, "http://www.netbeans.org/ns/j2ee-ejbjarproject/3":source-roots}' is expected. Is this supposed to work or not? (autocorrect() was called.)
This will not currently work, because the use of minOccurs="0" means that the error is detected in <explicit-platform>, whereas really <use-manifest/> is the first element out of order. I guess I will need to try shifting earlier elements down as well as later elements up.
OK, now taking the supposedly misplaced element (or sequence of similar elements), and trying to put it in every position in the list, including the very front and the very end. core-main #9e13cd601cf3
Integrated into 'main-golden', available in build *200808300201* on http://bits.netbeans.org/dev/nightly/ Changeset: http://hg.netbeans.org/main/rev/5d3d4a15ac2c User: Jesse Glick <jglick@netbeans.org> Log: #143966: accept (and correct) certain common validation errors in project.xml when opening projects.
Integrated into 'main-golden', available in build *200808301401* on http://bits.netbeans.org/dev/nightly/ Changeset: http://hg.netbeans.org/main/rev/9e13cd601cf3 User: Jesse Glick <jglick@netbeans.org> Log: Improved algorithm for #143966 (project.xml autocorrection).