2

我正在尝试使用 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)
4

1 回答 1

0

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

于 2013-07-15T07:34:47.617 回答