Uploaded image for project: 'Axis2'
  1. Axis2
  2. AXIS2-4043

jaxbri does not properly create new instances when using inheritance of abstract elements

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.4
    • None
    • None

    Description

      Summary of WSDL:

      schema a has abstract type "output" and concrete subclass "output-instance".

      schema b imports schema a and references abstract element "output"

      Error:

      Unable to create JAXBContext for class: test.Outputs
      com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
      There's no ObjectFactory with an @XmlElementDecl for the element

      {urn:/test/types}

      output.
      this problem is related to the following location:
      at protected java.util.List test.Outputs.output
      at test.Outputs

      at com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:102)
      at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:438)
      at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:286)
      at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:139)
      at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:117)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:211)
      at javax.xml.bind.ContextFinder.find(ContextFinder.java:372)
      at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574)
      at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:522)
      at test.TestServiceStub.<clinit>(TestServiceStub.java:441)
      at Main.main(Main.java:14)

      The corresponding line in the Stub is:

      jc = javax.xml.bind.JAXBContext.newInstance(test.Outputs.class);

      If this is changed to

      jc = javax.xml.bind.JAXBContext.newInstance(test.Outputs.class, test.types.ObjectFactory.class);

      This exception is no longer thrown, and everything else seems to proceed as usual.

      Attachments

        1. inheritance.wsdl
          3 kB
          Jake Goulding
        2. Main.java
          0.7 kB
          Jake Goulding

        Issue Links

          Activity

            People

              Unassigned Unassigned
              goulding@vivisimo.com Jake Goulding
              Votes:
              2 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: