Bartram's Bits

Wednesday, May 20, 2009

Multiple Instances in ColdFusion 7

I've always been aware that you could create multiple instances in ColdFusion, but I always thought it would be some complicated arcane process. So up until recently, I never felt compelled to attempt it. In reality I found it to be rather easy and have successfully created multiple instances in ColdFusion 7.0 using both Apache 2.0 and IIS 6.0 webservers (Yes, I know, there are newer versions out there, but we can't all be cutting edge). In my research, I noticed that while the documentation available on the internet was sufficient, it was a little sparse. So I hope by sharing my notes that I will help someone else as well.

ColdFusion

Create showInstance.cfm in a new web folder:
<cfobject action="create" type="java" class="jrunx.kernel.JRun" name="jr">
<cfset servername = jr.getServerName()>
<cfoutput>JRun Server Name: #servername#</cfoutput>
Create instance in cfadmin
  • Enterprise Manager > Instance Manager
  • Add New Instance
  • Server Name: whatever you want to call the instance
  • Server Directory: let CFadmin handle this
  • Create From EAR/WAR: leave blank
  • check Create Windows Service
  • check Auto Restart Service
  • Submit
  • Wait...
Edit JRun4/servers/________/SERVER-INF/jrun.xml
  • search for JRunProxyService
  • change deactivated from true to false
  • note port

APACHE Web Server

Edit httpd.conf
add virtual mapping 
JRunConfig Serverstore "C:/JRun4/lib/wsconfig/1/jrunserver.store"
JRunConfig Bootstrap 127.0.0.1:_____ *port goes here
JRunConfig Apialloc false
Web Server Configuration Tool
  • Add
  • JRun Host: localhost
  • JRun Server: select instance created in CFadmin
  • Web Server: select Apache
  • Configuration Directory: browse to where httpd.conf is located
  • check Configure web server for ColdFusion MX applications
  • OK
Apache Service Monitor
  • Stop Apache
  • Start Apache

IIS Web Server

Create web site
  • Run Internet Information Services (IIS) Manager
  • Expand local computer
  • Right click on Web Sites and select New > Web Site
  • Next
  • Description: type name of new website
  • Enter the IP address to use for this Web site: (All Unassigned)
  • TCP port this Web site should use: 80
  • Host header for this Web site: same as recorded in DNS or hosts file
  • Next
  • Path: Browse to the folder you created above
  • Next
  • Next
  • Finish
  • Right click your new site and select New > Virtual Directory
  • Next
  • Alias: CFIDE
  • Path: Browse to wherever your CFIDE folder is, for example: c:\inetpub\wwwroot\CFIDE\
  • Next
  • Next
  • Finish
Web Server Configuration Tool
  • Add
  • JRun Host: localhost
  • JRun Server: select instance created in CFadmin
  • Web Server: select Internet Information Server (IIS)
  • IIS Web Site: select the site you created above
  • check Configure web server for ColdFusion MX applications
  • OK

Test your new instance

Open your browser to new site and verify that it is running the new instance with showInstance.cfm