Well, that was not possible, because the tomcat context becomes read-only after startup.
So what we did was use SimpleJNDI, which is a memory context (more like an illustrious HashMap), and it worked for us.
He needs the jndi.properties file, which should be in the class path, and where you define the directory in which to look for resources and the initial factory context
java.naming.factory.initial=org.osjava.sj.SimpleContextFactory org.osjava.sj.root=some/relative/path org.osjava.jndi.delimiter=/ org.osjava.sj.jndi.shared=true
To bind to ColdFusion, we first create a data source and then bind it to the context:
DataSource ds = ... Context c = new InitialContext(); c.bind( "jdbc/my/blah/"+var , ds ); ...
Then, using the CF admin api, we create a JNDI type CF data source using jndiname
source share