Solved: Strange sun.awt.X11.XToolkit exception with Mach-II/Railo/Tomcat/Ubuntu

ColdFusion, Ubuntu, Technology, Linux, Java, Mach-II

I am running a BER version of Railo to experiment with the Hibernate ORM functionality for a new project.  I set up a Mach-II app from the 1.8 skeleton using Mach-II 1.8.1 on Railo under Tomcat6 on Ubuntu... whew!  That's a mouthful huh?

The simple skeleton came up just fine, but after a little bit of customization, I ran across a strange issue.  I had created an event, in which a listener pulled a new entity from a ColdSpring bean, and persisted it using EntitySave().  Somewhere in that process, I started getting exceptions related to sun.awt.X11.XToolkit. 

The first time the error would occur, I would see this:

Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.

 /var/lib/tomcat6/webapps/railo-orm/MachII/properties/HtmlHelperProperty.cfc: line 142

    140: <!--- Configure auto-dimensions for addImage() --->
    141: <cfif StructKeyExists(serverInfo, "productLevel") AND serverInfo.productLevel NEQ "Google App Engine">
    142: <cfset variables.AWT_TOOLKIT = CreateObject("java", "java.awt.Toolkit").getDefaultToolkit() />
    143: <cfelse>
    144: <!--- Some hosts (such as GAE) do not support java.awt.* package so replace with mock function --->

On subsequent requests, I would get the following:

Could not initialize class sun.awt.X11.XToolkit again with the specitic exception pointed to HtmlHelperProperty.cfc: line 142.

After some Googling I came across a similar sounding issue in which a guy had added params to his app server.  I added it to mine, and the error went away.  If you come across this yourself, try adding: -Djava.awt.headless=true to the JAVA_OPTS (in catalina.sh for Tomcat).

 

 

 

How to set JAVA_HOME environment variable in Ubuntu

Ubuntu, Tips and Tricks

I am actually creating this blog entry as a bookmark for myself, but since I know that I never remember how to do it, others might benefit as well!

One way that you can set your JAVA_HOME variable and add to your PATH, is be doing the folowing.  As 'sudo' open up /etc/bash.bashrc and add the following to the end of the file.  NOTE: Set the java path to whatever the actual path is on your environment if it does not match /usr/lib/jvm/java

JAVA_HOME=/usr/lib/jvm/java
export JAVA_HOME
PATH=$PATH:$JAVA_HOME/bin
export PATH

When you reboot, try running the following:

$ echo $JAVA_HOME
/usr/lib/jvm/java
 echo $PATH
[probably lots of paths]:/usr/lib/jvm/java/bin

tags:
Ubuntu, JAVA_HOME
0

How to install KDE 4.1 on Ubuntu Hardy 8.01 and my impressions of it

Ubuntu, Linux

With yesterday's announcement of the 4.1.0 release of KDE, my willpower did not allow me to go another day without giving KDE4 another shot. For a bit of history, I have been using Gnome for several years. In the past 3 months or so I began using KDE 3.5.9 long enough that I began to enjoy it and realize that it is a nice desktop environment as well. At this point I really have no favorite between the two and like different things about both of them.

When the first releases of KDE 4 started showing up several months ago, I gave it a shot but was extremely underwhelmed. While it came with all the warnings from the community that the 4.0 release was nothing more than the introduction of a new platform which developers would expand, some of the basic pieces of it just felt wrong. I can clearly say that after spending most of an afternoon using it, running my development environment, and doing basic daily functions, 4.1 is light years beyond the first peak I had of it. I am *really* enjoying it so far and I have a feeling it will be my desktop of choice for the immediate future.

One thing that seems to not be common knowledge to some people is that you can just install it and try it out without affecting your existing desktop environments, be it KDE 3.5.x or Gnome. For example, my current installation started out as Kubuntu 8.04 Hardy Heron. Shortly after installing I added Gnome by running:

