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).