Loading a shared native library in Tomcat on Ubuntu

◇◆丶佛笑我妖孽 提交于 2019-12-06 00:06:35

Make sure that Tomcat's startup script--catalina.sh in /var/lib/tomcat6/bin--is actually using the JAVA_OPTS from the environment. In the script on the system I'm looking at now, someone put in a complete definition without pulling in the environment setting.

I think this may have been a mistake on my part. When I originally compiled the library, it had a different name ("libawargrids.so"), so I renamed it with:

mv libawragrids.so libawratools.so

While the equivalent seems to work on Windows, perhaps it doesn't work on Linux. When I compiled it again using the name "awratools" (producing "libawratools.so), the problem went away.

While the problem is now fixed, if someone could confirm that the renaming is probably what caused it (and perhaps explain why), that would be appreciated.

Sorry for wasting peoples time but thanks for the help!

P.S. I have now placed the lines:

export JAVA_OPTS="-Djava.library.path=/var/lib/tomcat7/shared"
export LD_LIBRARY_PATH=/var/lib/tomcat7/shared

at the top of /etc/init.d/tomcat6, so it does not matter which user starts the service. Please let me know if this is, for some reason, bad.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!