From issues at jboss.org Wed Jul 2 21:11:24 2014 From: issues at jboss.org (Arcadiy Ivanov (JIRA)) Date: Wed, 2 Jul 2014 21:11:24 -0400 (EDT) Subject: [jboss-osgi-issues] [JBoss JIRA] (JBOSGI-765) HostBundleClassLoader silently deletes JAXB annotations from Class if package not imported In-Reply-To: References: Message-ID: 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. 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) From issues at jboss.org Wed Jul 2 21:17:24 2014 From: issues at jboss.org (Arcadiy Ivanov (JIRA)) Date: Wed, 2 Jul 2014 21:17:24 -0400 (EDT) Subject: [jboss-osgi-issues] [JBoss JIRA] (JBOSGI-765) HostBundleClassLoader silently deletes JAXB annotations from Class if package not imported In-Reply-To: References: Message-ID: [ https://issues.jboss.org/browse/JBOSGI-765?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Arcadiy Ivanov updated JBOSGI-765: ---------------------------------- 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. 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. was: 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. 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. > 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 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. > 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)