title: Exception in thread "main" java.lang.NullPointerException when using Jaxb unmarshal/marshal
body: <p>I'm using JAXB to unmarshal a given input Xml file into Java object 
  and then marashal it back to Xml String.
  My Xml file looks like this:</p>
  
  <pre><code>&lt;bpmn2:definitions xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" id="_Definitions_1"&gt;
      &lt;bpmn2:process id="_500441" name="process"&gt;
      &lt;/bpmn2:process&gt;
  &lt;/bpmn2:definitions&gt;
  </code></pre>
  
  <p><strong>Definitions.class:</strong></p>
  
  <pre><code>@XmlRootElement(namespace = "http://www.omg.org/spec/BPMN/20100524/MODEL")
  public class Definitions {
      @XmlAttribute
      private String id;
  
      @XmlElement(name = "bpmn2:process")
      private Process process;
  
      @XmlElement(name = "bpmndi:BPMNDiagram")
      private Diagram diagram;
  
      public Definitions() {
      }
      public Definitions(String id, Process process, Diagram diagram) {
          this.id = id;
          this.process = process;
          this.diagram = diagram;
      }
      public Process getProcess() {
          return process;
      }
      public Diagram getDiagram() {
          return diagram;
      }
      public String getId() {
          return id;
      }
  }
  </code></pre>
  
  <p><strong>Process.class:</strong></p>
  
  <pre><code>@XmlAccessorType(XmlAccessType.FIELD)
  public class Process {
      @XmlAttribute
      private String id;
      public Process() {
      }
      public Process(String id) {
          this.id = id;
      }
      public String getId() {
          return id;
      }
  }
  </code></pre>
  
  <p><strong>Model.class:</strong></p>
  
  <pre><code>public class Model {
      @XmlElement
      private Process process;
      public Model() {
      }
      public Model(String processId, Process p) {
          this.id = processId;
          this.process = p;
      }
  }
  </code></pre>
  
  <p><strong>main method:</strong></p>
  
  <pre><code>public static void main(String[] args) throws IOException, JSONException, JAXBException {
          BpmnToJsonImport bj = new BpmnToJsonImport();
          InputStream is = BpmnToJsonImport.class.getResourceAsStream("myXml.txt");
          String Str = IOUtils.toString(is);
          StringReader sr = new StringReader(Str);
          JAXBContext context = JAXBContext.newInstance(Definitions.class, Model.class);
          Unmarshaller unmarshaller = context.createUnmarshaller();
  
          Definitions d = (Definitions) unmarshaller.unmarshal(sr);
          Model model = new Model(d.getProcess().getId(), d.getProcess());
  
          StringWriter sw = new StringWriter();
  
          Marshaller marshaller = context.createMarshaller();
          marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
          marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
          marshaller.marshal(model, sw);
          String str = sw.toString();
          System.out.println(str);
  
      }
  </code></pre>
  
  <p>Exactly when it tries to retrieve the process id using d.getProcess.getId I get the 
   <strong>java.lang.NullPointerException</strong></p>