Compiling ColdFusion Applications for Deployment
I've been compiling ColdFusion applications on and off over the years for various reasons, usually on my server or another server that I have access to.
Recently I've been compiling for deployment to an external server that I've not had access. I ran into a few problems with the resulting compiled code not running on these servers while it runs perfectly locally.
To start at the beginning, I've often simply pre-compiled an application in place, so that it need not compile the templates on first access. Occasionally I've compiled for source-less deployment. Usually under those circumstances I've had access to the server, where I've simply loaded source code onto the server, compile, dropped the compile code into place and then removed the source.
Manually creating JRun Server instances.
I'm having a spot of bother with the JRun JMC (Java Management Console) at the minute.
For some reason I'm getting error messages like this :
Installing CF Instances in a different location
I got asked yesterday - how can I set up a CF Instance somewhere other than the default location?
Its actually pretty easy. In the JMC (Java Management Console) when you create a new server instance simply give the server path as a fully qualified path rather than using the {java.home} variable in the front of the path. And that is it.
If you want to change the path of an existing server, the paths reside in the Jrun4/lib/Servers.xml file. In theory, you should be able to move the server folder and change the path in the server.xml file and hey presto! I say "in theory" because I've never tried this.
Don't forget to shut the JRun server down before you do this....
ColdFusion Instance "bugs"
I'm holiday and if the wife knew I was reading coldfusion blogs I'd be for it and its sad that I'm posting to my blog, but what the heck! I need to mention this before I forget about it.
A while back I did a quick check list on setting up Multi-server CFMX under JRun. (see the related entry) I mentioned in that article that you need to change cfusion.war to cfusion-war in the application.xml file. What I didn't mention and what I probably did on autopilot was also changed cfusion.ear to cfusion-ear. I thought I would mention this in passing as Andy Allan blogged about it on Thursday.
He also mentions a problem with instances and log paths that you should be aware of.
Now I'm gonna run away before the wife catches me... ;)
CFMX MultiServer Set up
This is more a "note to self" than anything else, but here you go...
I've been messing about with the Multi server set up for CFMX7. J2EE applications, Clustering and multiserver installations is something I haven't really looked at since umm... CF4.5.1, so I thought it was time to look at it all over again.
I had a few hassles, but with Andy Allan of the Scottish CFUG's help I've now ironed out all the wrinkles on my dev server set up.What I've got is Apache 2.0.55, with Jrun 4 Updater 6 running multiple CF instances and sites, one of which is actually my test bed for this blog. (Bit naughty really seeing as I run CFMX standard with IIS on my production server, but you have to try these things out some how!)
Anyway, here's the steps to a working install.
- Install Apache
- Install CFMX 7.01 using option 2 (Multi-Server install)
- Do another install of CFMX 7.01 using option 3 (J2EE install) making an cfusion.ear file
- Use something like winrar to unzip the ear file into a folder called cfusion-ear
- Extract the cfusion.war into cfusion-war folder
- Hang onto the cfusion.ear file, so you don't have to build it again, but delete the cfusion.war file out of the folder structure
- Edit the application.xml file in the cfusion-ear/META-INF folder - change the web-uri to cfusion-war rather than cfusion.war
- Create your various instances for your various websites in the Java Management Console (JMC)
- Remove the default-ear folder from the server instance folder for each instance that will be running CFMX
- Copy the cfusion-ear folder into the server folder for each instance
- Set up your websites in Apache using virtual hosts
- Use the wsconfig tool to connect the first Java Server Instance to apache
- Edit your httpd conf file.
Leave :1LoadModule jrun_module "C:/JRun4/lib/wsconfig/1/mod_jrun20.so"in the global part of your config file, but copy the rest into each virtual host.
2JRunConfig Ssl false
3AddHandler jrun-handler .jsp .jws .cfm .cfml .cfc .cfswf .cfr - Change the port number on the bootstrap for each website to point at the appropriate Java Server Instance.
- Change the Serverstore variable to point to different numbered folders for each website and create these folders. You can put a copy of the jrunserver.store file in there, but its not required.
- Go into cfusion-ear\cfusion-war\WEB-INF for each server, edit the web.xml file and uncomment the SES URL settings
- Go into the SERVER-INF folder for each instance and edit the jrun.xml. Set the deactivated attribute to "false" under the jrun.servlet.jrpp.JRunProxyService class, if it isn't already.
- Start your instances and start your apache server (or restart as appropriate)
- and thats it....
