title: Enum "does not have a no-arg default constructor" with Jaxb and cxf
body: <p>A client is having an issue running java2ws on some of their code, which uses &amp; extends classes that are consumed from my SOAP web services. Confused yet? :)</p>
  
  <p>I'm exposing a SOAP web service (JBoss5, Java 6). Someone is consuming that web service with Axis1 and creating a jar out of it with the data types and client stubs. They are then defining their own type, which extends one of my types. My type contains an enumeration.</p>
  
  <pre><code>class MyParent {
   private MyEnumType myEnum;
  
   // getters, settters for myEnum;
   }
  
   class TheirChild extends MyParent {
   ...
   }
  </code></pre>
  
  <p>When they are running java2ws on their code (which extends my class), they get </p>
  
  <pre><code>Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions
  net.foo.bar.MyEnuMType does not have a no-arg default constructor.
      this problem is related to the following location:
              at net.foo.bar.MyEnumType
              at public net.foo.bar.MyEnumType net.foo.bar.MyParent.getMyEnum()
  </code></pre>
  
  <p>The enum I've defined is below. This is now how it comes out after being consumed, but it's how I have it defined on the app server:</p>
  
  <pre>
  <code>
  @XmlType(name = "MyEnumType")
  @XmlEnum
  public enum MyEnumType {
  
      Val1("Val1"),
      Val2("Val2")
  
      private final String value;
  
      MyEnumType(String v) {
          value = v;
      }
  
      public String value() {
          return value;
      }
  
      public static MyEnumType fromValue(String v) {
          if (v == null || v.length() == 0) {
              return null;
          }
  
          if (v.equals("Val1")) {
              return MyEnumType.Val1;
          } 
          if (v.equals("Val2")) {
              return MyEnumType.Val2;
          }  
          return null;
      }
  }
  </code>
  </pre>
  
  <p>I've seen things online and other posts, like (<a href="https://stackoverflow.com/questions/298733/java-util-list-is-an-interface-and-jaxb-cant-handle-interfaces">this one</a>) regarding Jaxb's inability to handle Lists or things like that, but I'm baffled about my enum. I'm pretty sure you can't have a default constructor for an enum (well, at least a public no-arg constructor, Java yells at me when I try), so I'm not sure what makes this error possible. Any ideas?</p>
  
  <p>Also, the "2 counts of IllegalAnnotationsExceptions" may be because my code actually has two enums that are written similarly, but I left them out of this example for brevity.</p>