jni4net - System.Runtime.Remoting.RemotingException

时间:2013-07-11 15:34:35

标签: java c# .net remoting jni4net

我正在尝试使用Java / .NET桥与服务器进行通信。这座桥是用jni4net构建的,似乎有效(到目前为止)。

  public static void main(String[] args) {
    File sibDll = new File("SibKernel.Client.j4n.dll");

    Bridge.setVerbose(true);
    Bridge.setClrVersion("v20");    

    try {
      Bridge.init();

      Bridge.LoadAndRegisterAssemblyFrom(sibDll);

    } catch (IOException e) {
      e.printStackTrace();
    }

    if (SibKernelHelper.isConfigured() == false) {
      SibKernelHelper.Configure();
    }

    IMasterBoardManager mstrBoardMngr = SibKernelHelper.GetMasterBoardManager();
  }

我真的不知道问题是什么。有没有人遇到像这样的问题?

以下是完整的异常堆栈跟踪:

Exception in thread "main" System.Runtime.Remoting.RemotingException: Cannot load type 'net.sf.jni4net.jni.IJvmProxy, jni4net.n-0.8.6.0, Version=0.8.6.0, Culture=neutral, PublicKeyToken=134a23405600bab4'.

Server stack trace: 
   at System.Runtime.Remoting.Messaging.MethodCall.ResolveMethod(Boolean bThrowIfNotResolved)
   at System.Runtime.Remoting.Messaging.MethodCall..ctor(Object handlerObject, BinaryMethodCallMessage smuggledMsg)
   at System.Runtime.Serialization.Formatters.Binary.BinaryMethodCall.ReadArray(Object[] callA, Object handlerObject)
   at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
   at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
   at System.Runtime.Remoting.Channels.CoreChannel.DeserializeBinaryRequestMessage(String objectUri, Stream inputStream, Boolean bStrictBinding, TypeFilterLevel securityLevel)
   at System.Runtime.Remoting.Channels.BinaryServerFormatterSink.ProcessMessage(IServerChannelSinkStack sinkStack, IMessage requestMsg, ITransportHeaders requestHeaders, Stream requestStream, IMessage& responseMsg, ITransportHeaders& responseHeaders, Stream& responseStream)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at net.sf.jni4net.jni.IJvmProxy.get_JvmHandle()
   at net.sf.jni4net.utils.Convertor.FullC2J[TBoth](JNIEnv env, TBoth obj)
   at SibKernel.Client.__SibKernelHelper.GetMasterBoardManager6(IntPtr __envp, JniLocalHandle __class)
    at sibkernel.client.SibKernelHelper.GetMasterBoardManager(Native Method)
    at client.SIBClient.main(SIBClient.java:28)

1 个答案:

答案 0 :(得分:0)

您似乎正在尝试实例化某些继承或依赖于jni4net的类型,但问题发生在.NET远程处理的另一端。 您可能正在将Java对象的实例作为远程调用的参数传递。