日期:2014-05-16 浏览次数:20564 次
安装DB2后,切换到db2inst1用户后,执行命令"db2cc",出现以下错误。
?
Xlib: connection to ":0.0" refused by server Xlib: No protocol specified Exception in thread "main" java.lang.NoClassDefFoundError: sun.awt.X11.XToolkit (initialization failure) at java.lang.J9VMInternals.initialize(J9VMInternals.java:130) at java.lang.Class.forNameImpl(Native Method) at java.lang.Class.forName(Class.java:130) at java.awt.Toolkit$2.run(Toolkit.java:864) at java.security.AccessController.doPrivileged(AccessController.java:193) at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:847) at javax.swing.UIManager.initialize(UIManager.java:1296) at javax.swing.UIManager.maybeInitialize(UIManager.java:1279) at javax.swing.UIManager.getDefaults(UIManager.java:590) at javax.swing.UIManager.get(UIManager.java:852) at com.ibm.db2.tools.common.CommonUIManager.initialize(Unknown Source) at CC.setLookAndFeel(Unknown Source) at CC.<init>(Unknown Source) at CC.main(Unknown Source) Caused by: java.lang.InternalError: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable. at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method) at sun.awt.X11GraphicsEnvironment.access$000(X11GraphicsEnvironment.java:95) at sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:184) at java.security.AccessController.doPrivileged(AccessController.java:193) at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:173) at java.lang.J9VMInternals.initializeImpl(Native Method) at java.lang.J9VMInternals.initialize(J9VMInternals.java:192) at java.lang.Class.forNameImpl(Native Method) at java.lang.Class.forName(Class.java:130) at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:101) at sun.awt.X11.XToolkit.<clinit>(XToolkit.java:127) at java.lang.J9VMInternals.initializeImpl(Native Method) at java.lang.J9VMInternals.initialize(J9VMInternals.java:192) at java.lang.Class.forNameImpl(Native Method) at java.lang.Class.forName(Class.java:130) at java.awt.Toolkit$2.run(Toolkit.java:864) at java.security.AccessController.doPrivileged(AccessController.java:193) at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:847) at javax.swing.ImageIcon.<init>(ImageIcon.java:149) at javax.swing.ImageIcon.<init>(ImageIcon.java:168) at com.ibm.db2.tools.common.CommonImageRepository.loadImageFromURL(Unknown Source) at com.ibm.db2.tools.common.CommonImageRepository.loadImage(Unknown Source) at com.ibm.db2.tools.common.CommonImageRepository.loadImage(Unknown Source) at com.ibm.db2.tools.common.CommonImageRepository.getCommonIcon(Unknown Source) at com.ibm.db2.tools.hc.gui.HealthCenterLegendAction.<init>(Unknown Source) at CC.getViewMenuActions(Unknown Source) at CC.getRegisteredToolsActions(Unknown Source) ... 2 more DB2JAVIT : RC = 1
?
开始百度,有的说jdk版本不对,还怀疑没有安装控制中心。
在CSDN上有人问同样的问题,说啥的都有,最后有人给出答案。。超级简单啊。
?
1. 以root 执行 xhost + 2. 以root 执行 env, 看一下DISPLAY 值是什么, 如 :1 3. su - db2inst1 4. export DISPLAY= 同root 下的变量 5. xhost + 6. db2cc
?查看后我的DISPLAY都是:0.0,分别执行xhost +后,一切正常了。
?
?