I have a servlet that I would like to run within ColdFusion MX 7. I would like to make use of an existing ColdFusion DSN as a javax.sql.DataSource, if possible.
I thought something like
coldfusion.server.ServiceFactory.getDataSourceService().getDatasource(dsname);
would work, but unfortunately the servlet returns
java.lang.NoClassDefFoundError: coldfusion/server/ServiceFactory
It seems the simplest way to do this is to add an additional JNDI datasource into jrun-resources.xml. This can then be accessed in the conventional way:
It does mean duplicating database connection configuration, but I would rather do this than work with the largely undocumented coldfusion.server.* classes.