IDEMPIERE-734 autostarting plug-ins causes a lot of errors if 2Pack/AdempiereActivator is used.

This commit is contained in:
Heng Sin Low 2013-04-02 18:16:58 +08:00
parent 927b748ed5
commit 2bfa8b0e03
2 changed files with 40 additions and 0 deletions

View File

@ -6,6 +6,40 @@ Bundle-Version: 0.0.0.1
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: org.adempiere.base, Import-Package: org.adempiere.base,
org.adempiere.util, org.adempiere.util,
org.apache.xerces.dom;version="2.9.0",
org.apache.xerces.dom.events;version="2.9.0",
org.apache.xerces.dom3.as;version="2.9.0",
org.apache.xerces.impl;version="2.9.0",
org.apache.xerces.impl.dtd;version="2.9.0",
org.apache.xerces.impl.dtd.models;version="2.9.0",
org.apache.xerces.impl.dv;version="2.9.0",
org.apache.xerces.impl.dv.dtd;version="2.9.0",
org.apache.xerces.impl.dv.util;version="2.9.0",
org.apache.xerces.impl.dv.xs;version="2.9.0",
org.apache.xerces.impl.io;version="2.9.0",
org.apache.xerces.impl.msg;version="2.9.0",
org.apache.xerces.impl.validation;version="2.9.0",
org.apache.xerces.impl.xpath;version="2.9.0",
org.apache.xerces.impl.xpath.regex;version="2.9.0",
org.apache.xerces.impl.xs;version="2.9.0",
org.apache.xerces.impl.xs.identity;version="2.9.0",
org.apache.xerces.impl.xs.models;version="2.9.0",
org.apache.xerces.impl.xs.opti;version="2.9.0",
org.apache.xerces.impl.xs.traversers;version="2.9.0",
org.apache.xerces.impl.xs.util;version="2.9.0",
org.apache.xerces.jaxp;version="2.9.0",
org.apache.xerces.jaxp.datatype;version="2.9.0",
org.apache.xerces.jaxp.validation;version="2.9.0",
org.apache.xerces.parsers;version="2.9.0",
org.apache.xerces.util;version="2.9.0",
org.apache.xerces.xinclude;version="2.9.0",
org.apache.xerces.xni;version="2.9.0",
org.apache.xerces.xni.grammars;version="2.9.0",
org.apache.xerces.xni.parser;version="2.9.0",
org.apache.xerces.xpointer;version="2.9.0",
org.apache.xerces.xs;version="2.9.0",
org.apache.xerces.xs.datatypes;version="2.9.0",
org.apache.xml.serialize;version="2.9.0",
org.compiere, org.compiere,
org.compiere.model, org.compiere.model,
org.compiere.util, org.compiere.util,

View File

@ -164,12 +164,15 @@ public class AdempiereActivator implements BundleActivator, ServiceTrackerCustom
Adempiere.getThreadPoolExecutor().execute(new Runnable() { Adempiere.getThreadPoolExecutor().execute(new Runnable() {
@Override @Override
public void run() { public void run() {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
try { try {
Thread.currentThread().setContextClassLoader(AdempiereActivator.class.getClassLoader());
setupPackInContext(); setupPackInContext();
installPackage(); installPackage();
} finally { } finally {
ServerContext.dispose(); ServerContext.dispose();
service = null; service = null;
Thread.currentThread().setContextClassLoader(cl);
} }
} }
}); });
@ -178,12 +181,15 @@ public class AdempiereActivator implements BundleActivator, ServiceTrackerCustom
@Override @Override
public void stateChange(ServerStateChangeEvent event) { public void stateChange(ServerStateChangeEvent event) {
if (event.getEventType() == ServerStateChangeEvent.SERVER_START && service != null) { if (event.getEventType() == ServerStateChangeEvent.SERVER_START && service != null) {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
try { try {
Thread.currentThread().setContextClassLoader(AdempiereActivator.class.getClassLoader());
setupPackInContext(); setupPackInContext();
installPackage(); installPackage();
} finally { } finally {
ServerContext.dispose(); ServerContext.dispose();
service = null; service = null;
Thread.currentThread().setContextClassLoader(cl);
} }
} }
} }