Skip to main content
Inspiring
November 26, 2011
Answered

Trying to change root directory in built-in server

  • November 26, 2011
  • 2 replies
  • 9974 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>

    Inspiring
    November 26, 2011

    They tell you to move the CFIDE

    I understand. But I do not recall doing that when I changed my web root. I just updated jrun-web.xml and everything worked fine.

    I am pretty sure there is a separate mapping (and path) for /cfide stored in one of the other config files. So by moving the cfide folder, it breaks things because CF is still looking for it in the old location.  Did you try moving it back to the original location and restarting?

    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