Использование JNI4Net для вызова C # dll - PullRequest
0 голосов
/ 04 сентября 2018

Я работаю над интеграцией сторонней DLL с нашим программным обеспечением (на платформе Java). Выполнил действия, указанные в https://www.youtube.com/watch?v=8OoSK_RWUe4, и обнаружил ошибку при запуске proxygen.exe. Я пытался искать разрешения в течение 2 дней и не смог найти ничего полезного. (http://www.codinghouse.org/calling-net-dll-from-java/#comment-395512) (https://groups.google.com/forum/#!topic/jni4net/43HbWrRvZRA)

Ниже находится трассировка стека

D:\jni4net-0.8.8.0-bin\bin>.\proxygen.exe "D:\VBProjects\FirstCsharp\helloworld\helloworld\bin\Debug\helloworld.dll" -wd "C:\workspace\CSharpJavaProject"
jni4net.proxygen - Copyright (C) 2009 Pavel Savara - licensed under GPLv3</p>

<p>Proxygen must be run as trusted assembly! (shared drive could cause the problem)</p>

<p>System.TypeInitializationException: The type initializer for 'net.sf.jni4net.proxygen.model.Repository' threw an exception. ---> System.IO.FileLoadException: Could not load file or assembly 'jni4net.n-0.8.8.0, Version=0.8.8.0, Culture=neutral, PublicKeyToken=134a23405600bab4' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515) ---> System.IO.FileLoadException: Could not load file or assembly 'file:///D:\jni4net-0.8.8.0-bin\lib\jni4net.n-0.8.8.0.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515) ---> System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See <a href="http://go.microsoft.com/fwlink/?LinkId=155569" rel="nofollow noreferrer">http://go.microsoft.com/fwlink/?LinkId=155569</a> for more information.
   --- End of inner exception stack trace ---
   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
   at System.Reflection.Assembly.LoadFrom(String assemblyFile)
   at net.sf.jni4net.proxygen.Program.AssemblyResolve(Object sender, ResolveEventArgs args)
   at System.AppDomain.OnAssemblyResolveEvent(RuntimeAssembly assembly, String assemblyFullName)
   --- End of inner exception stack trace ---
   at net.sf.jni4net.proxygen.model.Repository..cctor()
   --- End of inner exception stack trace ---
   at net.sf.jni4net.proxygen.Program.Work(String[] args)
   at net.sf.jni4net.proxygen.Program.Main(String[] args)
В соответствии с вашим предложением настроенные переменные Path и% JAVA_HOME% \ bin 2 env по-прежнему не работают. Это экземпляр сервера Windows EC2 2016 (64-разрядная версия)

Можете ли вы помочь мне с этим материалом, чтобы он заработал?

...