12 Feb 2020 08:22 AM
Hi,
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.
Log:
File "/opt/dynatrace/oneagent/agent/conf/runtime/engine_unpacked/ruxit/plugin_state_machine.py", line 301, in _execute_next_task
self._query_plugin()
File "/opt/dynatrace/oneagent/agent/conf/runtime/engine_unpacked/ruxit/plugin_state_machine.py", line 607, in _query_plugin
self._plugin_run_data.plugin_instance._query_internal(**self._plugin_run_data.plugin_args)
File "/opt/dynatrace/oneagent/agent/conf/runtime/engine_unpacked/ruxit/api/base_plugin.py", line 354, in _query_internal
return self.query(**kwargs)
File "/opt/dynatrace/oneagent/plugin_deployment/custom.python.azure_db99_plugin/azure_db99_plugin.py", line 25, in query
import py2jdbc
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>
import py2jdbc.jni
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?
Cheers,
Laura
Solved! Go to Solution.
12 Feb 2020 08:55 AM
Does dtuser (which is used to execute plugins) have access to the directory/file?
12 Feb 2020 11:49 AM
As Michael said, if your plugin is trying to reach this library, and you're sure that this file exists in filesystem, then next question will be about permissions for dtuser. You may need to add dtuser to proper group on OS level to make it work.
Sebastian
14 Feb 2020 06:47 AM
Hi,
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.