案例说明:
在UOS系统下部署KingbaseES V8R6数据库时,出现Java错误,部署失败。
系统版本:
kingbase@srv01:~$ cat /etc/os-release
PRETTY_NAME="UnionTech OS Server 20 "
NAME="UnionTech OS Server 20 "
VERSION_ID="20"
VERSION="20"
ID=UOS
HOME_URL="https://www.chinauos.com/"
BUG_REPORT_URL="http://bbs.chinauos.com"
VERSION_CODENAME=fou
数据库版本:
KingbaseES V8R6
一、问题现象
如下图所示,在执行部署时出现以下java故障:
执行部署:
kingbase@srv01:/mnt$ sh setup.sh
Now launch installer...
tee: /home/kingbase/.installer.log: 权限不够
Preparing to install
Extracting the JRE from the installer archive...
Unpacking the JRE...
Extracting the installation resources from the installer archive...
Configuring the installer for this system's environment...
Verifying JVM........
Launching installer...
Graphical installers are not supported by the VM. The console mode should be used instead...
===============================================================================
KingbaseES V9 (使用 InstallAnywhere 创建)
-------------------------------------------------------------------------------
正在准备控制台模式安装...
Invocation of this Java Application has caused an InvocationTargetException. This application will now exit. (LAX)
Stack Trace:
java.lang.NullPointerException
at com.zerog.ia.installer.LifeCycleManager.dh(Unknown Source)
at com.zerog.ia.installer.LifeCycleManager.consoleInstallMain(Unknown Source)
at com.zerog.ia.installer.LifeCycleManager.executeApplication(Unknown Source)
at com.zerog.ia.installer.Main.main(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.zerog.lax.LAX.launch(Unknown Source)
at com.zerog.lax.LAX.main(Unknown Source)
This Application has Unexpectedly Quit: Invocation of this Java Application has caused an InvocationTargetException. This application will now exit. (LAX)
cat: /home/kingbase/.installer.log: 没有那个文件或目录
Complete.
二、问题分析
1、查看系统java版本
kingbase@srv01:/mnt$ java -version
openjdk version "11.0.9.1" 2020-11-04
OpenJDK Runtime Environment (build 11.0.9.1+1-post-Uos-1deb10u2)
OpenJDK 64-Bit Server VM (build 11.0.9.1+1-post-Uos-1deb10u2, mixed mode)
2、升级java版本
下载java二进制版本后,解压,配置/etc/profile:
#java conf
export JAVA_HOME=/deepin/userdata/opt/jdk-22
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib:$CLASSPATH
export JAVA_PATH=${JAVA_HOME}/bin:${JRE_HOME}/bin
export PATH=${JAVA_PATH}:$PATH
JAVA 版本:
kingbase@srv01:~$ java -version
openjdk version "22" 2024-03-19
OpenJDK Runtime Environment (build 22+36-2370)
OpenJDK 64-Bit Server VM (build 22+36-2370, mixed mode, sharing)
3、执行部署
如下图所示,故障依旧:
4、查看数据库用户kingbase属性
如下所示,kingbase用户的宿主目录是root:
kingbase@srv01:~$ ls -lhd /home/kingbase/
drwxr-xr-x 30 root root 4.0K 4月 8 11:27 /home/kingbase/
修改宿主目录所有者:
kingbase@srv01:~$ ls -lhd /home/kingbase/
drwxr-xr-x 30 kingbase kingbase 4.0K 4月 8 11:27 /home/kingbase/
5、重新部署,部署成功!
三、问题总结
从以上操作可知,此问题应该和java版本没有关系,是数据库用户的属主问题导致,无法正常访问java环境。