sudo apt-get install ubuntu-desktop
Then in the GDM or KDM login window, I had options for either logging in using Gnome or the default KDE. Thankfully the two coexist without bothering each other, and I can switch back and forth at will. I took the same approach today when installing KDE 4.1, planning to keep both Gnome and KDE 3.5 as fallback positions or simply to use when I am in the mood.

If this type of setup sounds like something you want to try out, do the following. First, add the following repo into your /etc/apt/sources.list file:

deb http://ppa.launchpad.net/kubuntu-members-kde4/ubuntu hardy main
After adding that you will want to update your repos by running:
sudo apt-get update
Then to install KDE 4.1 you will run the following:
sudo apt-get install kubuntu-kde4-desktop kdeplasma-addons amarok-kde4 and kontact-kde4 kate-kde4 kmail-kde4
Notice that I am also updating several applications, such as kate, amaroK, kmail, and kontact. Kdeplasma-addons also brings you some extra goodies beyond the base install. During that installation you will be prompted to choose your login manager. KDE4 brings you yet another option beyond GDM and KDM. I chose it and it is a really nice clean look. I recommend giving it a look. Once the installation completes, restart X or reboot and have fun!

tags:
Linux, Ubuntu, KDE, Kubuntu
0

Firebug with Firefox 3 in Ubuntu Hardy Heron

Browsers, Ubuntu
Several months ago when I first tried out Firefox 3, I found that I couldn't get Firebug to work. At that time, I was still on 7.10 (Gutsy) and just rolled back to Firefox 2 and carried on about my business. Once I upgraded to 8.04 (Hardy), where its default Firefox is FF3, I tried again. I still had failures and no matter which "fix" I came across, I still was never able to open Firebug in a panel, but only in a separate window.

That all changed this morning! I was looking through packages and discovered that there is a Firebug package in the Ubuntu repos. I promptly uninstalled Firebug from the extensions settings in the Firefox and closed my browser. I went to terminal and typed:

$ sudo apt-get install firebug


... I then opened up Firefox 3 and BAM! It works exactly like it should. I have no idea what the difference is in this version of Firebug, but for whatever reason, my problems are solved.
0

CF8 error after upgrading to Ubuntu 8.10 Hardy Heron - libstdc++.so.5

ColdFusion, Ubuntu, Linux
This afternoon I did an upgrade from Gutsy to Hardy on my main development environment. I experienced *almost* no disruption to my system, with one exception (so far!). When I instantiated a ColdFusion 8 application which instantiates a webservice onApplicationStart, I received the following exception:

jikes: error while loading shared libraries: libstdc++.so.5: cannot open shared object file: No such file or directory

Jikes! Well fortunately the fix is quite simple. Go to a terminal and install libstdc++5 like so:
$ sudo apt-get install libstdc++5


Restart your application and carry on! I am not sure what changed between the distros, but apparently the libraries that ColdFusion uses for invoking webservices depend on this package.
0

Adding spell checking to Evolution mail client

Ubuntu, Tips and Tricks

I am not sure why I have never pusued this until today, but I for some reason have never spent the time to figure out why I didn't have spell checking in my Evolution mail client. I knew that Evolution used the packages aspell and gnome-spell, which I already had installed, so why wasn't it working?

When I went into my composer settings in the Evolution preferences, I saw a big empty box that was the list of dictionaries that Evolution was using.  You would think there would be some method of adding them from there, but unfortunately it isn't quite that obvious. To add the English dictionary I had to install the package aspell-en. Once I added this I reopened Evolution and Bamn!

There it is. For the copy/paste inclined, try the following:

#sudo apt-get install aspell gnome-spell aspell-en


Search

Various Links

HikeTheCanyon.org - Rim-to-Rim hike of the Grand Canyon.
Dave Shuck on Twitter - Follow me on Twitter.
Scriptalizer - Minify your Javascript and CSS