centos7靜默安裝oracle11gR2報錯java.lang.NoClassDefFoundError,圖形化vnc安裝也報錯

e71hao發表於2015-11-06

一、在shell命令下靜默安裝oracle11gR2
[oracle@centos71 database]$ ./runInstaller -silent  -responseFile /home/oracle/db.rsp  -force
Starting Oracle Universal Installer...
Checking Temp space: must be greater than 120 MB.   Actual 29876 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 2047 MB    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2015-11-06_07-23-28PM. Please wait ...[oracle@centos71 database]$ No protocol specified
Exception in thread "main" java.lang.NoClassDefFoundError
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:164)
        at java.awt.Toolkit$2.run(Toolkit.java:821)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:804)
        at javax.swing.UIManager.initialize(UIManager.java:1262)
        at javax.swing.UIManager.maybeInitialize(UIManager.java:1245)
        at javax.swing.UIManager.getUI(UIManager.java:851)
        at javax.swing.JPanel.updateUI(JPanel.java:104)
        at javax.swing.JPanel.<init>(JPanel.java:64)
        at javax.swing.JPanel.<init>(JPanel.java:87)
        at javax.swing.JPanel.<init>(JPanel.java:95)
        at oracle.sysman.oii.oiif.oiifo.OiifoOCMUI.<init>(OiifoOCMUI.java:125)
        at oracle.sysman.oii.oiif.oiifo.OiifoOCMInterfaceManager.<init>(OiifoOCMInterfaceManager.java:79)
        at oracle.sysman.oii.oiif.oiifo.OiifoOCMInterfaceManager.getInstance(OiifoOCMInterfaceManager.java:124)
        at oracle.install.ivw.db.driver.DBInstaller.run(DBInstaller.java:123)
        at oracle.install.commons.util.Application.startup(Application.java:869)
        at oracle.install.commons.flow.FlowApplication.startup(FlowApplication.java:164)
        at oracle.install.commons.flow.FlowApplication.startup(FlowApplication.java:181)
        at oracle.install.commons.base.driver.common.Installer.startup(Installer.java:265)
        at oracle.install.ivw.db.driver.DBInstaller.startup(DBInstaller.java:114)
        at oracle.install.ivw.db.driver.DBInstaller.main(DBInstaller.java:132)


解決辦法執行命令:$ unset DISPLAY


二、用vnc圖形化安裝oracle。

用root登入連線vnc。進入shell視窗

[root@pro_hk_hk3_hd_base_db_oracle_54 ~]# echo  $DISPLAY

:5

[root@pro_hk_hk3_hd_base_db_oracle_54 ~]# xhost +

access control disabled, clients can connect from any host

[root@pro_hk_hk3_hd_base_db_oracle_54 ~]# su - oracle

Last login: Tue Sep 11 11:52:38 CST 2018 on pts/0

[oracle@pro_hk_hk3_hd_base_db_oracle_54 ~]$ export  DISPLAY=:5


解釋:獲得當前vnc視窗root環境變數DISPLAY的設定,執行 xhost +授權給任何使用者使用圖形介面許可權。

su - oracle ,設定export  DISPLAY=:5。如果這個值設定錯誤就會報錯:

Exception in thread "main" java.lang.NoClassDefFoundError
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:164)

所以要設定準確。


三、總結:出現這個錯誤Exception in thread "main" java.lang.NoClassDefFoundError 有兩種可能:

(1) DISPLAY變數值設定錯誤

(2)在/etc/hosts 沒有配置主機名解析ip地址,要配置上

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/30393770/viewspace-1825067/,如需轉載,請註明出處,否則將追究法律責任。

相關文章