From 90f7efd6af1fd560dc68e5c15a0c1d85315a419e Mon Sep 17 00:00:00 2001 From: wmz7year Date: Wed, 4 Nov 2015 09:50:41 +0800 Subject: [PATCH] Fix hazelcast plugin xalan NoClassDefFoundError issue:https://github.com/hazelcast/hazelcast/issues/6614 --- .../jivesoftware/openfire/plugin/HazelcastPlugin.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/plugins/hazelcast/src/java/org/jivesoftware/openfire/plugin/HazelcastPlugin.java b/src/plugins/hazelcast/src/java/org/jivesoftware/openfire/plugin/HazelcastPlugin.java index 11925ad6e5..89555d5384 100644 --- a/src/plugins/hazelcast/src/java/org/jivesoftware/openfire/plugin/HazelcastPlugin.java +++ b/src/plugins/hazelcast/src/java/org/jivesoftware/openfire/plugin/HazelcastPlugin.java @@ -48,6 +48,9 @@ public class HazelcastPlugin extends TimerTask implements Plugin { private static final long CLUSTER_STARTUP_DELAY_TIME = JiveGlobals.getLongProperty("hazelcast.startup.delay.seconds", 5); + private static final String TRANSFORMERFACTORY = "javax.xml.transform.TransformerFactory"; + private static String OLDTRANSFORMERFACTORY; + public void initializePlugin(PluginManager manager, File pluginDirectory) { // start cluster using a separate thread after a short delay // this will allow other plugins to initialize during startup @@ -72,10 +75,16 @@ public boolean accept(File pathname) { logger.warn("Conflicting clustering plugins found; remove Coherence and/or Enterprise jar files"); throw new IllegalStateException("Clustering plugin configuration conflict (Coherence)"); } + + // https://github.com/hazelcast/hazelcast/issues/6614 + OLDTRANSFORMERFACTORY = System.getProperty(TRANSFORMERFACTORY); + System.setProperty(TRANSFORMERFACTORY, "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl"); + ClusterManager.startup(); } public void destroyPlugin() { + System.setProperty(TRANSFORMERFACTORY, OLDTRANSFORMERFACTORY); // Shutdown is initiated by XMPPServer before unloading plugins if (!XMPPServer.getInstance().isShuttingDown()) { ClusterManager.shutdown();