Entries Tagged as “Application Servers”

What’s the deal with Tomcat in ColdFusion 10?

Posted By: Rupesh Kumar 19 Comments April 20, 2012

"Adobe ColdFusion" · "Adobe ColdFusion 10" · "Application Server"

One of the biggest change in ColdFusion 10 is the replacement of underlying application server i.e JRun with Tomcat. There have been a lot of questions and discussions on Tomcat in ColdFusion 10 on various forums and blogs and I will try to address some of them in this post.

Is the inbuilt server in ColdFusion 10 a modified version of Tomcat? If yes, what are the changes and why?

Yes, the in-built server in ColdFusion 10 is a modified version of Tomcat. When we started out, we didn’t envision making any changes in Tomcat, but soon we realized that people would need seamless experience when they move from ColdFusion 9 or a previous version to ColdFusion 10. That meant that the directory structure, the features, connector experience - all need to be as close to previous versions (JRun as inbuilt server) as possible. Some of the important changes that we had to make in Tomcat are

  1. The directory structure - When you install Tomcat separately, its directory structure would be quite different from the directory structure that ColdFusion has. We have ensured that people don’t find themselves in a completely unfamiliar installation structure. So the launcher that launches ColdFusion (actually Tomcat), the way you configure the JVM for Tomcat (jvm.config), the default wwwroot, the directory structure for the entire installation etc. are almost identical to any previous ColdFusion installation. 
  2. SES URL support : Tomcat does not support SES (Search Engine Safe) urls out of the box. Since a lot of ColdFusion customers are used to this kind of URL in their application, this was a very important change required in Tomcat.
  3. Web server connectors : Tomcat does come with connectors for webservers like IIS/Apache, however it has far less features as compared to the JRun connector. We have tried to bridge the gap as far as possible so that you, as a user of ColdFusion, do not lose the features that you have been using. Some of the changes we had to make for connector are
    • Multiple webroot support : Tomcat serves the files only from its application root. That means that the only way for Tomcat to serve the files from IIS/Apache webroot is to configure IIS/Apache webroot as the Tomcat's application root. But that way, it will not serve any file from Tomcat's webroot. ColdFusion always had these two decoupled and supported both the webroots at the same time. So we made changes in Tomcat to retain the old behavior. In fact ColdFusion falls back to its wwwroot for searching a file if it can't be found by IIS/Apache.
    • CGI scope variables : A lot of CGI scope variables were not available with original Tomcat connector because the Tomcat connector did not had any way to query the webserver. We made changes to ensure that your application does not break.
  4. ColdFusion session replication in cluster : If one is not using sticky session in a cluster, it is extremely important to have session replication to ensure that your application works smoothly in a cluster. We had to make some changes in Tomcat to enable the replication of ColdFusion session because of certain classloading issues.

Does that mean that ColdFusion will not run and will not be supported on a standard Tomcat installation?

ColdFusion will definitely run and will be supported on standard Tomcat installation like any other JEE server deployment. As ColdFusion's support on any other JEE server, the deployment will use the inbuilt web server of Tomcat and therefore the 3rd point listed above about web server connectors will not come into play at all. You can definitely use the web server connector provided by Tomcat but like any other JEE server support, since ColdFusion does not provide the connector, we will not be able to provide any support if there are any issues with the connector.

OK.. but, SES URL is still an issue with plain Vanilla Tomcat, right? Yes and No. By default, Tomcat does not allow the SES URL the way JRun  or other JEE servers do. Below is a snippet from the web.xml and as you can see, we have defined the URL pattern as "*.cfm/*" and "*.cfc/*".

    <servlet-mapping id="coldfusion_mapping_7">
        <servlet-name>CfmServlet</servlet-name>
        <url-pattern>*.cfm/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping id="coldfusion_mapping_8">
        <servlet-name>CFCServlet</servlet-name>
        <url-pattern>*.cfc/*</url-pattern>
    </servlet-mapping>

However, in Tomcat, to get SES URL to work, you would need to put the exact URL till .cfm/.cfc in the web.xml like the snippet below 

    <servlet-mapping id="mapping1">
        <servlet-name>CfmServlet</servlet-name>
        <url-pattern>/index.cfm/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping id="mapping2">
        <servlet-name>CfmServlet</servlet-name>
        <url-pattern>/foo.cfm/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping id="mapping3">
        <servlet-name>CfmServlet</servlet-name>
        <url-pattern>/app1/index.cfm/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping id="mapping3">
        <servlet-name>CfmServlet</servlet-name>
        <url-pattern>/app1/bar/foo.cfm/*</url-pattern>
    </servlet-mapping>

You get the idea.. I know that’s a little painful to add all the URLs of your application in the web.xml but that’s the way to go if you want to use SES URL in plain vanilla Tomcat.

Can I deploy my own application (war/ear) on an instance created by instance Manager?

Unfortunately no. The directory structure change also meant that in the ColdFusion standalone installation, one would not be able to deploy any other application (ear/war). This is how the standalone installations of earlier versions of ColdFusion used to behave as well. 

The multi-server installation of ColdFusion 9 and earlier used to lay down plain app server and then deploy ColdFusion as one of the application. This allowed you to install any other application (ear/war) as well on any instance. However, with ColdFusion 10, when you create an instance from the instance manager, it is a replication of the main default instance of standalone installation and therefore you cant deploy any other application (war/ear) on any instance. 

What if I want best of both - i.e ColdFusion's  version of Tomcat that allows deployment of any application?

We will make ColdFusion's modified version of Tomcat (let's call it CF-Tomcat) as well as the connectors available for you, so that you can use it like a standard Tomcat installation. This will allow you to take advantage of all the changes that we have made in Tomcat and at the same time, you can deploy any application on it the way you want. We are also exploring the option of open-sourcing the changes that we have made in Tomcat.

That’s all good, but how do I upgrade the in-built Tomcat, in case Tomcat comes out with a critical fix or a security fix?

Well, ColdFusion 10 now has an amazing delivery mechanism with hotfix notification and installer. We will use the same infrastructure to keep the Tomcat engine updated. CF-Tomcat update should be available soon after Tomcat comes out with any critical fix. We will also make the same available for you to download and use.

I hope I have covered most of the questions that you all have raised. Now let the comments pour in!

Respond Now

Basic Authentication with WebLogic 9.2 and above

Posted By: Shilpi Khariwal No Comments February 10, 2012

I have had very few encounters with WebLogic. Today was one of such days. I created a simple application that uses Basic authentication. The application was deployed on WebLogic. So here I am sharing it.

To all my surprises the application didn't work as expected. It was giving 401 error repeatedly. After some further debugging I found that the request was not even calling application code for authentication. Now this was really annoying and strange. On debugging I found nothing wrong in the application, I decided to search for it in case someone else faced a similar issue.

I have blogged about the solution here.

Shilpi

Security Czar, ColdFusion Team

Respond Now

Blue Mango Theme Design By Mark Aplet

Super Powered by Mango Blog