summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/implementation-bpel-runtime/src
diff options
context:
space:
mode:
authoredwardsmj <edwardsmj@13f79535-47bb-0310-9956-ffa450edef68>2009-08-04 21:19:56 +0000
committeredwardsmj <edwardsmj@13f79535-47bb-0310-9956-ffa450edef68>2009-08-04 21:19:56 +0000
commitb700129254aa70fc857d63392edd405bcd355822 (patch)
tree6d20f9ea156c1dd4c214f0eb2d85b3d32e842afc /java/sca/modules/implementation-bpel-runtime/src
parentb03fa7f42665d0249bf6ebb27090547bd2551ad9 (diff)
Fix classloading problem with ODE dependencies used by implementation-bpel-runtime: force TCCL for those dependencies to be the OSGi Bundle ClassLoader when running under OSGi
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@800980 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/implementation-bpel-runtime/src')
-rw-r--r--java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java76
1 files changed, 43 insertions, 33 deletions
diff --git a/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java
index 5c0129fd41..b2522326f8 100644
--- a/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java
+++ b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java
@@ -87,39 +87,49 @@ public class EmbeddedODEServer {
}
public void init() throws ODEInitializationException {
- Properties p = System.getProperties();
- p.put("derby.system.home", "target");
-
- Properties confProps = new Properties();
- confProps.put("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=false)");
-
- _config = new OdeConfigProperties(confProps, "ode-sca");
-
- // Setting work root as the directory containing our database
- try {
- _workRoot = getDatabaseLocationAsFile();
- } catch (URISyntaxException e) {
- throw new ODEInitializationException(e);
- }
-
- initTxMgr();
- initPersistence();
- initBpelServer();
-
- try {
- _bpelServer.start();
- } catch (Exception ex) {
- String errmsg = "An error occured during the ODE BPEL server startup.";
- __log.error(errmsg, ex);
- throw new ODEInitializationException(errmsg, ex);
- }
-
- // Added MJE, 24/06/2009 - for 1.3.2 version of ODE
- _scheduler.start();
- // end of addition
-
- __log.info("ODE BPEL server started.");
- _initialized = true;
+ ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+ ClassLoader bpelcl = this.getClass().getClassLoader();
+ try{
+ // Switch TCCL - under OSGi this causes the TCCL to be set to the Bundle
+ // classloader - this is then used by 3rd party code from ODE and its dependencies
+ if( bpelcl != tccl ) Thread.currentThread().setContextClassLoader(bpelcl);
+ Properties p = System.getProperties();
+ p.put("derby.system.home", "target");
+
+ Properties confProps = new Properties();
+ confProps.put("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=false)");
+
+ _config = new OdeConfigProperties(confProps, "ode-sca");
+
+ // Setting work root as the directory containing our database
+ try {
+ _workRoot = getDatabaseLocationAsFile();
+ } catch (URISyntaxException e) {
+ throw new ODEInitializationException(e);
+ }
+
+ initTxMgr();
+ initPersistence();
+ initBpelServer();
+
+ try {
+ _bpelServer.start();
+ } catch (Exception ex) {
+ String errmsg = "An error occured during the ODE BPEL server startup.";
+ __log.error(errmsg, ex);
+ throw new ODEInitializationException(errmsg, ex);
+ }
+
+ // Added MJE, 24/06/2009 - for 1.3.2 version of ODE
+ _scheduler.start();
+ // end of addition
+
+ __log.info("ODE BPEL server started.");
+ _initialized = true;
+ } finally {
+ // Restore the TCCL if we changed it
+ if( bpelcl != tccl ) Thread.currentThread().setContextClassLoader(tccl);
+ }
}
/**