在Alpine / Jprofile 10中运行jpenable时出现UnsatisfiedLinkError [英] UnsatisfiedLinkError when running jpenable in alpine / Jprofile 10

查看:155
本文介绍了在Alpine / Jprofile 10中运行jpenable时出现UnsatisfiedLinkError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在运行JDK 8的alpine:3.3容器中运行jpenable以允许对Jprofiler10进行性能分析时,出现UnsatisfiedLinkError异常。有想法吗?

When running jpenable to permit profiling for Jprofiler10 in an alpine:3.3 container running JDK 8, I'm getting an UnsatisfiedLinkError exception. Any ideas?

ERROR: The agent could not be loaded: Picked up _JAVA_OPTIONS: -Xmx1024m
Exception in thread "main" java.lang.UnsatisfiedLinkError: /opt/jprofiler10/bin/
linux-x64/libattach.so: Error relocating /opt/jprofiler10/bin/linux-x64/libattac
h.so: __strcpy_chk: symbol not found
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
at java.lang.Runtime.load0(Runtime.java:809)
at java.lang.System.load(System.java:1086)
at com.jprofiler.attach.b.b.b.load(ejt:6)
at com.jprofiler.attach.b.b.i.loadLibraryPath(ejt:49)
at com.jprofiler.attach.a.b(ejt:92)
at com.jprofiler.attach.a.a(ejt:74)
at com.jprofiler.attach.a.main(ejt:116)


推荐答案

因此,我将回答我自己的问题。

So, I'll answer my own question.

首先-我注意到ldd显示了MOST在alpine:3.5 openjdk8-jre包中,所有Java本机库都被破坏(不解析依赖库)。我在这里找到了配置加载库路径的解决方案: https://github.com/ docker-library / openjdk / issues / 77

First - I noticed that ldd showed MOST of the java native libraries were broken (not resolving dependent libraries) in the alpine:3.5 openjdk8-jre package. I found a solution to configure the load library path here: https://github.com/docker-library/openjdk/issues/77

使用以下内容创建/etc/ld-musl-x86_64.path解决了大多数库问题

Creating a /etc/ld-musl-x86_64.path with the following content fixed most of the library problems that I found with ldd.

/lib
/usr/lib
/usr/local/lib
/usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64
/usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/jli
/usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/server
/opt/jprofiler10.1.1/bin/linux-x64/

但是Jprofiler10 tar文件中提供的/opt/jprofiler10.1.1/bin/linux-x64/libattach.so仍然损坏,因此我将其删除-并使用了/usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64目录中包含的libattach.so。

However the /opt/jprofiler10.1.1/bin/linux-x64/libattach.so provided in the Jprofiler10 tar file was still broken, so I deleted it - and used the libattach.so contained in the /usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64 directory.

以下Dockerfile显示了我如何构建容器-并解决了问题。

The following Dockerfile shows how I built the container - and fixed the problems.

FROM alpine:3.5
RUN apk --no-cache add \
    openjdk8-jre-base \
    libstdc++
COPY ld-musl-x86_64.path /etc/ld-musl-x86_64.path
ADD jprofiler_linux_10_1_1.tar /opt/
RUN rm /opt/jprofiler10.1.1/bin/linux-x64/libattach.so 

此后-我能够将容器放到牧场主中。

After this - I was able to bring the container up in rancher.

最后步骤是将Shell执行到容器中并运行jpenable以启用Jprofiler工具创建与jvm的连接。

The final steps were to exec shell into the container and run jpenable to enable the Jprofiler tool to create a connection to the jvm.

例如/opt/jprofiler10.1.1/bin/jpenable

e.g. /opt/jprofiler10.1.1/bin/jpenable

然后我可以在端口8849上连接并分析应用程序。

I was able to then connect on port 8849 and profile the application.

这篇关于在Alpine / Jprofile 10中运行jpenable时出现UnsatisfiedLinkError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