tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edward...@apache.org
Subject svn commit: r800980 - /tuscany/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java
Date Tue, 04 Aug 2009 21:19:57 GMT
Author: edwardsmj
Date: Tue Aug  4 21:19:56 2009
New Revision: 800980

URL: http://svn.apache.org/viewvc?rev=800980&view=rev
Log:
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

Modified:
    tuscany/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java

Modified: tuscany/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java?rev=800980&r1=800979&r2=800980&view=diff
==============================================================================
--- tuscany/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java
(original)
+++ tuscany/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java
Tue Aug  4 21:19:56 2009
@@ -87,39 +87,49 @@
     }
     
     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);
+    	}
     }
     
     /**



Mime
View raw message