I'm building a python plugin to connect remote azure db from ubuntu docker container, I'm using a python module py2jdbc as a bridge between python and java, during initialisation, this module searches for jvm library libjvm.so then pass the full lib path to ctypes CDLL method to attach jvm.
The problem I'm facing is as shown in below log, the libjvm.so exists but the plugin just can't find it.
File "/opt/dynatrace/oneagent/agent/conf/runtime/engine_unpacked/ruxit/plugin_state_machine.py", line 301, in _execute_next_task
File "/opt/dynatrace/oneagent/agent/conf/runtime/engine_unpacked/ruxit/plugin_state_machine.py", line 607, in _query_plugin
File "/opt/dynatrace/oneagent/agent/conf/runtime/engine_unpacked/ruxit/api/base_plugin.py", line 354, in _query_internal
File "/opt/dynatrace/oneagent/plugin_deployment/custom.python.azure_db99_plugin/azure_db99_plugin.py", line 25, in query
File "/opt/dynatrace/oneagent/plugin_deployment/custom.python.azure_db99_plugin/py2jdbc/__init__.py", line 2, in <module>
from py2jdbc.dbi import (
File "/opt/dynatrace/oneagent/plugin_deployment/custom.python.azure_db99_plugin/py2jdbc/dbi.py", line 6, in <module>
from py2jdbc.wrap import get_env
File "/opt/dynatrace/oneagent/plugin_deployment/custom.python.azure_db99_plugin/py2jdbc/wrap.py", line 4, in <module>
File "/opt/dynatrace/oneagent/plugin_deployment/custom.python.azure_db99_plugin/py2jdbc/jni.py", line 2619, in <module>
libjvm = CDLL('/usr/java/sapjvm_8/jre/lib/amd64/server/libjvm.so')
File "/opt/dynatrace/oneagent/agent/plugin/python3.6/ctypes/__init__.py", line 349, in __init__
self._handle = _dlopen(self._name, mode)
OSError: /usr/java/sapjvm_8/jre/lib/amd64/server/libjvm.so: cannot open shared object file: No such file or directory
Above file indeed exist:
# ls -ltr /usr/java/sapjvm_8/jre/lib/amd64/server/libjvm.so
-rwxr-xr-x 1 root root 28025240 Jul 23 2019 /usr/java/sapjvm_8/jre/lib/amd64/server/libjvm.so
As a comparison, I tested in a self installed python3.6 env also in a ubuntu container, it works. I wonder if this is a problem with the oneagent built-in python env?
Solved! Go to Solution.
I figured out, extension modules have to be placed under the plugin directory, the plugin environment doesn't recognise anything outsidde, e.g environ variables, CLASSPATH, PATH, DL_LIBRARY_PATH...
After copying the .so library to plugin folder, it is able to find it and move forward. Now I'm facing the next issue, it hangs while trying to start JVM or attach current thread to running JVM.