Summary
I can open the Netmgr in the Xshell through Xmanager without any issue. There was problem to do so using Oracle user under xWindows. Resolved it by setting “DISPLAY=:0.0”.
Problem
Need to use Netmgr GUI in xWindows. Error as below,
[tom@ocp ~]$ netmgr
****DISPLAY environment variable not set!
Oracle Net Manager is a GUI tool which
requires that DISPLAY specify a location
where GUI tools can display.
Set and export DISPLAY, then re-run.
After setting below,
[tom@ocp ~]export DISPLAY=:0.0
Had below error,
[tom@ocp ~]$ netmgr
Exiting
java.lang.NullPointerException
at oracle.ewt.lwAWT.BufferedApplet.<init>(Unknown Source)
at oracle.sysman.emSDK.client.appContainer.WebApplication.</init><init>(WebApplication.java:752)
at oracle.net.mgr.container.NetApplication.</init><init>(Unknown Source)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at java.lang.Class.newInstance0(Class.java:350)
at java.lang.Class.newInstance(Class.java:303)
at oracle.sysman.emSDK.client.appContainer.WebApplication.main(WebApplication.java:3316)
Solution
The problem is normal Oracle user doesn’t have the same priviledge as root to use GUI, this issue can be resolved by below command.
[root@ocp Desktop]# xhost +
access control disabled, clients can connect from any host
[root@ocp Desktop]# DISPLAY=:0.0
[root@ocp Desktop]# export DISPLAY
[root@ocp Desktop]# xhost +
access control disabled, clients can connect from any host
[root@ocp Desktop]# su - tom #tom is the normal Oracle user.
Last login: Sun Dec 23 10:35:02 SGT 2018 on pts/4
[tom@ocp ~]$ DISPLAY=:0.0
[tom@ocp ~]$ export DISPLAY
[tom@ocp ~]$ netmgr
[tom@ocp ~]$
The command xhost + meaning is as below,
+ Access is granted to everyone, even if they aren't on the list (i.e., access control is turned off).
Reference
Running GUI application as another (non-root) user
关于在linux上启用dbca,netmgr,netca等命令的问题