From a51332bfd292f170ad9fed7fad22cbff5e5aecb6 Mon Sep 17 00:00:00 2001 From: rfeng Date: Wed, 17 Sep 2008 22:54:56 +0000 Subject: Fix the classloader parent git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@696507 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/binding/rmi/provider/RMIServiceBindingProvider.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'java/sca/modules') diff --git a/java/sca/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/provider/RMIServiceBindingProvider.java b/java/sca/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/provider/RMIServiceBindingProvider.java index 4d257b38c8..2215d7fa35 100644 --- a/java/sca/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/provider/RMIServiceBindingProvider.java +++ b/java/sca/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/provider/RMIServiceBindingProvider.java @@ -87,6 +87,7 @@ public class RMIServiceBindingProvider implements ServiceBindingProvider { } public void stop() { + rmiHost.unregisterService(binding.getServiceName(), getPort(binding.getPort())); } protected int getPort(String port) { @@ -131,9 +132,9 @@ public class RMIServiceBindingProvider implements ServiceBindingProvider { }); Class targetJavaInterface = getTargetJavaClass(serviceInterface); if (!Remote.class.isAssignableFrom(targetJavaInterface)) { - RMIServiceClassLoader classloader = new RMIServiceClassLoader(getClass().getClassLoader()); + RMIServiceClassLoader classloader = new RMIServiceClassLoader(targetJavaInterface.getClassLoader()); final byte[] byteCode = generateRemoteInterface(targetJavaInterface); - targetJavaInterface = classloader.defineClass(byteCode); + targetJavaInterface = classloader.defineClass(targetJavaInterface.getName(), byteCode); enhancer.setClassLoader(classloader); } enhancer.setInterfaces(new Class[] {targetJavaInterface}); @@ -151,7 +152,7 @@ public class RMIServiceBindingProvider implements ServiceBindingProvider { * caller of this method, since it requires a ClassLoader to be created to define and load this interface. */ protected byte[] generateRemoteInterface(Class serviceInterface) { - String interfazeName = serviceInterface.getCanonicalName(); + String interfazeName = serviceInterface.getName(); ClassWriter cw = new ClassWriter(false); String simpleName = serviceInterface.getSimpleName(); @@ -194,8 +195,8 @@ public class RMIServiceBindingProvider implements ServiceBindingProvider { super(parent); } - public Class defineClass(byte[] byteArray) { - return defineClass(null, byteArray, 0, byteArray.length); + public Class defineClass(String name, byte[] byteArray) { + return super.defineClass(name, byteArray, 0, byteArray.length); } } -- cgit v1.2.3