Accessibility
 
Home / Developer Center / ColdFusion Developer Center

ColdFusion Article

Icon or Spacer Icon or Spacer Icon or Spacer
Geoffrey Greene

Geoffrey Greene
Sr. Software Developer
Macromedia

 

From the inside out: The architecture of ColdFusion MX for J2EE

Note: With the release of ColdFusion MX 6.1, Macromedia has merged the ColdFusion MX for J2EE edition with ColdFusion MX Enterprise. As a result, the features specific to ColdFusion MX for J2EE are now available with ColdFusion MX Enterprise.


With ColdFusion MX for J2EE, developers can create and deploy ColdFusion applications on application servers running on the Java 2 Platform, Enterprise Edition. By adding rapid server scripting capabilities to their existing infrastructure, customers can optimize their development teams and enjoy full access to the power of J2EE.

Macromedia ColdFusion MX for J2EE is currently available for Macromedia JRun, IBM WebSphere, and Sun ONE. What does this underlying architecture change mean for existing ColdFusion and Java developers?


To answer that question and others, Geoffrey Greene, Senior Software Engineer for ColdFusion MX for J2EE, sat down to talk about the architecture underneath ColdFusion MX for IBM WebSphere J2EE Application Server and discuss how it will impact your web application development.

ColdFusion MX Server already ships with an integrated J2EE server. How is the ColdFusion MX for J2EE release different?
First a little background. ColdFusion MX Server Professional and Enterprise Editions—I refer to these as the standalone editions—are built in Java and include an embedded J2EE server, but for the most part the underlying Java functionality is invisible to the developer. By contrast, ColdFusion MX for IBM WebSphere [and the other ColdFusion MX for J2EE products] gives you access not only to ColdFusion functionality but lets you combine it with all of the features of your Java app server. For instance, you can integrate servlets and JSP pages into your ColdFusion pages, leverage the underlying J2EE application server functionality (such as clusterable sessions and load balancing), share data between JSPs and servlets through a request object, and access EJBs and other Java resources with the cfobject tag.

On which servers does ColdFusion MX for J2EE run?
Right now, we support IBM WebSphere versions 4.03 [Advanced Edition and Advanced Edition Single Server], Sun ONE Web Server, and Macromedia JRun 4.0. Later this year we plan to add support for IBM WebSphere 5, BEA WebLogic 7.0, and Sun ONE Application Server 7.

How is ColdFusion MX for J2EE installed on a J2EE app server?
ColdFusion MX for J2EE is packaged as a [Web Application Archive] file. The ColdFusion MX installer unpacks the WAR file and then calls the application server's deployment facilities. The deploy directory is fixed and determined by the underlying application server. For IBM WebSphere, it's located at /AppServer/installedApps/cfusion.ear/cfusion.war.

The runtime files for ColdFusion MX for J2EE are nested in a directory structure underneath the cfusion.war directory. The /web-inf/lib directory holds all of the JAR files for the ColdFusion runtime, and /cfusion holds all specific ColdFusion files. The cfusion.war directory is also where ColdFusion places all of the Java class files it creates when it compiles your application's ColdFusion templates into Java bytecode.

Do you have to rewrite CFML pages from existing ColdFusion apps to run on ColdFusion MX for IBM WebSphere?
For the most part, no. ColdFusion MX for J2EE supports the same language elements as ColdFusion MX Server. If you move applications to ColdFusion MX for J2EE, there may be minor changes, such as context root issues and Verity tweaks, but the application logic should function just as it does with the standalone version.

How do developers integrate existing Java assets/objects on the app server with ColdFusion applications?
There are a few ways to integrate with Java. First, because ColdFusion uses the servlet API under the covers, you can easily share data with—or forward control to—Java servlets and JSPs. Second, you can import Java tag libraries using the cfimport tag. You just assign them a prefix and then call them just like Custom Tags in ColdFusion. Lastly, you can work directory with Java objects using the cfobject tag.

How does it handle sessions?
Session storage is just the same as standalone ColdFusion MX server. The only caveat is clusterable sessions; they are not serializable. In order to cluster in this case, you must put it into a portable format and make it serializable with a keyword.

What is the performance like on these J2EE versions?
Performance really depends on your application, but some customers have seen performance improvements because ColdFusion MX for IBM WebSphere has been optimized to take advantage of the high-performance features in WebSphere, including their database connection pooling and their latest JVM.

How are CFML page compiled in this version? How are page requests handled at runtime?
Page compilation is the same in all versions of ColdFusion MX. The first time a page is requested, it is compiled into Java bytecode and cached to disk. Once a page has been compiled, subsequent requests are passed directly to the compiled class file for processing. What's different in the ColdFusion MX for J2EE products is that the execution of that bytecode is managed by the application server where you installed ColdFusion MX, such as IBM WebSphere.

What kinds of data sources are available inside ColdFusion?
There are two kinds of data sources in ColdFusion MX for J2EE. As with the standalone version, you can create and modify data sources through the ColdFusion administrator. These use a built-in pool manager that is part of ColdFusion MX for J2EE. You can also use data sources that were defined in the underlying app server. These can be called from ColdFusion applications just like any other data source, but they appear in a read-only format in the ColdFusion administrator and can only be modified using the underlying application server's tools.


About the author
Geoffrey Greene is a senior software developer at Macromedia, working on the ColdFusion MX for J2EE product series.