在 armhf 上启用 JProfiler 时出现 UnsatisfiedLinkError
UnsatisfiedLinkError when enabling JProfiler on armhf
我正在尝试在 docker 容器中启动 JProfiler 代理 运行 在 Raspberry PI 3 上。这是完整的 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)
当我从 jshell
调用 System.loadLibrary("attach")
时,本机库似乎加载正常。有什么想法可能导致此异常吗?
已通过 support@ej-technologies.com
解决 - 如果您将正确的文件放入 lib/libattach.so
,您可以将以下代码片段添加到 Dockerfile 以使其工作。
对 armhf 的官方支持计划与 11.0.1
一起发布。
# ...
# Add ARMHF remote attach library (acquired via EJ Technologies support)
# See
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" ]
特别感谢 Ingo Kegel!
我正在尝试在 docker 容器中启动 JProfiler 代理 运行 在 Raspberry PI 3 上。这是完整的 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)
当我从 jshell
调用 System.loadLibrary("attach")
时,本机库似乎加载正常。有什么想法可能导致此异常吗?
已通过 support@ej-technologies.com
解决 - 如果您将正确的文件放入 lib/libattach.so
,您可以将以下代码片段添加到 Dockerfile 以使其工作。
对 armhf 的官方支持计划与 11.0.1
一起发布。
# ...
# Add ARMHF remote attach library (acquired via EJ Technologies support)
# See
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" ]
特别感谢 Ingo Kegel!