我在运行应用程序时收到消息
java: symbol lookup error: /usr/java/jdk1.7.0_09/jre/lib/amd64/libJdbcOdbc.so: undefined symbol: SQLAllocEnv
该应用程序的目的是使用 Pentaho 水壶 jar 文件将数据从一台服务器迁移到另一台服务器。我在目标服务器上使用 Jdbc-Odbc 连接。我最近从 Oracles 网站安装了 java(jre 和 jdk)。当我设置
export LD_DEBUG=all
我看到以下回复
binding file /usr/java/jdk1.7.0_09/jre/lib/amd64/libJdbcOdbc.so [0] to /lib64/libc.so.6 [0]: normal symbol `__cxa_finalize' [GLIBC_2.2.5]
5193:
5193: calling init: /usr/java/jdk1.7.0_09/jre/lib/amd64/libJdbcOdbc.so
5193:
5193: opening file=/usr/java/jdk1.7.0_09/jre/lib/amd64/libJdbcOdbc.so [0]; direct_opencount=1
5193:
5193: symbol=JNI_OnLoad; lookup in file=/usr/java/jdk1.7.0_09/jre/lib/amd64/libJdbcOdbc.so [0]
5193: symbol=JNI_OnLoad; lookup in file=/usr/java/jdk1.7.0_09/jre/lib/amd64/libjava.so [0]
5193: binding file /usr/java/jdk1.7.0_09/jre/lib/amd64/libJdbcOdbc.so [0] to /usr/java/jdk1.7.0_09/jre/lib/amd64/libjava.so [0]: normal symbol `JNI_OnLoad'
5193: symbol=Java_sun_jdbc_odbc_JdbcOdbc_allocEnv; lookup in file=/usr/java/jdk1.7.0_09/jre/lib/amd64/libjava.so [0]
5193: symbol=Java_sun_jdbc_odbc_JdbcOdbc_allocEnv; lookup in file=/usr/java/jdk1.7.0_09/jre/lib/amd64/server/libjvm.so [0]
5193: symbol=Java_sun_jdbc_odbc_JdbcOdbc_allocEnv; lookup in file=/usr/java/jdk1.7.0_09/jre/lib/amd64/libverify.so [0]
5193: symbol=Java_sun_jdbc_odbc_JdbcOdbc_allocEnv; lookup in file=/lib64/libdl.so.2 [0]
5193: symbol=Java_sun_jdbc_odbc_JdbcOdbc_allocEnv; lookup in file=/lib64/libc.so.6 [0]
5193: symbol=Java_sun_jdbc_odbc_JdbcOdbc_allocEnv; lookup in file=/lib64/libm.so.6 [0]
5193: symbol=Java_sun_jdbc_odbc_JdbcOdbc_allocEnv; lookup in file=/lib64/libpthread.so.0 [0]
5193: symbol=Java_sun_jdbc_odbc_JdbcOdbc_allocEnv; lookup in file=/lib64/ld-linux-x86-64.so.2 [0]
5193: /usr/java/jdk1.7.0_09/jre/lib/amd64/libjava.so: error: symbol lookup error: undefined symbol: Java_sun_jdbc_odbc_JdbcOdbc_allocEnv (fatal)
5193: symbol=Java_sun_jdbc_odbc_JdbcOdbc_allocEnv; lookup in file=/usr/java/jdk1.7.0_09/jre/lib/amd64/libzip.so [0]
5193: symbol=Java_sun_jdbc_odbc_JdbcOdbc_allocEnv; lookup in file=/usr/java/jdk1.7.0_09/jre/lib/amd64/server/libjvm.so [0]
5193: symbol=Java_sun_jdbc_odbc_JdbcOdbc_allocEnv; lookup in file=/usr/java/jdk1.7.0_09/jre/lib/amd64/libjava.so [0]
5193: symbol=Java_sun_jdbc_odbc_JdbcOdbc_allocEnv; lookup in file=/lib64/libc.so.6 [0]
5193: symbol=Java_sun_jdbc_odbc_JdbcOdbc_allocEnv; lookup in file=/lib64/libm.so.6 [0]
5193: symbol=Java_sun_jdbc_odbc_JdbcOdbc_allocEnv; lookup in file=/lib64/libdl.so.2 [0]
5193: symbol=Java_sun_jdbc_odbc_JdbcOdbc_allocEnv; lookup in file=/lib64/libpthread.so.0 [0]
5193: symbol=Java_sun_jdbc_odbc_JdbcOdbc_allocEnv; lookup in file=/lib64/ld-linux-x86-64.so.2 [0]
5193: symbol=Java_sun_jdbc_odbc_JdbcOdbc_allocEnv; lookup in file=/usr/java/jdk1.7.0_09/jre/lib/amd64/libverify.so [0]
5193: /usr/java/jdk1.7.0_09/jre/lib/amd64/libzip.so: error: symbol lookup error: undefined symbol: Java_sun_jdbc_odbc_JdbcOdbc_allocEnv (fatal)
5193: symbol=Java_sun_jdbc_odbc_JdbcOdbc_allocEnv; lookup in file=/usr/java/jdk1.7.0_09/jre/lib/amd64/libnio.so [0]
5193: symbol=Java_sun_jdbc_odbc_JdbcOdbc_allocEnv; lookup in file=/usr/java/jdk1.7.0_09/jre/lib/amd64/libjava.so [0]
5193: symbol=Java_sun_jdbc_odbc_JdbcOdbc_allocEnv; lookup in file=/usr/java/jdk1.7.0_09/jre/lib/amd64/libnet.so [0]
5193: symbol=Java_sun_jdbc_odbc_JdbcOdbc_allocEnv; lookup in file=/lib64/libpthread.so.0 [0]
5193: symbol=Java_sun_jdbc_odbc_JdbcOdbc_allocEnv; lookup in file=/lib64/libdl.so.2 [0]
5193: symbol=Java_sun_jdbc_odbc_JdbcOdbc_allocEnv; lookup in file=/lib64/libc.so.6 [0]
5193: symbol=Java_sun_jdbc_odbc_JdbcOdbc_allocEnv; lookup in file=/usr/java/jdk1.7.0_09/jre/lib/amd64/server/libjvm.so [0]
5193: symbol=Java_sun_jdbc_odbc_JdbcOdbc_allocEnv; lookup in file=/usr/java/jdk1.7.0_09/jre/lib/amd64/libverify.so [0]
5193: symbol=Java_sun_jdbc_odbc_JdbcOdbc_allocEnv; lookup in file=/lib64/ld-linux-x86-64.so.2 [0]
5193: symbol=Java_sun_jdbc_odbc_JdbcOdbc_allocEnv; lookup in file=/lib64/libm.so.6 [0]
5193: /usr/java/jdk1.7.0_09/jre/lib/amd64/libnio.so: error: symbol lookup error: undefined symbol: Java_sun_jdbc_odbc_JdbcOdbc_allocEnv (fatal)
5193: symbol=Java_sun_jdbc_odbc_JdbcOdbc_allocEnv; lookup in file=/usr/java/jdk1.7.0_09/jre/lib/amd64/libJdbcOdbc.so [0]
5193: binding file /usr/java/jdk1.7.0_09/jre/lib/amd64/libJdbcOdbc.so [0] to /usr/java/jdk1.7.0_09/jre/lib/amd64/libJdbcOdbc.so [0]: normal symbol `Java_sun_jdbc_odbc_JdbcOdbc_allocEnv'
5193: symbol=SQLAllocEnv; lookup in file=java [0]
5193: symbol=SQLAllocEnv; lookup in file=/lib64/libpthread.so.0 [0]
5193: symbol=SQLAllocEnv; lookup in file=/usr/java/jdk1.7.0_09/bin/../jre/lib/amd64/jli/libjli.so [0]
5193: symbol=SQLAllocEnv; lookup in file=/lib64/libdl.so.2 [0]
5193: symbol=SQLAllocEnv; lookup in file=/lib64/libc.so.6 [0]
5193: symbol=SQLAllocEnv; lookup in file=/lib64/ld-linux-x86-64.so.2 [0]
5193: symbol=SQLAllocEnv; lookup in file=/usr/java/jdk1.7.0_09/jre/lib/amd64/server/libjvm.so [0]
5193: symbol=SQLAllocEnv; lookup in file=/lib64/libm.so.6 [0]
5193: symbol=SQLAllocEnv; lookup in file=/usr/java/jdk1.7.0_09/jre/lib/amd64/libJdbcOdbc.so [0]
5193: symbol=SQLAllocEnv; lookup in file=/usr/java/jdk1.7.0_09/jre/lib/amd64/libjava.so [0]
5193: symbol=SQLAllocEnv; lookup in file=/usr/java/jdk1.7.0_09/jre/lib/amd64/server/libjvm.so [0]
5193: symbol=SQLAllocEnv; lookup in file=/lib64/libc.so.6 [0]
5193: symbol=SQLAllocEnv; lookup in file=/usr/java/jdk1.7.0_09/jre/lib/amd64/libverify.so [0]
5193: symbol=SQLAllocEnv; lookup in file=/lib64/libdl.so.2 [0]
5193: symbol=SQLAllocEnv; lookup in file=/lib64/libm.so.6 [0]
5193: symbol=SQLAllocEnv; lookup in file=/lib64/libpthread.so.0 [0]
5193: symbol=SQLAllocEnv; lookup in file=/lib64/ld-linux-x86-64.so.2 [0]
5193: /usr/java/jdk1.7.0_09/jre/lib/amd64/libJdbcOdbc.so: error: symbol lookup error: undefined symbol: SQLAllocEnv (fatal)
我已经安装了 unixODBC,这些函数的实现清晰地驻留在 libodbc.so(到 libodbc.so.2.0.0 的符号链接)中,
nm -a /usr/local/lib/libodbc.so | grep "SQLAllocEnv"
0000000000006f30 T SQLAllocEnv
0000000000000000 a SQLAllocEnv.c
我的 LD_LIBRARY_PATH 中有 /usr/local/lib (我做了 export )。我还在 /etc/ld.so.conf.d 中放置了一个新的配置文件并运行 ldconfig。但由于某种原因,此功能(可能还有其他功能)将无法加载。
还
ldd /usr/java/latest/jre/lib/amd64/libJdbcOdbc.so
linux-vdso.so.1 => (0x00007fff09728000)
libjava.so => /usr/java/latest/jre/lib/amd64/libjava.so (0x00007fb8d03ab000)
libjvm.so => not found
libc.so.6 => /lib64/libc.so.6 (0x00007fb8d000d000)
libjvm.so => not found
libverify.so => /usr/java/latest/jre/lib/amd64/libverify.so (0x00007fb8cfdfe000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007fb8cfbfa000)
/lib64/ld-linux-x86-64.so.2 (0x000000368b000000)
libjvm.so => not found
谁能给我任何关于如何解决这个问题的建议。据我了解,当链接器动态解析调用时,它将使用 LD_LIBRARY_PATH 来搜索 elf 文件。这个对吗?是否有某种索引可以用来查找具有所需功能的共享库?我知道创建的 ld.so.cache,但必须有一些索引,即 SQLAllocEnv -> x.so、libodbc.so 等。是什么让链接器在这些特定文件中查找符号?
谢谢