java - 在 armhf 上启用 JProfiler 时出现 UnsatisfiedLinkError
问题描述
我正在尝试在 Raspberry PI 3 上运行的 docker 容器中启动 JProfiler 代理。这是完整的 Dockerfile。
FROM balenalib/raspberrypi3-openjdk
RUN ["cross-build-start"]
RUN curl -SL http://download-keycdn.ej-technologies.com/jprofiler/jprofiler_linux_11_0.tar.gz | tar -xz -C /usr/local && \
echo 'sudo -u root /usr/local/jprofiler11.0/bin/jpenable -g -p 8849' > /jprofile.sh && \
chmod +x /jprofile.sh
RUN [ "cross-build-end" ]
ENV JPAGENT_PATH="-agentpath:/usr/local/jprofiler11.0/bin/linux-armhf/libjprofilerti.so=nowait"
ENV JAVA_OPTS=""
EXPOSE 8849
ADD build/libs/myproject-0.0.1-SNAPSHOT.jar /app.jar
ENTRYPOINT exec java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /app.jar
对于分析,运行:
docker exec -it mycontainer /bin/bash -c "/jprofile.sh"
这是完整的输出:
Connecting to app.jar [1] ... ERROR: The agent could not be loaded: Exception in thread "main" java.lang.UnsatisfiedLinkError: sun.tools.attach.LinuxVirtualMachine.isLinuxThreads()Z
at sun.tools.attach.LinuxVirtualMachine.isLinuxThreads(Native Method)
at sun.tools.attach.LinuxVirtualMachine.<clinit>(LinuxVirtualMachine.java:343)
at sun.tools.attach.LinuxAttachProvider.attachVirtualMachine(LinuxAttachProvider.java:63)
at com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:195)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at com.jprofiler.attach.proxy.a.e$b.invoke(ejt:110)
at com.sun.proxy.$Proxy0.attach(Unknown Source)
at com.jprofiler.attach.a.main(ejt:119)
当我System.loadLibrary("attach")
从jshell
. 任何想法可能导致此异常?
解决方案
通过解决support@ej-technologies.com
- 如果您将正确的文件放入lib/libattach.so
,您可以将以下代码段添加到 Dockerfile 以使其工作。
对 armhf 的官方支持计划与11.0.1
.
# ...
# Add ARMHF remote attach library (acquired via EJ Technologies support)
# See https://stackoverflow.com/questions/56307915/unsatisfiedlinkerror-when-enabling-jprofiler-on-armhf
ADD lib/libattach.so /usr/local/jprofiler11.0/bin/linux-armhf/
RUN chmod a+x /usr/local/jprofiler11.0/bin/linux-armhf/libattach.so
RUN [ "cross-build-end" ]
特别感谢英戈凯格尔!
推荐阅读
- javascript - 如何在 React js 中编辑本地存储中的数组数据
- java - 如何制作用户可以选择使用哪个选项的程序?
- spring-boot - 包含西里尔字母的附件名称在 gmail 中以加密形式显示
- sql - 如何在 SQL Server 中查找特定字符串的多次出现并获取值
- excel - Excel VBA 数组列排序
- python - 为什么这个函数会影响一个甚至没有传递给它的变量?
- postgresql - postgresql 从两行创建一行
- vuejs2 - 如何将活动类添加到特定 div
- ruby-on-rails - 如何使用 curl 发布而不收到 HTTP 错误 422 'Unprocessable Entity'?
- vba - Word 宏:从文件夹导入/格式化图像并删除多余的页面