From 5baff6e9b6ceb5b451aa724fcbc0774723a47658 Mon Sep 17 00:00:00 2001 From: Marc-Andre Laperle Date: Thu, 1 Nov 2018 22:10:26 -0400 Subject: [PATCH] Bug 536316 - ClassNotFoundException: javax.xml.bind.JAXBException This class is gone in Java 11. Instead use the one from Orbit. Also, this used com.sun.xml.internal.bind.v2.ContextFactory which is also gone so we have to directly use com.sun.xml.bind.v2.ContextFactory also from Orbit. Change-Id: I808ebe5a6ade19e86d4c31f2f2789063dc3bf3b4 Signed-off-by: Marc-Andre Laperle --- .../META-INF/MANIFEST.MF | 5 ++++- .../org/eclipse/tools/templates/freemarker/FMGenerator.java | 4 +++- repo/category.xml | 3 +++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/bundles/org.eclipse.tools.templates.freemarker/META-INF/MANIFEST.MF b/bundles/org.eclipse.tools.templates.freemarker/META-INF/MANIFEST.MF index dc45d52e72e..847448ccee5 100644 --- a/bundles/org.eclipse.tools.templates.freemarker/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.tools.templates.freemarker/META-INF/MANIFEST.MF @@ -7,8 +7,11 @@ Bundle-Activator: org.eclipse.tools.templates.freemarker.internal.Activator Require-Bundle: org.eclipse.core.runtime, org.eclipse.core.resources, org.freemarker;visibility:=reexport, - org.eclipse.tools.templates.core;bundle-version="1.0.0";visibility:=reexport + org.eclipse.tools.templates.core;bundle-version="1.0.0";visibility:=reexport, + com.sun.xml.bind;bundle-version="2.2.0" Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy Export-Package: org.eclipse.tools.templates.freemarker Bundle-Vendor: %providerName +Import-Package: javax.xml.bind;version="2.2.0", + javax.xml.bind.annotation;version="2.2.0" diff --git a/bundles/org.eclipse.tools.templates.freemarker/src/org/eclipse/tools/templates/freemarker/FMGenerator.java b/bundles/org.eclipse.tools.templates.freemarker/src/org/eclipse/tools/templates/freemarker/FMGenerator.java index e7ad6949201..c60e1f4504e 100644 --- a/bundles/org.eclipse.tools.templates.freemarker/src/org/eclipse/tools/templates/freemarker/FMGenerator.java +++ b/bundles/org.eclipse.tools.templates.freemarker/src/org/eclipse/tools/templates/freemarker/FMGenerator.java @@ -47,6 +47,8 @@ import org.eclipse.tools.templates.freemarker.internal.Activator; import org.eclipse.tools.templates.freemarker.internal.Messages; import org.osgi.framework.Bundle; +import com.sun.xml.bind.v2.ContextFactory; + import freemarker.cache.TemplateLoader; import freemarker.template.Configuration; import freemarker.template.Template; @@ -98,7 +100,7 @@ public abstract class FMGenerator implements IGenerator, TemplateLoader { try { StringWriter writer = new StringWriter(); loadFile(manifestPath, model, writer); // $NON-NLS-1$ - JAXBContext xmlContext = JAXBContext.newInstance(getManifestClass()); + JAXBContext xmlContext = ContextFactory.createContext(new Class[] { getManifestClass() }, null); Unmarshaller unmarshaller = xmlContext.createUnmarshaller(); manifest = (TemplateManifest) unmarshaller.unmarshal(new StringReader(writer.toString())); } catch (JAXBException e) { diff --git a/repo/category.xml b/repo/category.xml index c3d0d63ac5e..68d40e0213d 100644 --- a/repo/category.xml +++ b/repo/category.xml @@ -18,5 +18,8 @@ + + +