summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authoredwardsmj <edwardsmj@13f79535-47bb-0310-9956-ffa450edef68>2009-11-06 09:44:33 +0000
committeredwardsmj <edwardsmj@13f79535-47bb-0310-9956-ffa450edef68>2009-11-06 09:44:33 +0000
commit4dadc7ed2fb024917792db4213c31e5d5198067b (patch)
tree700c03381a5250874b4ca9ea644ea6d5f5c74b96 /java
parent4df3110b21509ae73f5c9f336722b253b2990c8b (diff)
Tweaks to enable implementation-bpel to pass latest OASIS BPEL testcases
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@833332 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java')
-rw-r--r--java/sca/modules/implementation-bpel-runtime/META-INF/MANIFEST.MF44
-rw-r--r--java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java130
-rw-r--r--java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyProcessConfImpl.java112
-rw-r--r--java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELImplementationProvider.java19
4 files changed, 185 insertions, 120 deletions
diff --git a/java/sca/modules/implementation-bpel-runtime/META-INF/MANIFEST.MF b/java/sca/modules/implementation-bpel-runtime/META-INF/MANIFEST.MF
index 5e40de7a52..f202b5665c 100644
--- a/java/sca/modules/implementation-bpel-runtime/META-INF/MANIFEST.MF
+++ b/java/sca/modules/implementation-bpel-runtime/META-INF/MANIFEST.MF
@@ -10,42 +10,34 @@ Bundle-Version: 2.0
Bnd-LastModified: 1225397447609
Bundle-ManifestVersion: 2
Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
-Bundle-ClassPath: .,ode-bpel-epr-1.3.2.jar,ode-bpel-store-1.3.2.jar,
- ode-bpel-dao-1.3.2.jar,ode-dao-jpa-1.3.2.jar,
- ode-bpel-runtime-1.3.2.jar,ode-bpel-api-1.3.2.jar,
- ode-scheduler-simple-1.3.2.jar,ode-utils-1.3.2.jar,
- ode-bpel-compiler-1.3.2.jar,ode-bpel-schemas-1.3.2.jar,
- ode-bpel-obj-1.3.2.jar,ode-jacob-1.3.2.jar,ode-jacob-ap-1.3.2.jar,
- geronimo-jta_1.1_spec-1.1.jar,geronimo-transaction-2.0.1.jar,
- persistence-api-1.0.jar,ode-agents-1.3.2.jar,
- ode-dao-hibernate-1.3.2.jar,
- geronimo-connector-2.0.1.jar,openjpa-1.3.0-SNAPSHOT.jar
+Bundle-ClassPath: .
Bundle-Description: Apache Tuscany SCA BPEL ODE Implementation Extensi
on
-Import-Package: javax.resource.spi,
+Import-Package: javax.persistence;version="1.0.0",
+ javax.persistence.spi;version="1.0.0",
+ javax.resource.spi,
javax.transaction;version="1.1.0",
javax.wsdl;resolution:=optional,
javax.xml.namespace;resolution:=optional,
- javax.xml.transform,
- javax.xml.transform.dom,
- javax.xml.transform.stream,
org.apache.commons.logging;resolution:=optional,
org.apache.geronimo.transaction.manager,
- org.apache.ode.bpel.compiler,
- org.apache.ode.bpel.dao,
- org.apache.ode.bpel.engine,
- org.apache.ode.bpel.evt,
- org.apache.ode.bpel.iapi,
- org.apache.ode.bpel.memdao,
- org.apache.ode.il.config,
- org.apache.ode.il.dbutil,
- org.apache.ode.scheduler.simple,
- org.apache.ode.utils,
+ org.apache.ode.bpel.compiler;version="1.3.2",
+ org.apache.ode.bpel.dao;version="1.3.2",
+ org.apache.ode.bpel.engine;version="1.3.2",
+ org.apache.ode.bpel.evt;version="1.3.2",
+ org.apache.ode.bpel.iapi;version="1.3.2",
+ org.apache.ode.bpel.memdao;version="1.3.2",
+ org.apache.ode.dao.jpa;version="1.3.2",
+ org.apache.ode.il.config;version="1.3.2",
+ org.apache.ode.il.dbutil;version="1.3.2",
+ org.apache.ode.scheduler.simple;version="1.3.2",
+ org.apache.ode.utils;version="1.3.2",
org.apache.tuscany.sca.assembly;version="2.0",
org.apache.tuscany.sca.core;version="2.0",
org.apache.tuscany.sca.databinding;version="2.0",
org.apache.tuscany.sca.databinding.impl;version="2.0",
org.apache.tuscany.sca.databinding.xml;version="2.0",
+ org.apache.tuscany.sca.extensibility;version="2.0.0",
org.apache.tuscany.sca.implementation.bpel;version="2.0",
org.apache.tuscany.sca.interfacedef;version="2.0",
org.apache.tuscany.sca.interfacedef.wsdl;version="2.0",
@@ -56,6 +48,6 @@ Import-Package: javax.resource.spi,
org.eclipse.core.runtime;resolution:=optional;common=split,
org.oasisopen.sca.annotation;version="2.0",
org.w3c.dom;resolution:=optional
-Bundle-SymbolicName: org.apache.tuscany.sca.implementation.bpel.ode
+Bundle-SymbolicName: org.apache.tuscany.sca.implementation.bpel.runtime
Bundle-DocURL: http://www.apache.org/
-Bundle-RequiredExecutionEnvironment: J2SE-1.5,JavaSE-1.6
+Bundle-RequiredExecutionEnvironment: J2SE-1.5,JavaSE-1.6
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 d812a64e1c..20e3a8076e 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
@@ -32,15 +32,12 @@ import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
+import javax.persistence.spi.PersistenceProvider;
import javax.transaction.TransactionManager;
import javax.xml.namespace.QName;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-//import org.apache.ode.axis2.BindingContextImpl;
-//import org.apache.ode.axis2.EndpointReferenceContextImpl;
-//import org.apache.ode.axis2.MessageExchangeContextImpl;
-//import org.apache.ode.axis2.EndpointReferenceContextImpl;
import org.apache.ode.bpel.dao.BpelDAOConnectionFactoryJDBC;
import org.apache.ode.bpel.engine.BpelServerImpl;
import org.apache.ode.bpel.engine.CountLRUDehydrationPolicy;
@@ -51,6 +48,7 @@ import org.apache.ode.bpel.evt.ProcessMessageExchangeEvent;
import org.apache.ode.bpel.iapi.BpelEventListener;
import org.apache.ode.bpel.iapi.Scheduler;
import org.apache.ode.bpel.memdao.BpelDAOConnectionFactoryImpl;
+import org.apache.ode.dao.jpa.ProcessDAOImpl;
import org.apache.ode.il.config.OdeConfigProperties;
import org.apache.ode.il.dbutil.Database;
import org.apache.ode.scheduler.simple.JdbcDelegate;
@@ -58,6 +56,7 @@ import org.apache.ode.scheduler.simple.SimpleScheduler;
import org.apache.ode.utils.GUID;
import org.apache.tuscany.sca.assembly.Endpoint;
import org.apache.tuscany.sca.assembly.EndpointReference;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
import org.apache.tuscany.sca.implementation.bpel.BPELImplementation;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.eclipse.core.runtime.FileLocator;
@@ -105,50 +104,41 @@ public class EmbeddedODEServer {
}
public void init() throws ODEInitializationException {
- 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);
- }
- }
+
+ 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);
+ }
+
+ // Start ODE scheduler
+ _scheduler.start();
+
+ __log.info("ODE BPEL server started.");
+ _initialized = true;
+
+ } // end method init()
/**
* Gets the location of the database used for the ODE BPEL engine as a File object for
@@ -159,23 +149,35 @@ public class EmbeddedODEServer {
*/
private File getDatabaseLocationAsFile() throws ODEInitializationException,
URISyntaxException {
- File locationFile = null;
- // TODO - provide a system property / environment variable to set the path to the DB
+ File locationFile = null;
+ URL dbLocation = null;
- URL dbLocation = getClass().getClassLoader().getResource("jpadb");
- if (dbLocation == null) {
- throw new ODEInitializationException("Couldn't find database in the classpath");
- }
- // Handle OSGI bundle case
- if( dbLocation.getProtocol() == "bundleresource" ) {
- try {
- dbLocation = FileLocator.toFileURL( dbLocation );
- } catch (Exception ce ) {
- throw new ODEInitializationException("Couldn't find database in the OSGi bundle");
- } // end try
- } // end if
-
- locationFile = new File(dbLocation.toURI()).getParentFile();
+ // An environment variable to set the path to the DB
+ String dbFile = System.getenv("TUSCANY_IMPL_BPEL_DBLOCATION");
+ if( dbFile != null ) {
+ try {
+ locationFile = new File(dbFile).getParentFile();
+ } catch (Exception e ) {
+ System.out.println("Environment variable TUSCANY_IMPL_BPEL_LOCATION has the wrong format: " + dbFile);
+ System.out.println("Exception is: " + e.getClass().toString() + " " + e.getMessage());
+ } // end try
+ } else {
+ dbLocation = getClass().getClassLoader().getResource("jpadb");
+ if (dbLocation == null) {
+ throw new ODEInitializationException("Couldn't find database in the classpath:" +
+ " try setting the TUSCANY_IMPL_BPEL_LOCATION environment variable");
+ }
+ // Handle OSGI bundle case
+ if( dbLocation.getProtocol() == "bundleresource" ) {
+ try {
+ dbLocation = FileLocator.toFileURL( dbLocation );
+ } catch (Exception ce ) {
+ throw new ODEInitializationException("Couldn't find database in the OSGi bundle");
+ } // end try
+ } // end if
+ locationFile = new File(dbLocation.toURI()).getParentFile();
+ } // end if
+
return locationFile;
} // end method getDatabaseLocationAsFile
diff --git a/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyProcessConfImpl.java b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyProcessConfImpl.java
index 19e7d3e913..9e7b447886 100644
--- a/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyProcessConfImpl.java
+++ b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyProcessConfImpl.java
@@ -115,8 +115,19 @@ public class TuscanyProcessConfImpl implements ProcessConf {
public void stop() {
// If the BPEL file was rewritten, destroy the rewritten version of it so that
- // it is not used again.
+ // it is not used again. Also delete the related compiled cbp file
if( rewritten ) {
+ try {
+ String cbpName = theBPELFile.getCanonicalPath();
+ // Remove the "bpel_tmp" suffix and add "cbp"
+ if ( cbpName.endsWith("bpel_tmp") ) {
+ cbpName = cbpName.substring( 0, cbpName.length() - 8) + "cbp";
+ File cbpFile = new File( cbpName );
+ if ( cbpFile.exists() ) cbpFile.delete();
+ } // end if
+ } catch (Exception e ) {
+ // Do nothing with an exception
+ } // end try
theBPELFile.delete();
} // end if
@@ -284,14 +295,18 @@ public class TuscanyProcessConfImpl implements ProcessConf {
// services that have a callback interface
List<ComponentReference> theReferences = component.getReferences();
//List<Reference> theReferences = implementation.getReferences();
- // Create an endpoint for each reference, using the reference name as the "service"
- // name, combined with http://tuscany.apache.org to make a QName
+ // Create an endpoint for each reference, using the reference name combined with
+ // http://tuscany.apache.org to make a QName
+ // Note that the key used for this put operation MUST be the name of one of the partnerLinks of the
+ // BPEL process. The SCA reference MAY have an alias for the name (can be given using the sca-bpel:reference
+ // element, if present) and this alias must not be used
for( Reference reference : theReferences ) {
+ String partnerlinkName = implementation.getReferencePartnerlinkName( reference.getName() );
// Check that there is at least 1 configured SCA endpointReference for the reference, since it is
// possible for 0..1 multiplicity references to have no SCA endpointReferences configured
List<org.apache.tuscany.sca.assembly.EndpointReference> eprs = reference.getEndpointReferences();
String eprCount = Integer.toString( eprs.size() );
- invokeEndpoints.put( reference.getName(),
+ invokeEndpoints.put( partnerlinkName,
new Endpoint( new QName( TUSCANY_NAMESPACE, reference.getName() ), eprCount));
} // end for
} // end if
@@ -342,13 +357,17 @@ public class TuscanyProcessConfImpl implements ProcessConf {
String componentURI = component.getURI();
// Get a collection of the services - note that the Component services include additional
// "pseudo-services" for each reference that has a callback...
- //List<Service> theServices = implementation.getServices();
+
List<ComponentService> theServices = component.getServices();
- // Create an endpoint for each reference, using the reference name as the "service"
- // name, combined with http://tuscany.apache.org to make a QName
+ // Create an endpoint for each service, using the service name combined with
+ // http://tuscany.apache.org to make a QName
+ // Note that the key used for this put operation MUST be the name of one of the partnerLinks of the
+ // BPEL process. The SCA service MAY have an alias for the name (can be given using the sca-bpel:service
+ // element, if present) and this alias must not be used
for( ComponentService service : theServices ) {
+ String partnerlinkName = implementation.getServicePartnerlinkName( service.getName() );
// MJE 14/07/2009 - added componentURI to the service name to get unique service name
- provideEndpoints.put( service.getName(),
+ provideEndpoints.put( partnerlinkName,
new Endpoint( new QName( TUSCANY_NAMESPACE, componentURI + service.getName() ),
"ServicePort"));
} // end for
@@ -492,8 +511,19 @@ public class TuscanyProcessConfImpl implements ProcessConf {
Element initializer = getInitializerSequence( bpelDOM, property );
if( initializer == null ) return;
- // Insert the initializer sequence as the immediate child of the insertion point
- insertionElement.insertBefore( initializer, insertionElement.getFirstChild() );
+ // Insert the initializer sequence as the next sibling element of the insertion point
+ Element parent = (Element)insertionElement.getParentNode();
+ // Get the next sibling element, if there is one
+ Node sibling = insertionElement.getNextSibling();
+ while( sibling != null && sibling.getNodeType() != Node.ELEMENT_NODE ) {
+ sibling = sibling.getNextSibling();
+ } // end while
+ // Either insert at the end or before the next element
+ if ( sibling == null ) {
+ parent.appendChild( initializer );
+ } else {
+ parent.insertBefore( initializer, sibling );
+ } // end if
} // end insertSCAPropertyInitializer
@@ -514,18 +544,18 @@ public class TuscanyProcessConfImpl implements ProcessConf {
// Simple types
String NS_URI = bpelDOM.getDocumentElement().getNamespaceURI();
String valueText = getPropertyValueText( property.getValue() );
- Element literalElement = bpelDOM.createElement("literal");
+ Element literalElement = bpelDOM.createElementNS(NS_URI, "literal");
literalElement.setTextContent(valueText);
- Element fromElement = bpelDOM.createElement("from");
+ Element fromElement = bpelDOM.createElementNS(NS_URI, "from");
fromElement.appendChild(literalElement);
- Element toElement = bpelDOM.createElement("to");
- Attr variableAttribute = bpelDOM.createAttribute("variable");
+ Element toElement = bpelDOM.createElementNS(NS_URI, "to");
+ Attr variableAttribute = bpelDOM.createAttributeNS(NS_URI, "variable");
variableAttribute.setValue( property.getName() );
toElement.setAttributeNode( variableAttribute );
- Element copyElement = bpelDOM.createElement("copy");
+ Element copyElement = bpelDOM.createElementNS(NS_URI, "copy");
copyElement.appendChild(fromElement);
copyElement.appendChild(toElement);
- Element assignElement = bpelDOM.createElement("assign");
+ Element assignElement = bpelDOM.createElementNS(NS_URI, "assign");
assignElement.appendChild(copyElement);
return assignElement;
} // end if
@@ -573,18 +603,54 @@ public class TuscanyProcessConfImpl implements ProcessConf {
return null;
} // end method findInitializerInsertionPoint
- private static String SEQUENCE_ELEMENT = "sequence";
/**
- * Determine if an Element is a BPEL Activity element which can have an Assign
+ * A WS-BPEL activity can be any of the following:
+ * <receive>
+ * <reply>
+ * <invoke>
+ * <assign>
+ * <throw>
+ * <exit>
+ * <wait>
+ * <empty>
+ * <sequence>
+ * <if>
+ * <while>
+ * <repeatUntil>
+ * <forEach>
+ * <pick>
+ * <flow>
+ * <scope>
+ * <compensate>
+ * <compensateScope>
+ * <rethrow>
+ * <validate>
+ * <extensionActivity>
+ * A WS-BPEL start activity is a <receive> or <pick> with @create_instance="yes"
+ */
+ private static String SEQUENCE_ELEMENT = "sequence";
+ private static String REPLY_ELEMENT = "reply";
+ private static String INVOKE_ELEMENT = "invoke";
+ private static String ASSIGN_ELEMENT = "assign";
+ private static String PICK_ELEMENT = "pick";
+ private static String RECEIVE_ELEMENT = "receive";
+ private static String FLOW_ELEMENT = "flow";
+ private static String SCOPE_ELEMENT = "scope";
+ /**
+ * Determine if an Element is a BPEL start activity element which can have an Assign
* inserted following it
- * @param element - the Element
+ * @param element - a DOM Element containing the BPEL activity
* @return - true if the Element is a BPEL Activity element, false otherwise
*/
private boolean isInsertableActivityElement( Element element ) {
String name = element.getTagName();
- // For the present, only <sequence/> elements count
- // TODO - extend this to cover other insertable cases
- if( SEQUENCE_ELEMENT.equalsIgnoreCase(name) ) return true;
+ // For the present, only <receive/> and <pick/> elements with create_instance="yes" count
+ // if( SEQUENCE_ELEMENT.equalsIgnoreCase(name) ) return true;
+ String start = element.getAttribute("createInstance");
+ if( start == null ) return false;
+ if( !"yes".equals(start) ) return false;
+ if( RECEIVE_ELEMENT.equalsIgnoreCase(name) ) return true;
+ if( PICK_ELEMENT.equalsIgnoreCase(name) ) return true;
return false;
} // end method isActivityElement
@@ -596,6 +662,8 @@ public class TuscanyProcessConfImpl implements ProcessConf {
private Document readDOMFromProcess( File bpelFile ) {
try {
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
+ docFactory.setNamespaceAware(true);
+ docFactory.setXIncludeAware(true);
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
Document bpelDOM = docBuilder.parse( bpelFile );
diff --git a/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELImplementationProvider.java b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELImplementationProvider.java
index 68492a5dbb..93409c837f 100644
--- a/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELImplementationProvider.java
+++ b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELImplementationProvider.java
@@ -21,14 +21,18 @@ package org.apache.tuscany.sca.implementation.bpel.ode.provider;
import java.io.File;
import java.net.URI;
+import javax.persistence.spi.PersistenceProvider;
import javax.transaction.TransactionManager;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.ode.dao.jpa.ProcessDAOImpl;
import org.apache.tuscany.sca.assembly.Endpoint;
import org.apache.tuscany.sca.assembly.Reference;
import org.apache.tuscany.sca.assembly.Service;
import org.apache.tuscany.sca.databinding.xml.DOMDataBinding;
+import org.apache.tuscany.sca.extensibility.ClassLoaderContext;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
import org.apache.tuscany.sca.implementation.bpel.BPELImplementation;
import org.apache.tuscany.sca.implementation.bpel.ode.EmbeddedODEServer;
import org.apache.tuscany.sca.implementation.bpel.ode.ODEDeployment;
@@ -111,15 +115,14 @@ public class BPELImplementationProvider implements ImplementationProvider {
__log.info("Starting " + component.getName());
} // end if
- ClassLoader tccl = Thread.currentThread().getContextClassLoader();
- ClassLoader bpelcl = this.getClass().getClassLoader();
+ // 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
+ ClassLoader tccl = ClassLoaderContext.setContextClassLoader(EmbeddedODEServer.class.getClassLoader(),
+ PersistenceProvider.class.getClassLoader(),
+ ProcessDAOImpl.class.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);
-
- if (!odeServer.isInitialized()) {
+ if (!odeServer.isInitialized()) {
// start ode server
odeServer.init();
}
@@ -151,7 +154,7 @@ public class BPELImplementationProvider implements ImplementationProvider {
throw new RuntimeException("BPEL Component Type Implementation initialization failure : " + e.getMessage(), e);
} finally {
// Restore the TCCL if we changed it
- if( bpelcl != tccl ) Thread.currentThread().setContextClassLoader(tccl);
+ if( tccl != null ) Thread.currentThread().setContextClassLoader(tccl);
} // end try
} // end method start()