Originally posted by: SystemAdmin
Hi everybody, I'm trying to use the x64 CPLEX .NET/Java library to practice a bit with the APIs. I successfully imported the oplall.dll library in my projects, but I'm getting a dynamic library linking error.
Here is the log while using the .NET library:
System.TypeInitializationException was unhandled Message=The type initializer
for
'ILOG.OPL.OplFactory' threw an exception. Source=oplall TypeName=ILOG.OPL.OplFactory StackTrace: at ILOG.OPL.OplFactory..ctor() at deadlines.Program.Main(String[] args) in C:\...\Program.cs:line 20 at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException: System.TypeInitializationException Message=The type initializer
for
'ILOG.OPL.opl_lang_wrap' threw an exception. Source=oplall TypeName=ILOG.OPL.opl_lang_wrap StackTrace: at ILOG.OPL.opl_lang_wrap.touch() at ILOG.OPL.OplFactory..cctor() InnerException: System.TypeInitializationException Message=The type initializer
for
'SWIGIloExceptionHelper' threw an exception. Source=oplall TypeName=SWIGIloExceptionHelper StackTrace: at ILOG.OPL.opl_lang_wrap.SWIGIloExceptionHelper..ctor() at ILOG.OPL.opl_lang_wrap..cctor() InnerException: System.TypeInitializationException Message=The type initializer
for
'ILOG.OPL.opl_lang_wrapPINVOKE' threw an exception. Source=oplall TypeName=ILOG.OPL.opl_lang_wrapPINVOKE StackTrace: at ILOG.OPL.opl_lang_wrapPINVOKE.SWIGRegisterIloExceptionCallbacks_opl_lang_wrap(SWIGIloExceptionDelegate iloExceptionDelegate, SWIGIloExceptionDelegate iloOplExceptionDelegate) at ILOG.OPL.opl_lang_wrap.SWIGIloExceptionHelper..cctor() InnerException: System.TypeInitializationException Message=The type initializer
for
'SWIGExceptionHelper' threw an exception. Source=oplall TypeName=SWIGExceptionHelper StackTrace: at ILOG.OPL.opl_lang_wrapPINVOKE.SWIGExceptionHelper..ctor() at ILOG.OPL.opl_lang_wrapPINVOKE..cctor() InnerException: System.DllNotFoundException Message=Unable to load DLL
'opl124_dotnet': The specified module could not be found. (Exception from HRESULT: 0x8007007E) Source=oplall TypeName=
"" StackTrace: at ILOG.OPL.opl_lang_wrapPINVOKE.SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_opl_lang_wrap(ExceptionDelegate applicationDelegate, ExceptionDelegate arithmeticDelegate, ExceptionDelegate divideByZeroDelegate, ExceptionDelegate indexOutOfRangeDelegate, ExceptionDelegate invalidOperationDelegate, ExceptionDelegate ioDelegate, ExceptionDelegate nullReferenceDelegate, ExceptionDelegate outOfMemoryDelegate, ExceptionDelegate overflowDelegate, ExceptionDelegate systemExceptionDelegate) at ILOG.OPL.opl_lang_wrapPINVOKE.SWIGExceptionHelper..cctor() InnerException:
And this is the (pretty much similar) runtime error which I get when using the Java library:
Native code library failed to load: ensure the appropriate library (opl124.dll/.so) is in your path. Exceptions: C:\Program Files\IBM\ILOG\CPLEX_Studio_Academic124\opl\bin\x64_win64\opl124.dll: Can
't find dependent libraries no opl_lang_wrap_cpp in java.library.path no opl_core_wrap_cpp_java124 in java.library.path no opl_core_wrap_cpp in java.library.path no cp_wrap_cpp_java124 in java.library.path no cp_wrap_cpp in java.library.path no concert_wrap_cpp_java124 in java.library.path no concert_wrap_cpp in java.library.path Exception in thread
"AWT-EventQueue-0" java.lang.ExceptionInInitializerError at ilog.concert.cppimpl.IloEnv.<init>(IloEnv.java:49) at ilog.opl.IloOplFactory.<init>(IloOplFactory.java:70) at test.MainFrame$1.run(MainFrame.java:34) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$000(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) Caused by: java.lang.RuntimeException: Native code library failed to load: ensure the appropriate library (opl124.dll/.so) is in your path. Exceptions: C:\Program Files\IBM\ILOG\CPLEX_Studio_Academic124\opl\bin\x64_win64\opl124.dll: Can
't find dependent libraries no opl_lang_wrap_cpp in java.library.path no opl_core_wrap_cpp_java124 in java.library.path no opl_core_wrap_cpp in java.library.path no cp_wrap_cpp_java124 in java.library.path no cp_wrap_cpp in java.library.path no concert_wrap_cpp_java124 in java.library.path no concert_wrap_cpp in java.library.path at ilog.concert.IloJNILoader.loadJNI(IloJNILoader.java:80) at ilog.concert.cppimpl.concert_wrapJNI.<clinit>(concert_wrapJNI.java:15) ... 17 more
I'm using Windows 7 Ultimate x64. I tried a couple of suggestions which I read on the forum (many others had this same issue):
I added to the PATH environment variable the path "C:\Program Files\IBM\ILOG\CPLEX_Studio_Academic124\opl\bin\x64_win64" where both opl124_dotnet.dll and opl124.dll are.
I also tried in VS 2010 to change the build platform target to x64 (even if this had no impact on the Java version).
Both of them had no effect. Any other ideas?
Regards,
Stefano
#DecisionOptimization#OPLusingCPLEXOptimizer