java.lang.ClassNotFoundException: org.springframework.remoting.rmi.RmiInvocationWrapper_Stub

org.springframework.remoting.RemoteLookupFailureException: Lookup of RMI stub failed; nested exception is java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
 java.lang.ClassNotFoundException: org.springframework.remoting.rmi.RmiInvocationWrapper_Stub (no security manager: RMI class loader disabled)

该异常发生在dubbo调用采用rmi协议调用接口时发生。异常的根本原因在于spring2和spring3源码的差异,去掉了RmiInvocationWrapper_Stub该类,可以从源码中拷出来打jar包从新部署。

package org.springframework.remoting.rmi;

import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.rmi.MarshalException;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.rmi.UnexpectedException;
import java.rmi.UnmarshalException;
import java.rmi.server.Operation;
import java.rmi.server.RemoteCall;
import java.rmi.server.RemoteObject;
import java.rmi.server.RemoteRef;
import java.rmi.server.RemoteStub;
import org.springframework.remoting.support.RemoteInvocation;

public final class RmiInvocationWrapper_Stub extends RemoteStub
  implements RmiInvocationHandler
{
  private static final Operation[] operations = { new Operation("java.lang.String getTargetInterfaceName()"), new Operation("java.lang.Object invoke(org.springframework.remoting.support.RemoteInvocation)") };
  private static final long interfaceHash = -1910731558L;
  private static final long serialVersionUID = 2L;
  private static boolean useNewInvoke;
  private static Method $method_getTargetInterfaceName_0;
  private static Method $method_invoke_1;

  static
  {
    try
    {
      tmp48_45.getMethod("invoke", new Class[] { Remote.class, Method.class, RmiInvocationWrapper_Stub.array$Ljava$lang$Object = class$("[Ljava.lang.Object;"), Long.TYPE });
      useNewInvoke = true;
      $method_getTargetInterfaceName_0 = RmiInvocationHandler.class.getMethod("getTargetInterfaceName", new Class[0]);
      $method_invoke_1 = tmp194_191.getMethod("invoke", new Class[] { RemoteInvocation.class });
    }
    catch (NoSuchMethodException localNoSuchMethodException)
    {
      useNewInvoke = false;
    }
  }

  public RmiInvocationWrapper_Stub(RemoteRef paramRemoteRef)
  {
    super(paramRemoteRef);
  }

  public String getTargetInterfaceName()
    throws RemoteException
  {
    try
    {
      String str;
      if (useNewInvoke)
      {
        localObject1 = this.ref.invoke(this, $method_getTargetInterfaceName_0, null, 370039408L);
        return ((String)localObject1);
      }
      Object localObject1 = this.ref.newCall(this, operations, 0, -1910731558L);
      this.ref.invoke((RemoteCall)localObject1);
      try
      {
        ObjectInput localObjectInput = ((RemoteCall)localObject1).getInputStream();
        str = (String)localObjectInput.readObject();
      }
      catch (IOException localIOException)
      {
        throw new UnmarshalException("error unmarshalling return", localIOException);
      }
      catch (ClassNotFoundException localClassNotFoundException)
      {
        throw new UnmarshalException("error unmarshalling return", localClassNotFoundException);
      }
      finally
      {
        this.ref.done((RemoteCall)localObject1);
      }
      return str;
    }
    catch (RuntimeException localRuntimeException)
    {
      throw localRuntimeException;
    }
    catch (RemoteException localRemoteException)
    {
      throw localRemoteException;
    }
    catch (Exception localException)
    {
      throw new UnexpectedException("undeclared checked exception", localException);
    }
  }

  public Object invoke(RemoteInvocation paramRemoteInvocation)
    throws IllegalAccessException, NoSuchMethodException, InvocationTargetException, RemoteException
  {
    try
    {
      Object localObject2;
      if (useNewInvoke)
      {
        localObject1 = this.ref.invoke(this, $method_invoke_1, new Object[] { paramRemoteInvocation }, -1509252135L);
        return localObject1;
      }
      Object localObject1 = this.ref.newCall(this, operations, 1, -1910731558L);
      try
      {
        ObjectOutput localObjectOutput = ((RemoteCall)localObject1).getOutputStream();
        localObjectOutput.writeObject(paramRemoteInvocation);
      }
      catch (IOException localIOException1)
      {
        throw new MarshalException("error marshalling arguments", localIOException1);
      }
      this.ref.invoke((RemoteCall)localObject1);
      try
      {
        ObjectInput localObjectInput = ((RemoteCall)localObject1).getInputStream();
        localObject2 = localObjectInput.readObject();
      }
      catch (IOException localIOException2)
      {
        throw new UnmarshalException("error unmarshalling return", localIOException2);
      }
      catch (ClassNotFoundException localClassNotFoundException)
      {
        throw new UnmarshalException("error unmarshalling return", localClassNotFoundException);
      }
      finally
      {
        this.ref.done((RemoteCall)localObject1);
      }
      return localObject2;
    }
    catch (RuntimeException localRuntimeException)
    {
      throw localRuntimeException;
    }
    catch (RemoteException localRemoteException)
    {
      throw localRemoteException;
    }
    catch (IllegalAccessException localIllegalAccessException)
    {
      throw localIllegalAccessException;
    }
    catch (NoSuchMethodException localNoSuchMethodException)
    {
      throw localNoSuchMethodException;
    }
    catch (InvocationTargetException localInvocationTargetException)
    {
      throw localInvocationTargetException;
    }
    catch (Exception localException)
    {
      throw new UnexpectedException("undeclared checked exception", localException);
    }
  }
}

 

转载于:https://www.cnblogs.com/miceal/p/4479880.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值