Skip to main content
Inspiring
November 26, 2011
Answered

Trying to change root directory in built-in server

  • November 26, 2011
  • 2 replies
  • 9952 views

I am running the built-in server in ColdFusion 9 to test a web site I am building. My site is located in a subfolder of the wwwroot folder in the ColdFusion9 directory (C:\ColdFusion9\wwwroot\Everett\*). I am trying to use root-relative links, but I would like them to refer to this directory, not the wwwroot directory. For example, I would like the link "/index.cfm" to open the C:\ColdFusion9\wwwroot\Everett\index.cfm, as opposed to C:\ColdFusion9\wwwroot\index.cfm. It is my understanding that this can be done through virtual mapping.

I have added this code to the jrun-web.xml file in the WEB-INF directory:

<virtual-mapping>

  <resource-path>/*</resource-path>

  <system-path>C:/ColdFusion9/wwwroot/Everett/</system-path>

</virtual-mapping>

I then moved the CFIDE and cfdocs folders to the Everett subfolder.

Next, I restarted the ColdFusion server.

Now I'm getting the following error message:

404

java.io.FileNotFoundException

at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:94)

at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)

at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286)

at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)

at jrun.servlet.http.WebService.invokeRunnable(WebService.java:172)

at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)

at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)

at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)

at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)

When I go to http://localhost:8500/ I can see all the appropriate files and directories, so I can see that the root directory has been changed, I just cannot view any of the documents.

Any thoughts?

Jeremy

    This topic has been closed for replies.
    Correct answer jawmusic

    Something just caught my eye.There was a typo in my previous example. Did you copy-paste it? Here it is again, with the relevant correction:

    <virtual-mapping>

        <resource-path>/*</resource-path>

        <system-path>C:/Web_Sites/Everett2</system-path>

    </virtual-mapping>

    <virtual-mapping>

        <resource-path>/WEB-INF</resource-path> <!-- WEB-INF not WEB_INF as above -->

        <system-path>C:/ColdFusion9/wwwroot/WEB-INF</system-path>

    </virtual-mapping>

    <virtual-mapping>

        <resource-path>/CFIDE</resource-path>

        <system-path>C:/ColdFusion9/wwwroot/CFIDE</system-path>

    </virtual-mapping>


    HA! I have no idea why it's working now, but it does. BKBK, I tried your method and it didn't work, but then I moved the WEB-INF directory back to wwwroot and it's fine now. For those keeping score at home, here's what I ended up with:

      <virtual-mapping>

        <resource-path>/*</resource-path>

        <system-path>C:/Web_Sites/Everett2</system-path>

      </virtual-mapping>


      <virtual-mapping>

        <resource-path>/WEB-INF</resource-path>

        <system-path>C:/ColdFusion9/wwwroot/WEB-INF</system-path>

      </virtual-mapping>


      <virtual-mapping>

        <resource-path>/CFIDE</resource-path>

        <system-path>C:/Web_Sites/Everett2/CFIDE</system-path>

      </virtual-mapping>

    Like I said, I don't know why it didn't work the first couple attempts, but it's working now and I guess that's all that matters. Thanks everyone for your help!

    JAW

    2 replies

    Inspiring
    November 26, 2011

    I then moved the CFIDE and cfdocs folders to the Everett subfolder.

     

    My memory could be off .. but I do not recall having to move the CFIDE folder when changing the built in server's webroot. I think the /cfide mapping is handled separately in one of the neo-xxxx.xml configuration files. Did you try moving /CFIDE back to its original location.?

    jawmusicAuthor
    Inspiring
    November 26, 2011

    I followed the directions in this link:

    http://help.adobe.com/en_US/ColdFusion/9.0/Admin/WSc3ff6d0ea77859461172e0811cbf364104-7fd8.html

    They tell you to move the CFIDE and cfdocs folders to the new web root.

    I also tried using a different directory altogether (C:\Web_Sites\Everett\), and it still doesn't work. The new code is:

    <virtual-mapping>

      <resource-path>/*</resource-path>

      <system-path>C:/Web_Sites/Everett/</system-path>

    </virtual-mapping>

    BKBK
    Community Expert
    November 28, 2011

    Okay, so now I've mapped to my desired directory as well as mapping the WEB-INF and CFIDE directories to the wwwroot folder. Still, I can't get any of the cf documents in my new web root to open. I can get a directory listing if I just go to http://localhost:8500/ but I still get the 404 error if I try http://localhost:8500/index.cfm. Here's the contents of my jrun-web.xml file:

    <?xml version="1.0" encoding="ISO-8859-1"?>

    <!DOCTYPE jrun-web-app PUBLIC "-//Adobe, Inc.//DTD jrun-web 1.0//EN"

        "http://www.adobe.com/dtd/jrun-web.dtd">


    <!-- ============================================================= -->

    <!-- This XML file contains web application elements that are      -->

    <!-- specific to the JRun Application Server                       -->

    <!-- ============================================================= -->



    <jrun-web-app>


        <!-- This setting is used in JRun SP to get CF to work correctly.  -->

        <!-- Without this line, CF on JRun SP1 doesn't work -->

        <!-- If the server doesn't have the SP installed, JRun just ignores -->

        <!-- this line -->

        <enable-jrun-web-services>false</enable-jrun-web-services>



      <!-- =========================================================== -->

      <!-- Virtual path mappings allow a resource path to be mapped    -->

      <!-- to a different physical location (i.e. not necessarily      -->

      <!-- within the web application root). A resource-path can       -->

      <!-- end with a wild card '*' indicating that all resources      -->

      <!-- paths that start with the given path will be resolved using -->

      <!-- the system path.                                            -->

      <!-- =========================================================== -->


      <virtual-mapping>

        <resource-path>/WEB_INF/*</resource-path>

        <system-path>C:/ColdFusion9/wwwroot/WEB-INF/</system-path>

      </virtual-mapping>


      <virtual-mapping>

        <resource-path>/*</resource-path>

        <system-path>C:/Web_Sites/Everett2/</system-path>

      </virtual-mapping>


      <virtual-mapping>

        <resource-path>/CFIDE/*</resource-path>

        <system-path>C:/ColdFusion9/wwwroot/CFIDE/</system-path>

      </virtual-mapping>


      <!-- session persistence needs to be disabled due to our classloader setup  -->

      <session-config>

        <persistence-config>

          <active>false</active>

        </persistence-config>

      </session-config>


    </jrun-web-app>

    Also, here again is the error message, in its entirety:

    404

    java.io.FileNotFoundException

            at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:94)

            at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)

            at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286)

            at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)

            at jrun.servlet.http.WebService.invokeRunnable(WebService.java:172)

            at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)

            at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)

            at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)

            at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)

    Thanks again everyone for your help with this.

    Jeremy


    I think the order is relevant, and would go for:

    <virtual-mapping>

        <resource-path>/*</resource-path>

        <system-path>C:/Web_Sites/Everett2</system-path>

    </virtual-mapping>

    <virtual-mapping>

        <resource-path>/WEB_INF</resource-path>

        <system-path>C:/ColdFusion9/wwwroot/WEB-INF</system-path>

    </virtual-mapping>

    <virtual-mapping>

        <resource-path>/CFIDE</resource-path>

        <system-path>C:/ColdFusion9/wwwroot/CFIDE</system-path>

    </virtual-mapping>

    Community Expert
    November 26, 2011

    You can't create a virtual mapping that corresponds to the webroot - it has to have a different name/pattern. If you just want to change the location of the webroot, you can do that directly:

    https://www.adobe.com/support/coldfusion/adv_development/config_builtin_webserver/config_builtin_webserver04.html

    Dave Watts, CTO, Fig Leaf Software

    Dave Watts, Eidolon LLC
    Community Expert
    November 26, 2011

    OK, I clearly didn't compare what's in your document with what's in mine, since they're the same steps!

    So, in an attempt to actually be helpful - what happens if you create a .cfm file of your own in the Everett directory? Can you run that successfully?

    Dave Watts, CTO, Fig Leaf Software

    Dave Watts, Eidolon LLC