final ServiceBeanContainer container) throws ServiceBeanInstantiationException {
ServiceBeanFactory.Created created = null;
MarshalledInstance marshalledProxy = null;
ServiceBeanContext context;
CommonClassLoader commonCL = CommonClassLoader.getInstance();
ComputeResource computeResource = container.getComputeResource();
/*
* Provision service jars
*/
URL[] exports = new URL[0];
URL[] implJARs = new URL[0];
if(System.getProperty("StaticCybernode")==null) {
try {
Resolver resolver = ResolverHelper.getResolver();
boolean install = computeResource.getPersistentProvisioning();
Map<String, ProvisionedResources> serviceResources = provisionService(sElem, resolver, install);
ProvisionedResources dlPR = serviceResources.get("dl");
ProvisionedResources implPR = serviceResources.get("impl");
if(dlPR.getJars().length==0 && dlPR.getArtifact()!=null) {
String convertedArtifact = dlPR.getArtifact().replaceAll(":", "/");
String[] artifactParts = convertedArtifact.split(" ");
List<URL> exportURLList = new ArrayList<URL>();
for(String artifactPart : artifactParts) {
// TODO: if the repositories is default maven central, still need to add?
exportURLList.add(new URL("artifact:"+artifactPart+dlPR.getRepositories()));
}
exports = exportURLList.toArray(new URL[exportURLList.size()]);
} else {
exports = dlPR.getJars();
}
implJARs = implPR.getJars();
} catch(Exception e) {
throw new ServiceBeanInstantiationException("Unable to provision JARs for " +
"service "+ ServiceLogUtil.logName(sElem), e);
}
}
final Thread currentThread = Thread.currentThread();
ClassLoader currentClassLoader = currentThread.getContextClassLoader();
Uuid serviceIDToUse = serviceID;
try {
ClassBundle jsbBundle = sElem.getComponentBundle();
List<URL> urlList = new ArrayList<URL>();
/*
URL[] implJARs;
if(jsbBundle!=null && jsbBundle.getCodebase()!=null)
implJARs = jsbBundle.getJARs();
else
implJARs = new URL[0];
*/
urlList.addAll(Arrays.asList(implJARs));
/* Get matched PlatformCapability jars to load */
PlatformCapability[] pCaps = computeResource.getPlatformCapabilities();
PlatformCapability[] matched = ServiceElementUtil.getMatchedPlatformCapabilities(sElem, pCaps);
for (PlatformCapability pCap : matched) {
URL[] urls = PlatformCapabilityLoader.getLoadableClassPath(pCap);
for(URL url : urls) {
if(!urlList.contains(url))