JRun 3.x/4.x: Capitalization of files and directories and JRun
Issue
As a Java application, JRun deals with the capitalization of file and directory names in very specific ways, consistent with the rules of the Java programming language. This TechNote explains how capitalization can affect an application running within JRun. It also explains some common ways to work around these behaviors.
The JRun servlet/JSP/EJB containers (and all the ancillary services associated with the JRun containers) are written in Java. As such, JRun deals with the capitalization of Strings in a way that is consistent with the Java language specification. What this means for web developers writing and deploying applications to JRun is that web applications must be aware of the capitalization of files and directories used in the application -- especially in URLs and URIs. Using improper URLs or URIs for resources can cause exceptions such as HTTP 404 (File Not Found) or HTTP 500 as in the following example stack trace:
500 Internal Server Error /demo/jsp/Index.jsp: jrun__jsp__Index2ejspe (wrong name: jrun__jsp__index2ejspe) java.lang.NoClassDefFoundError: jrun__jsp__Index2ejspe (wrong name: jrun__jsp__index2ejspe) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:486) at java.lang.ClassLoader.defineClass(ClassLoader.java:426) at allaire.jrun.jsp.JSPClassLoader.loadClass(JSPClassLoader.java:104) at java.lang.ClassLoader.loadClass(ClassLoader.java:253) at allaire.jrun.jsp.JSPTranslator.loadClass(JSPTranslator.java:141) at allaire.jrun.jsp.JSPTranslator.translate(JSPTranslator.java:96) at allaire.jrun.jsp.JSPTranslator.translate(JSPTranslator.java:67) at allaire.jrun.jsp.JSPServlet.service(JSPServlet.java:216) at allaire.jrun.jsp.JSPServlet.service(JSPServlet.java:196) at allaire.jrun.servlet.JRunSE.service(JRunSE.java:1417) at allaire.jrun.session.JRunSessionService.service(JRunSessionService.java:1106) at allaire.jrun.servlet.JRunSE.runServlet(JRunSE.java:1271) at allaire.jrun.servlet.JRunRequestDispatcher.forward(JRunRequestDispatcher.java:89) at allaire.jrun.servlet.JRunSE.service(JRunSE.java:1557) at allaire.jrun.servlet.JRunSE.service(JRunSE.java:1547) at allaire.jrun.servlet.JvmContext.dispatch(JvmContext.java:364) at allaire.jrun.http.WebEndpoint.run(WebEndpoint.java:115) at allaire.jrun.ThreadPool.run(ThreadPool.java:272) at allaire.jrun.WorkerThread.run(WorkerThread.java:75)
Solution
To avoid errors such as this, use the following capitalization and naming conventions.
Capitalization
The best (and only) workaround for this behavior is to always use the proper capitalization of names and directories in all applications running in JRun. For example, if a file is named Index.jsp, you need to refer to it as Index.jsp. If not, an exception will be generated.
Naming Conventions
Avoid using the same name capitalized in a different manner. For example, do not have both /test and /TEST directories that contain JSP files. JRun compiles and executes JSP pages using their URL to name the Java file generated from JSP execution. If you have both /test and /TEST directories, that can cause naming conflicts in the container. Best practices suggest that developers use unique names for all web application URLs, file names, and directories running in the same JRun server.
This content requires Flash
To view this content, JavaScript must be enabled, and you need the latest version of the Adobe Flash Player.
Download the free Flash Player now!
