metrics icon indicating copy to clipboard operation
metrics copied to clipboard

sun.misc import need to be optional

Open dantran opened this issue 13 years ago • 3 comments

Currently, metrics-core fails to load under apache karaf 2.3.1 container b/c sun.mics is a required package.

This is a similar to Netty 4.0 where sun.misc is mark as optional as a solution

dantran avatar May 09 '13 17:05 dantran

I have basically no idea how OSGi works, so if you'd like to submit a pull request to resolve this I'd be happy to accept it.

codahale avatar May 09 '13 17:05 codahale

it is a simple change by configure sun.misc.* as optional at top level pom under maven-bundle-plugin. here is the git diff ( tested with my production). Makesure to use edit mode to see the actual content

C:\Users\Dan.Tran\dev\codahale\metrics>git diff pom.xml
diff --git a/pom.xml b/pom.xml
index 6655cb7..9c05362 100644
--- a/pom.xml
+++ b/pom.xml
@@ -179,6 +179,7 @@
                         <Import-Package><![CDATA[
                             javax.servlet*;version="[2.5.0,4.0.0)",
                             org.slf4j*;version="[1.6.0,2.0.0)",
+                            sun.misc.*;resolution:=optional,
                             *
                         ]]>
                       </Import-Package>

dantran avatar May 10 '13 04:05 dantran

This can also be addressed on the karaf side by adding sun.misc to your exported packages in Karaf's config.properties:

# Extra packages appended after standard packages
org.osgi.framework.system.packages.extra= \
   sun.misc

alexwen avatar May 14 '13 15:05 alexwen