Uploaded image for project: 'JBoss OSGi'
  1. JBoss OSGi
  2. JBOSGI-765

HostBundleClassLoader silently deletes JAXB annotations from Class if package not imported

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Minor
    • Resolution: Won't Fix
    • Affects Version/s: JBossOSGi 2.2.0
    • Fix Version/s: JBossOSGI 2.3.1
    • Component/s: framework
    • Labels:
      None
    • Environment:

      WildFly 8.1.0.Final

    • Workaround:
      Workaround Exists
    • Workaround Description:
      Hide

      Add the following to the Manifest:

      Import-Package: javax.xml.bind.annotations

      Show
      Add the following to the Manifest: Import-Package: javax.xml.bind.annotations

      Description

      Whenever an OSGI bundle contains JAXB-annotated classes, and Manifest of that bundle does not contain "Import-Package: javax.xml.bind.annotation" such bundle will be:

      1) Successfully installed
      2) Successfully activated
      3) All classes within said bundle will be properly loaded
      4) X.class.getDeclaredAnnotations() will return empty array if the only annotations on the class X are the annotations that reside in javax.xml.bind.annotation.

      No "NoClassDefFoundError" or "ClassNotFoundException" are ever thrown, no errors are logged. However, due to declared annotations not being present during class introspection, if such class X is used in with RESTEasy the following exception is thrown by the rest service:

      org.jboss.resteasy.core.NoMessageBodyWriterFoundFailure: Could not find MessageBodyWriter for response object of type: java.util.ArrayList of media type: application/xml

      if the return type of REST API call is List<X>.

      While workaround is quite simple (below), the concern is that such hidden behavior may result in other spurious failures of unknown origin in JAXB and elsewhere, since no indication that bundle resolution and linkage has failed is given anywhere.

      Marked Minor since workaround exists but I would recommend escalation.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                arcivanov Arcadiy Ivanov
                Reporter:
                arcivanov Arcadiy Ivanov
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: