OR-Tools, Spring Boot and Tomcat

377 views
Skip to first unread message

R2 D2

unread,
Apr 4, 2021, 6:14:07 AM4/4/21
to or-tools-discuss

I have OR-Tools v8.1.8487 application using Spring Boot platform.
The application works very well on spring embedded Tomcat server when run from VSCODE.
However, when I deploy .war file on standalone Tomcat v9.0.44 installation, it throws the following exception:

java.lang.UnsatisfiedLinkError: com.google.ortools.constraintsolver.mainJNI.swig_module_init()V

I have VS2019 redistributable installed.
Using Dependency Walker on jniortools.dll file I have created Tomcat's bin\setenv.bat file to set CATALINA_OPTS:

set CATALINA_OPTS=-Djava.library.path="%ProgramFiles%"\Java\jdk-12\bin;%SystemRoot%\system32;%SystemRoot%;"%CommonProgramFiles(x86)%"\Oracle\Java\javapath;%SystemRoot%\System32\Wbem;%SystemRoot%\System32\OpenSSH;

All that didn't solve the problem. I ran out of ideas. Perhaps someone came across similar problem and could share some tips.


R2 D2

unread,
Apr 6, 2021, 2:36:00 AM4/6/21
to or-tools-discuss
Problem solved.
Loader.loadNativeLibraries() should be called in ServletInitializer.configure() method.
Calling it in spring boot application's main method doesn't work as it is not being called by the standalone Tomcat server.

Laurent Perron

unread,
Apr 6, 2021, 3:26:13 AM4/6/21
to or-tools-discuss
nice
Laurent Perron | Operations Research | lpe...@google.com | (33) 1 42 68 53 00



--
You received this message because you are subscribed to the Google Groups "or-tools-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to or-tools-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/or-tools-discuss/a54040b7-6650-4c1d-be19-47bcde0378aan%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages