Sunday, September 12, 2010

X11 Forwarding in SSH for Solaris and Linux

You might be wonder what is fun in this blog looking for X11 forwarding on Solaris 5.10!! You might be excited to see the beauty of colorful Oracle Fusion Middleware WebLogic 11g installation window when you executable binaries (wls1033_solaris32.bin), You might wish to see Oracle WebLogic domain configuration Wizard (, Oracle WebLogic Domain Template builder(, BEA Smart Update ( windows or your Oracle Database 11g while you work on a remote UNIX machines.

After spending few hours on the Internet found many blogs written on their experiences, few document on websites, which illustrated about SSH, X11 forwarding in UNIX. I understand that what I need to do? To achieve my objective X11 Forwarding using SSH window, I must have a X emulating software installed on my desktop. you guys have this on your desktop?? If not install Hummingbird Connectivity (Xming is alternative)

My experimenting environment is Solaris 10, Oracle WebLogic, SSH (You can use Putty also), Hummingbird Connectivity (Xming is alternative)

Applicable to:
This you can use for any Java AWT or Swing programs in any UNIX based Operating environment.
You might download free Hummingbird Software also providing evaluation version who want to test their environment.

Here I am sharing with smart guys WLA/DBA my version of brain storming on this. When I first-time tried to invoke X window command it rejected and told as shown below:

No X11 DISPLAY variable was set, but this program performed an operation which requires it.

I had updated DISPLAY variable as follows

$ export DISPLAY=localhost:11.0

My first experiment with normal UNIX user
When I executed script I got the following in Normal UNIX user:

Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(
at sun.awt.X11.XToolkit.(
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(
at java.awt.Toolkit$
at Method)
at java.awt.Toolkit.getDefaultToolkit(
at sun.swing.SwingUtilities2$AATextInfo.getAATextInfo(
at javax.swing.plaf.metal.MetalLookAndFeel.initComponentDefaults(
at javax.swing.plaf.basic.BasicLookAndFeel.getDefaults(
at javax.swing.plaf.metal.MetalLookAndFeel.getDefaults(
at javax.swing.UIManager.setLookAndFeel(
at javax.swing.UIManager.setLookAndFeel(
at javax.swing.UIManager.initializeDefaultLAF(
at javax.swing.UIManager.initialize(
at javax.swing.UIManager.maybeInitialize(
at javax.swing.UIManager.getDefaults(
at javax.swing.UIManager.put(
at com.bea.plateng.common.ui.gui.GUIHelper.initPLAF(
at com.bea.plateng.patch.gui.PatchGUIHelper.startGui(
at com.bea.plateng.patch.Patch.main(

My UNIX admin buddy told that dear, first try with xclock then go for other, then I thought Ohhh!! that's good idea, let me try that...

$ xclock
bash: xclock: command not found

Hmmmmmmm!!, what is this? Think, Think Think!!!, On a Solaris 5.10 you can find some of the commands in OpenSource folder, Let me try in that path this xclock on the following path.

No luck buddy, same kind of error message as got above.

Now I realized and verified all those PATH, CLASSPATH are pointing to proper JAVA_HOME/bin, lib paths respectively, one of them is misconfigured reset to correct path.

One of Sun blog saying about Updating $Home/.ssh/config file as follows:

Host *
ForwardX11 yes
ForwardAgent no

After doing this I had ran the following:

$ ssh -X user@hostname

This is the command will activallte the X emulation on your UNIX machine with given SSH configuration. Actually it will refer to the default configuration /etc/.ssh/config but when you create new config file on your user home directory it will prefer to execute for your user settings. This command also updates .Xauthority file when you ssh -X command.

Verified every step again finally I got X window for xclock

Hey!! Cheerup on my face!!

Experiment 2: LDAP user logon with assume user name as 'pavanwla', switched to role 'wladmin'. I started trying on it for X11 forwarding. First Let me try, xclock on


[wladmin@hostname~]$ /usr/openwin/bin/xclock
Error: Can't open display:

Ohh its same DISPLAY variable problem right? You remember it!!

[wladmin@hostname~]$ export DISPLAY=localhost:10.0
[wladmin@hostname~]$ echo $DISPLAY

Let me try now, what it will say...

[wladmin@hostname~]$ /usr/openwin/bin/xclock
X connection to localhost:10.0 broken (explicit kill or server shutdown)

Oh My Gash!!! what to do now????????????
After a while, I bugged again my buddy Mr. Unix Admin about this. He told that configurations, X emulating authoriy must match ldap user and role. Now my turn, first I tried to get xclock on ldap user, that confirms everything fine at ldap user level. This configuration, Xauthority I can use in role user too, then see what I did:

[wladmin@hostname~]$ scp pavanwla@hostname:/home/pavanwla/.ssh/config .ssh/
[wladmin@hostname~]$scp pavanwla@hostname:/home/pavanwla/.Xauthority .

Started ssh session with ssh -X command.

Finally, the climax came to end, xclock started. ahh!!

No comments:

Post a Comment

Blurb about this blog

Blurb about this blog

Essential Middleware Administration takes in-depth look at the fundamental relationship between Middleware and Operating Environment such as Solaris or Linux, HP-UX. Scope of this blog is associated with beginner or an experienced Middleware Team members, Middleware developer, Middleware Architects, you will be able to apply any of these automation scripts which are takeaways, because they are generalized it is like ready to use. Most of the experimented scripts are implemented in production environments.
You have any ideas for Contributing to a Middleware Admin? mail to me