[jboss-osgi-issues] [JBoss JIRA] (JBOSGI-765) HostBundleClassLoader silently deletes JAXB annotations from Class if package not imported

Arcadiy Ivanov (JIRA) issues at jboss.org
Wed Jul 2 21:11:24 EDT 2014


Arcadiy Ivanov created JBOSGI-765:
-------------------------------------

             Summary: HostBundleClassLoader silently deletes JAXB annotations from Class if package not imported
                 Key: JBOSGI-765
                 URL: https://issues.jboss.org/browse/JBOSGI-765
             Project: JBoss OSGi
          Issue Type: Bug
      Security Level: Public (Everyone can see)
          Components: framework
    Affects Versions: JBossOSGi 2.2.0
         Environment: WildFly 8.1.0.Final
            Reporter: Arcadiy Ivanov
            Priority: Minor


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 on the class X are annotations 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.



--
This message was sent by Atlassian JIRA
(v6.2.6#6264)


More information about the jboss-osgi-issues mailing list