Title:
Little to no documentation on interoperability of ColdFusion with servlets, and the little there is, is wrong
| View in TrackerStatus/Resolution/Reason: Closed/Fixed/
Reporter/Name(from Bugbase): A. Bakia / A. Bakia (A. Bakia)
Created: 02/13/2014
Components: Documentation
Versions: 10.0
Failure Type:
Found In Build/Fixed In Build: Final /
Priority/Frequency: Normal / All users will encounter
Locale/System: English / Windows 7 64-bit
Vote Count: 1
Problem Description: When you search ColdFusion 10 documentation, you will find little to no documentation on using servlets directly in ColdFusion. In fact, the little documentation there is wrong and contradicts the ColdFusion 9 documentation.
Steps to Reproduce: (1) Search the ColdFusion 10 documentation for the word servlet. You will find little to nothing on how to run servlets in ColdFusion 10. You will find, for example, https://wikidocs.adobe.com/wiki/display/coldfusionen/Interoperating+with+JSP+pages+and+servlets . This says:
"... to run a servlet called HelloWorldServlet, you place the servlet .java or .class file in the _serverroot/_WEB-INF/classes directory and access the servlet with the URL /servlet/HelloWorldServlet."
Note that these instructions say nothing about declaring the servlet and servlet mapping in web.xml. This contradicts the ColdFusion 9 documentation in http://blogs.adobe.com/vikaschandran/2011/07/15/running-servlets-on-coldfusion-9-2/ .
Actual Result: Following the ColdFusion 10 instructions results in a 'File Not Found'.
Expected Result: This bug should be rectified. Moreover, servlet interoperability should be extensively documented, as it is a cornerstone of Java integration. It is also important to document how to dynamically load servlets using ColdFusion 10's new Javasettings property.
Any Workarounds: Compile the java servlet, say HelloWorldServlet.java, into a class file. Copy the class file to {CF_ROOT}\WEB-INF\classes\. Open \WEB-INF\web.xml in a text editor and add the following:
<servlet>
<display-name>HelloWorldServlet</display-name>
<servlet-name>HelloWorldServlet</servlet-name>
<servlet-class>HelloWorldServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HelloWorldServlet</servlet-name>
<url-pattern>/HelloWorldServlet</url-pattern>
</servlet-mapping>
Restart ColdFusion. The servlet can then be accessed in ColdFusion through the URL /HelloWorldServlet, for example,
getPageContext().forward("/HelloWorldServlet");
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3707543
External Customer Info:
External Company:
External Customer Name: BKBK
External Customer Email:
External Test Config: My Hardware and Environment details:
Attachments:
Comments: