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);
    }
  }
}
时间: 2024-10-05 05:07:14

java.lang.ClassNotFoundException: org.springframework.remoting.rmi.RmiInvocationWrapper_Stub的相关文章

idea调试SpringMvc, 出现:java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener错误的解决办法

有时,使用idea开发SpringMvc发现调试时出现以下错误: 12-Mar-2017 12:08:02.345 严重 [RMI TCP Connection(2)-127.0.0.1] org.apache.catalina.core.StandardContext.listenerStart Error configuring application listener of class org.springframework.web.context.ContextLoaderListene

Intellij 部署项目java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

报错信息: org.apache.catalina.core.StandardContext.listenerStart Error configuring application listener of class org.springframework.web.context.ContextLoaderListener java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

java.lang.ClassNotFoundException:org.springframework.web.context.ContextLoaderListener问题解决

今天搭建SSH项目的时候出现了例如以下错误: 严重: Error configuring application listener of class org.springframework.web.context.ContextLoaderListener java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener 网上查了一下.有些人说是没有spring的相关包.可是我检查这个包

maven 项目出现 java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

maven 导入项目中经常出现这个问题 严重: Error configuring application listener of class org.springframework.web.context.ContextLoaderListener java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener 在网上找了些资料,有的说是少jar包,把有关spring的jar包复制到

java.lang.ClassNotFoundException: org.springframework.web.content.ContextLoaderListener

1.错误描述 严重: Error configuring application listener of class org.springframework.web.content.ContextLoaderListener java.lang.ClassNotFoundException: org.springframework.web.content.ContextLoaderListener at org.apache.catalina.loader.WebappClassLoaderBa

maven项目出现:Caused by: java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

今天安装和部署maven项目的时候一直都出现这样的错误:  maven项目出现:Caused by: java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener  按照网上的好多都是说spring.jar包什么的问题,但是我这个项目修改了也没有效果的样子,后来自己尝试了一下,发现是maven的包没成功导入项目中: 在eclipse中:如果在这样:右击 Maven project -

java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet

新建Maven 项目的时候报错: java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappC

maven web 项目中启动报错java.lang.ClassNotFoundException: org.springframework.web.util.Log4jConfigListener

本篇文章主要介绍了"maven web 项目中启动报错java.lang.ClassNotFoundException: org.springframework.web.util.Log4jConfigListener ",主要涉及到maven web 项目中启动报错java.lang.ClassNotFoundException: org.springframework.web.util.Log4jConfigListener 方面的内容,对于maven web 项目中启动报错jav

【web.xml】报错java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

今天搭建新的项目,虽然在web.xml中配置了ContextLoaderListener以及IntrospectorCleanupListener 如下: web.xml中部分代码: 1 <!-- 监听servletContext,启动contextConfigLocation中的spring配置信息 --> 2 <listener> 3 <listener-class>org.springframework.web.context.ContextLoaderListe