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 268010

Summary: NullPointerException at<init>
Product: xml Reporter: alibaba88
Component: JAXBAssignee: Svata Dedic <sdedic>
Status: NEW ---    
Severity: normal CC: alibaba88
Priority: P3    
Version: 8.1   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter: 226221
Attachments: stacktrace

Description alibaba88 2016-09-14 06:46:08 UTC
Build: NetBeans IDE 8.1 (Build 201510222201)
VM: Java HotSpot(TM) 64-Bit Server VM, 25.66-b18, Java(TM) SE Runtime Environment, 1.8.0_66-b18
OS: Windows 7

User Comments:
alibaba88: This happened at start of NetBeans after I yesterday tried a number of times to make a JAXB binding where I pointed out the xsd file on local filesystem. I've tried to do this at least 10 times however NetBeans/JAXB get an error "grammer missing" each time.

I've separated the NetBeans project in one folder and all the sources in another to make it possible to use different IDE's on the same source code. The JAXB compiler cannot find the xsd file pointed out, even though it was pointed out with the file browser dialog prompted in NetBeans. I tried to copy the xsd file to a subdirectory in the NetBeans project folder, but that gives the same error.

I have another testproject where the source folder and the Netbean project folder resides together and there the JAXB binding wizard manages to find the xsd file and to generate sources according to the xsd pointed out on disk.

   at org.netbeans.modules.xml.jaxb.ui.JAXBWizardSchemaNode$JAXBWizardSchemaNodeChildren.createNodes(
   at org.openide.nodes.Children$Keys$KE.nodes(
   at org.openide.nodes.ChildrenArray.nodesFor(
   at org.openide.nodes.EntrySupportDefault$Info.nodes(
   at org.openide.nodes.EntrySupportDefault.justComputeNodes(
Comment 1 alibaba88 2016-09-14 06:46:10 UTC
Created attachment 162042 [details]
Comment 2 alibaba88 2016-09-14 13:31:03 UTC
I now also tried using the JAXB wizard pointing out the xsd file via a url path. It gives the exact same error.
The error occurs immidiately after clicking "finish" in the JABXB wizard.
Then its impossible to change the filepath using the wizard, it ignores all changes when clicking finish.

I also cleared all changes and opened the project in NetBeans 8.02 and tried to create the JAXB binding there which gave exactly the same error.

When selecting "Regenerate java code" on the "JAXB Bindings" in the ide, the log says:
ant -f C:\\Users\\andlil\\Desktop\\DeskDocs\\NetBeansProjects\\eCommerceWSProxyTop\\eCommerceWSProxyNB jaxb-code-generation
failure in the XJC task. Use the Ant -verbose switch for more details
C:\Users\andlil\Desktop\DeskDocs\NetBeansProjects\eCommerceWSProxyTop\eCommerceWSProxyNB\nbproject\xml_binding_build.xml:15: grammar is not specified
BUILD FAILED (total time: 0 seconds)

It creates the \conf\xml-resources\jaxb... directory and xsd file in the folder where the source code is placed, in this case xxx\NetBeansProjects\eCommerceWSProxyTop\eCommerceWSProxy\conf\xml-resources\jaxb
and the sources are placed on xxx\NetBeansProjects\eCommerceWSProxyTop\eCommerceWSProxy\src
but it seems to be assuming that the directory is on same parent directory as the build directory.

The NetBeans project directory (where the build folder resides) is placed on this path (they share the same parentfolder):

So I can't produce a JAXB binding at all, I've tried all variations I could see.
Comment 3 alibaba88 2016-09-15 08:09:03 UTC
In the generated file xml_binding_build.xml

within the target:
    <target name="jaxb-code-generation" depends="xjc-typedef-target,-do-init,-init-macrodef-javac">

    the schema tag is generated empty
    <schema file=""/>

    if I edit the build file and replaces that with
    <schema file="../eCommerceWSProxy/conf/xml-resources/jaxb/StoreInformation/storeInformation.xsd"/>

    the "Regenerate Java Code" on the on the JAXB binding in the GUI works and generates code.

    However this is a generated build file that shouldn't be edited since it may be overwritten.
    The JAXB wizard still refuses any changes done using "Change JAXB option" on the JAXB binding in the GUI.
    So the JAXB wizard doesn't misbehave when the sources folder is placed on another parent folder then where the build folder resides(project folder), and it fails to set where the schema file resides when it generates the xml_binding_build.xml
Comment 4 alibaba88 2017-06-14 07:28:58 UTC
I now also installed NetBeans 8.2 and the exact same defect remains.
When the sourcefolder is separated to a parallell directory outside the NetBeans project folder the JAXB wizard to configure a new XML binding doesn't work at all.
After assigning a Binding name, a package name and pointing out a xsd schema file on my local disk the Configure XML binding just blinks when pressing Finish button and nothing happens. The dialog stays open and no bindings whatsoever is created.

In order to keep the NetBeans project files apart from the application source files it must be a common way to place the source directory outside the project folder, and everything else in NetBeans works ok with that setup.
The JAXB wizard needs to be fixed to support that.