title: How to get output in JAXB (marshaling)?
body: <p>I tried hello world example from <a href="http://jaxb.java.net/tutorial/section_1_3-Hello-World.html#Hello%20World" rel="nofollow">here</a> and I can't see any output in my program (in console when using "java" command). Is it something wrong I do? The code of marshal function looks like this:</p>
  
  <pre><code>public void marshal() {
      try {
          JAXBElement&lt;GreetingListType&gt; gl =
              of.createGreetings( grList );
          JAXBContext jc = JAXBContext.newInstance( "hello" );
          Marshaller m = jc.createMarshaller();
          m.marshal( gl, System.out );
      } catch( JAXBException jbe ){
          // ...
      }
  }
  </code></pre>
  
  <p>I tried also tried to put output into a file like this:</p>
  
  <pre><code>public void marshal() {
      try {
          JAXBElement&lt;GreetingListType&gt; gl =
              of.createGreetings( grList );
          JAXBContext jc = JAXBContext.newInstance( "hello" );
          FileOutputStream fos = new FileOutputStream("plik.xml");
          Marshaller m = jc.createMarshaller();
          //m.marshal( gl, System.out );
          m.marshal(gl, fos);
          fos.close();
      } catch( JAXBException jbe ){
          // ...
      }
    catch( IOException ioe ){
      // ...
  }
  }
  </code></pre>
  
  <p>but it didn't work out. Have you got any solutions?</p>
  
  <p>EDIT: After printing Stack Trace it gave me this, looks promising:</p>
  
  <pre><code>javax.xml.bind.JAXBException: "hello" doesnt contain ObjectFactory.class or jaxb.index
      at com.sun.xml.internal.bind.v2.ContextFactory.createContext(ContextFactory.java:186)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:616)
      at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:148)
      at javax.xml.bind.ContextFinder.find(ContextFinder.java:310)
      at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:392)
      at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:357)
      at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:264)
      at Hello.marshal(Hello.java:28)
      at Hello.main(Hello.java:43)
  </code></pre>
  
  <p>I do have ObjectFactory but don't know anything about jaxb.index. Is it necessary? How it should look like?</p>