We have a situation where we're working on a ColdFusion project that will be deployed on glassfish (in production). Glassfish will use JNDI to manage all the connections to external resources (namely the databases and the mail server).
By default, ColdFusion ships with its own J2EE container (JRun) - so as the project began to take shape, we wanted to be able to create similar JNDI bindings within JRun - so we could closely mimic how the application would behave when deployed on glassfish.
I think I'm being fair saying the documentation for ColdFusion's JRun config files isn't exactly what you'd call the most comprehensive, so here's a rough list of the steps we took to set up JNDI mappings in ColdFusion for a JDBC[JNDI] datasource and for a mail server and what was required to get it all working:
Configuring ColdFusion to work with a JDBC datasource
1. Get the relevant Java JDBC driver for the database you're trying to use (for example, MS SQL Server would use sqljdbc4.jar) and put that jar into your Coldfusion lib folder (e.g. ColdFusion8/lib)
2. In the jrun-web.xml (/Applications/ColdFusion8/wwwroot/WEB-INF/jrun-web.xml), you need to declare the JNDI bindings before you can configure them, so the last few lines of your xml document should look like this:
N.B. make sure this is just above the closing tag (</jrun-web-app>)
3. In your jrun-resources.xml (/Applications/ColdFusion8/runtime/servers/coldfusion/SERVER-INF/jrun-resources.xml)
N.B. This should be just before the closing tag (</jrun-resources>)
An important note here should be that there should be a match between the names in the two files on:
This should complete the binding for Coldfusion/JRun - restart ColdFusion and you should be good to go.
Configuring ColdFusion to work with a MailServer via JNDI
1. In the jrun-web.xml:
2. In your jrun-resources.xml:
As before, restart ColdFusion to test whether these changes worked.
- ► 2011 (35)
- ► 2010 (43)
- ▼ May (2)
- ► 2008 (24)