title: ClassNotFound exception in enums in dynamic moxy
body: <p>I am using EclipseLink dynamic moxy for jaxb. When I try to set an enum value, I get a ClassNotFound exception. Can anyone point out what I am doing wrong?</p>
  
  <p>Schema:
          
  </p>
  
  <pre><code>&lt;xs:element name="customer" type="customerType"&gt; &lt;/xs:element&gt;
  
   &lt;xs:complexType name="customerType"&gt;
      &lt;xs:sequence&gt;
          &lt;xs:element name="number" type="numberEnum"/&gt;
          &lt;xs:element name="name" type="xs:string"/&gt;
      &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  
  &lt;xs:simpleType name="numberEnum"&gt;
      &lt;xs:restriction base="xs:string"&gt;
          &lt;xs:enumeration value="1"/&gt;
          &lt;xs:enumeration value="2"/&gt;
          &lt;xs:enumeration value="3"/&gt;
      &lt;/xs:restriction&gt;
  &lt;/xs:simpleType&gt;
  </code></pre>
  
  <p> </p>
  
  <p>Java code:</p>
  
  <pre><code>    package uic;
  
  import java.io.File;
  import java.io.FileInputStream;
  import java.io.FileNotFoundException;
  
  import javax.xml.bind.JAXBException;
  
  import org.eclipse.persistence.dynamic.DynamicEntity;
  import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext;
  import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContextFactory;
  
  public class test{
  
  DynamicJAXBContext context;
  
  test() {
      try{
          context = DynamicJAXBContextFactory.createContextFromXSD(new FileInputStream(new File("sample/NewXMLSchema1.xsd")), null, null, null);
      } catch(JAXBException e) {
          e.printStackTrace();
      } catch(FileNotFoundException e){
          e.printStackTrace();
      }
  
      DynamicEntity root = context.newDynamicEntity("CustomerType");
  
      root.set("name", "tom");
  
      Object enumValue = null;
      try {
          enumValue = context.getEnumConstant("uic.NumberEnum", "2");
      } catch (ClassNotFoundException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      } catch (JAXBException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
      root.set("Number", enumValue);
  }
  
  public static void main(String args[]) {
      new test();
  }
  }
  </code></pre>
  
  <p>Am i going wrong when I create the context using createContextFromXSD()? I followed this example: <a href="https://stackoverflow.com/questions/5181374/eclipselink-dynamic-moxy-accessing-enum-values/5183847#5183847">EclipseLink dynamic MOXy accessing enum values</a></p>
  
  <p>I don't have a problem when I am accessing other JAXB generated classes. The problem is only for the enum classes. Are they placed in a different package from the other generated classes or something?</p>
  
  <p>Edit: In the main program, I receive an xml schema file as the input. I use an xsom parser to retrieve the element and type declarations, and then marshal using JAXB generated classes, to get the output, an XML file. So, any changes I need to do to the schema will have to be done dynamically.</p>
  
  <p>Thanks.</p>