Changing the web root from the default web application root is a common practice in J2EE server configuration. It is especially useful in a clustered environment where multiple JRun server instances share a common code base. This TechNote provides the steps to change the web root for the JRun internal web server (JWS).


When you deploy a J2EE web application in JRun, by default, the web root is the web application's root. For example, for the default-war application, it is the {jrun.home}/servers/{server-instance}/default-ear/default-war directory. In certain circumstances, you may want to change the web root to a different directory. This is typically done in a clustered environment using third-party load balancer with the JWS so that many JRun server instances can share the same directory instead of managing source code in multiple locations. When using JWS, it can be easily achieved by modifying the virtual-mapping setting in the jrun-web.xml file located under the /WEB-INF directory.


Note: On Windows platform, you must replace the single backward slash "\" in the path with double backward slash "\\" or a single forward slash "/".

This changes the web root to theC:\mysource-path directory and forces JRun to search both JSP pages and static content in the new web root and ignore anything in the default context root.

ColdFusion MX in the J2EE Configuration on JRun 4

Changing the web root for ColdFusion MX in the J2EE Configuration on JRun requires additional steps. When ColdFusion MX is deployed on JRun as a J2EE application, the core ColdFusion MX application is located under the /WEB-INF/cfusion directory. In order for ColdFusion MX to locate all the configuration files, it has to know where the /WEB-INF directory is. By default, it uses the ColdFusion MX web root as the base. For example, for ColdFusion MX war deployment, it is {jrun.home}/servers/{server-instance}/cfusion-war/WEB-INF. If the ColdFusion MX web root has been changed, you must provide a second virtual mapping in the jrun-web.xml file pointing to the /WEB-INF directory.

For example:


Since JRun only searches for documents in the new web root, you need to move or copy the /CFIDE directory to the new web root directory to enable the ColdFusion Administrator. Because the /CFIDE directory contains no configuration files, it is safe to share the same /CFIDE directory among multiple ColdFusion MX instances.


Issue Resolution
404 error when clicking a link in the document root even though the content can be seen in the web root directory listing When adding the new web root, be sure the resource path is "/*" rather than just "/".
Unable to start the ColdFusion service Add a virtual mapping to point to the ColdFusion MX /WEB-INF directory.
"404 null" error
"Requested resource 'null' (null) not found" error
After changing the web root, accessing the ColdFusion Administrator generates a 404 error but other CFM pages work correctly. Copy the /CFIDE directory to the new web root.

Additional Information

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy