Caused by: java.lang.UnsatisfiedLinkError: /tmp/snappy-1.1.7-4a4b576a-c34c-481e-b6ac-9b4abacb112e-libsnappyjava.so: Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by /tmp/snappy-1.1.7-4a4b576a-c34c-481e-b6ac-9b4abacb112e-libsnappyjava.so) nested exception is java.lang.NoClassDefFoundError: Could not initialize class org.xerial.snappy.Snappy org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class org.xerial.snappy.Snappy
因爲項目中使用了org.xerial.snappy.Snappy
這個類,在正常的centos系統環境下,沒有問題;在微服務容器(openjdk:8-jdk-alpine)測試的時候發現有一個功能不正常,爬出了以上重要的日誌java
發現org.xerial.snappy.Snappy
這個類沒法初始化,日誌往上查發現了真實的狀況,即java.lang.UnsatisfiedLinkError: /tmp/snappy-1.1.7-4a4b576a-c34c-481e-b6ac-9b4abacb112e-libsnappyjava.so: Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by /tmp/snappy-1.1.7-4a4b576a-c34c-481e-b6ac-9b4abacb112e-libsnappyjava.so
linux
經過這個信息能夠定位出是未找到ld-linux-x86-64.so庫
git
因爲openjdk:8-jdk-alpine容器使用的是Alpine Linux,經多方查找,能夠使用如下方式解決github
建立軟鏈接,若是/lib目錄下有linux-x86-64.so.2能夠不用執行後邊的操做,沒有則須要繼續安裝
ln -s /lib /lib64
web
並安裝多個庫
apk add --no-cache bash tini libc6-compat linux-pam krb5 krb5-libs
spring
bash不是必須的,只是用起來方便apache
最後添加到Dockerfile中以下
centos
https://issues.apache.org/jira/browse/SPARK-26995
https://github.com/apache/spark/pull/23898
https://github.com/rluta/spark/commit/f3f3b6353874bd19aa5c720a4a55ccebf29cafb1bash