Running Blue Dragon JE22 under JRun4

April 14th, 2008

The following instructions describe one way to run Blue Dragon under JRun4:

  1. Download the ZIP File version (labelled “Any”) J2EE version of Blue Dragon http://www.newatlanta.com/c/products/bluedragon/download/home.
  2. Unzip the file into any temporary directory.
  3. In the JRun4 administrator (http://localhost:8000/) create a new server called BlueDragon. (I use port 8400).
  4. Browse to the new server folder location (…./JRun4/servers/bluedragon) and delete the default.ear folder.
  5. Now copy the expand war file folder (something like BlueDragon_webapp_701_352) in your unzipped temporary directory under the …./JRun4/servers/bluedragon directory.
  6. Rename the new BlueDragon_webapp_701_352 to BlueDragon-war.
  7. In the JRun4 administrator, start the BlueDragon server and then view the BlueDragon-war settings page.
  8. Edit the Context Path from “/BlueDragon-war” to “/“.

The Blue Dragon test page should now be available at http://localhost:8400/

A few more steps are required is you want to use the XML CFML Tags and Functions. If you try running a page using XML features of CFML you will get an error message:

Unrecognized error code: The configured XML parser does not support JAXP 1.3. Please configure the JVM to use a JAXP 1.3 compliant XML parser. If using Sun Microsystems’ JDK 1.5, this can be done by setting the system property javax.xml.parsers.DocumentBuilderFactory to “com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl”.

The following steps will change the JVM’s default XML parser to the one required by Blue Dragon (Assuming you are using JVM 1.5+):

  1. In the JRun4 administrator, view the Java VM Settings page.
  2. Add the following to the VM Arguments:
  3. Restart the BlueDragon server.

Note: This will effect all JRun4 servers, as the JVM settings are shared. Anyone know how to do this on per server basis?


Running Railo under JRun4

April 13th, 2008

The following instructions describe one way to run Railo under JRun4:

  1. Download the war File version (Under “Railo Custom”) version of Railo http://www.railo-technologies.com/en/index.cfm?treeID=224.
  2. Unzip the file into any temporary directory.
  3. In the JRun4 administrator (http://localhost:8000/) create a new server called Railo. (I use port 8200).
  4. Browse to the new server folder location (../JRun4/servers/railo) and delete the default.ear folder.
  5. Create a …./JRun4/servers/railo/railo-war directory.
  6. Change to that directory (cd …/JRun4/servers/railo/railo-war)
  7. Now expand the war file (something like railo-2.0.1.000.war) to the …./JRun4/servers/railo/railo-war directory using this command: jar -xvf …./railo-2.0.1.000.war
  8. In the JRun4 administrator, start the Railo server and then view the Railo-war settings page.
  9. Edit the Context Path from “/railo-war” to “/“.

The Railo test page should now be available at http://localhost:8200/


Odd Error using CFFLUSH

April 12th, 2008

Thought I would blog about this, as it wasted almost 2 hours of my time trying to get to the bottom of it.

I was using CFFLUSH on a work project and ColdFusion was returning the following error message:

You have called cfflush in an invalid location, such as inside a cfquery or cfthread or between a CFML custom tag start and end tag.

What was confusing, was that there were no CFQUERY, CFTHREAD or Custom Tags in the code!

The problem turned out to be an output=”false” attribute on a component function, which called the function containing the CFFLUSH. This is obvious with hindsight, however the error message sent me on a wild goose chase :-)


A Practical Use for ColdFusion 8’s Object Serialization

January 29th, 2008

ColdFusion 8 added the ability for objects to be serialized. Although you can not serialize/un-serialize objects with CFML, you can use underlying Java functions to do so as described by Pete Freitag’s post Serializing CFC’s in ColdFusion 8. In this post a commenter asked whether there is a use-case where this ability would be useful. While contemplating a problem at work, I think I may have found one.

The problem involves building an asynchronous process queue which sits between a “real-time” web service and the system’s database. The web service will be used to import large amounts of data and the queue is required due to the length of time required to process and then store the data in the database. The idea is to store the data, which will be in the form of CFML beans, in an array in application scope and then have a CFTHREAD process the beans into the database.

Where does serialization come in? Well suppose something happens to the server while there are items in the queue. A restart will lose all the data in the queue. Although this is an edge case, the data is critical to the business and cannot be lost. So, when an item is added to the queue it is serialized and stored to the file system. When an item is removed, the serialized file is removed. On start up, any serialized files on the file system are read and the queue is repopulated without data loss.

This is purely theoretical at this point, but I think the idea has enough merit to give it a try.


Creating a Server.cfc

January 27th, 2008

This is technique I have been using for a while to handle environmental (development, test, production etc) configuration settings. It mimics the Application.cfc added in ColdFusion 7, creating a Server.cfc shown below.

  1. <cfcomponent hint="Server wide Information" output="false">
  2.  
  3. <!--- PROPERTIES --->
  4.  
  5. <!--- TODO: Set for each server instance --->
  6. <cfset variables.environment = "Development" /> <!--- Development, Test, Staging, Production --->
  7.  
  8.  
  9.  
  10. <!--- INIT --->
  11.  
  12. <cffunction name="init"
  13. hint="Initialise the Server information"
  14. access="public"
  15. returntype="Server"
  16. >
  17.  
  18. <!--- Handle Server Start --->
  19. <cfif Not StructKeyExists(server, "Name") OR Not StructKeyExists(server, "Environment")>
  20. <cflock scope="server" type="exclusive" timeout="10">
  21. <cfif Not StructKeyExists(server, "Name") OR Not StructKeyExists(server, "Environment")>
  22.  
  23. <!--- Set Server Information --->
  24. <cfset server.name = createObject("java", "java.net.InetAddress").getLocalHost().getHostName() />
  25. <cfset server.environment = variables.environment />
  26.  
  27. <!--- call onServerStart --->
  28. <cfset onServerStart() />
  29.  
  30. </cfif>
  31. </cflock>
  32. </cfif>
  33.  
  34. <cfreturn this />
  35. </cffunction>
  36.  
  37.  
  38. <cffunction name="onServerStart"
  39. hint="Initialise the Server information"
  40. access="public"
  41. returntype="void"
  42. >
  43.  
  44. <!--- TODO: Add any server startup code here --->
  45.  
  46. </cffunction>
  47.  
  48. </cfcomponent>

The Server.cfc is copied to the approot/webroot of the server and the variables.environment property set the the server type e.g. "Development". Then in each Application deployed to the server, the following code is added to the begining of the onApplicationStart method in Application.cfc.

  1. <!--- Run Server.cfc --->
  2. <cfset CreateObject("component", "approot.Server").init() />

Environmental configuration changes within each application can then be made by referencing the server.environment and server.name properties of the server scope.


Embedding Multiple File True Type Fonts in Flex

January 18th, 2008

Many True Type Fonts (TTF) are made up of multiple .TTF files. One file will be for the normal font, while another file is for the Bold version of the Font. For example, the Verdana font that comes with Windows XP consists of four separate files.

The following code shows how to include multiple TTF files into a Flex CSS file.

  1. @font-face
  2. {
  3. src:url("font/verdana.TTF");
  4. font-family: EmbeddedVerdana;
  5. font-weight: normal;
  6. font-style: normal;
  7. }
  8.  
  9. @font-face
  10. {
  11. src:url("font/verdanab.TTF");
  12. font-family: EmbeddedVerdana;
  13. font-weight: bold;
  14. font-style: normal;
  15. }
  16.  
  17. @font-face
  18. {
  19. src:url("font/verdanai.TTF");
  20. font-family: EmbeddedVerdana;
  21. font-weight: normal;
  22. font-style: italic;
  23. }
  24.  
  25. @font-face
  26. {
  27. src:url("font/verdanaz.TTF");
  28. font-family: EmbeddedVerdana;
  29. font-weight: bold;
  30. font-style: italic;
  31. }
  32.  
  33. Application
  34. {
  35. font-family: EmbeddedVerdana;
  36. }

Rotating Text in Flex

January 11th, 2008

The Flex docs tell you that in order to use Fade effects with Text controls, you have to embed a True Type Font to use in the Flex application. The default Fonts available within Flex (Aerial, Verdana etc) will not fade.

This also applies to rotating Flex controls, which is not mentioned in the docs - as far as I can see.


Scotch of the Rocks 2007 Article

August 27th, 2007

I attended this years Scotch of the Rocks with a press pass from Fusion Authority, and they have just published the articles that I and fellow "member of the press" Kola Oyedeji wrote as reviews of the conference.

Read them at A Tale of CFML, Flex and a Pineapple and A Review of Scotch on the Rocks 2007 respectively.


Automatic Disabled Icon with Flex Button Control

July 29th, 2007

The Flex Button control provides the means to add an icon to the button, in one of several states disabled/hover etc. However it does not automatically provide a disabled version of the icon you add for its normal enabled state. i.e. A "grayed out" version, which most other visual RAD tools would provided.

After hacking around in the Flex SDK, I found the following code which accomplishes this;

// Fade Disabled Icon

DisplayObject(this.getChildByName("disabledIcon")).alpha = 0.4;

This could be used as follows to produce an EditButton class;

<?xml version="1.0" encoding="utf-8"?>

<mx:Button xmlns:mx="http://www.adobe.com/2006/mxml"
	icon="@Embed('EditButton.png')"
	label="Edit" creationComplete="init();"
>
        <mx:Metadata>
		[IconFile("EditButton.png")]
	</mx:Metadata>

	<mx:Script>

 	<![CDATA[

		private function init():void
		{
    			// Fade Disabled Icon
			DisplayObject(this.getChildByName("disabledIcon")).alpha = 0.4;
		}

	]]>

 	</mx:Script>

</mx:Button>

As I believe this to be a very valuable behavior, I have created a new IconButton Flex Component class to download, which provides a Button control which does automatically provided a disabled version of its main icon.


Railo Customer Service

June 25th, 2007

I have just installed my first Railo CFML Engine in a production environment.

There was a problem with changing the licence from Community to Profressional. So I emailed Railo and within minutes they came back with a custom solution to my problem.

Now thats what I call Customer Service!!


Copyright © 2005, David Beale

  • Valid XHTML 1.0!
  • Valid CSS
  • Level Triple-A conformance icon, W3C-WAI Web Content Accessibility Guidelines 1.0