{"id":569,"date":"2023-06-04T05:09:47","date_gmt":"2023-06-04T10:09:47","guid":{"rendered":"https:\/\/muthii.com\/blog\/?p=569"},"modified":"2023-06-04T05:09:47","modified_gmt":"2023-06-04T10:09:47","slug":"java-lang-nosuchmethodexception-sun-misc-unsafe-defineclass","status":"publish","type":"post","link":"https:\/\/muthii.com\/blog\/?p=569","title":{"rendered":"java.lang.NoSuchMethodException: sun.misc.Unsafe.defineClass"},"content":{"rendered":"\n<p>Upgrading from JDK8 to 17+ caused jaxb to run into this errors at run time. Solution remove older Jaxb jars and replace with newer jars that still provide &#8220;xml.bind&#8221;. When replacing try with 2.3.X jar versions as they still maintain the old sun class path, 3.XX jars have switched to the jarkarta class path which will mean updating some of your project imports and dependencies.<\/p>\n\n\n\n<p>Remove any of the below libs<br><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">implementation group:'javax.xml.bind', name: 'jaxb-api', version: '2.3.0'\nimplementation group:'com.sun.xml.bind',name:'jaxb-impl', version: '2.3.0'\nimplementation group:'com.sun.xml.bind',name:'jaxb-core', version: '2.3.0'\n    <\/pre>\n\n\n\n<p>replace with<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">implementation group: 'jakarta.xml.bind', name: 'jakarta.xml.bind-api', version: '2.3.3'<br>implementation group: 'org.glassfish.jaxb', name: 'jaxb-runtime', version: '2.3.3'<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Upgrading from JDK8 to 17+ caused jaxb to run into this errors at run time. Solution remove older Jaxb jars and replace with newer jars that still provide &#8220;xml.bind&#8221;. When replacing try with 2.3.X jar versions as they still maintain the old sun class path, 3.XX jars have switched to the jarkarta class path which &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/muthii.com\/blog\/?p=569\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;java.lang.NoSuchMethodException: sun.misc.Unsafe.defineClass&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[124,153,46],"tags":[],"_links":{"self":[{"href":"https:\/\/muthii.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/569"}],"collection":[{"href":"https:\/\/muthii.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/muthii.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/muthii.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/muthii.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=569"}],"version-history":[{"count":1,"href":"https:\/\/muthii.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/569\/revisions"}],"predecessor-version":[{"id":570,"href":"https:\/\/muthii.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/569\/revisions\/570"}],"wp:attachment":[{"href":"https:\/\/muthii.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=569"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/muthii.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=569"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/muthii.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=569"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}