• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Trying to change root directory in built-in server

Explorer ,
Nov 25, 2011 Nov 25, 2011

Copy link to clipboard

Copied

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

Views

6.6K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , Nov 28, 2011 Nov 28, 2011

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-ma

...

Votes

Translate

Translate
Community Expert ,
Nov 25, 2011 Nov 25, 2011

Copy link to clipboard

Copied

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_web...

Dave Watts, CTO, Fig Leaf Software

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 25, 2011 Nov 25, 2011

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Nov 25, 2011 Nov 25, 2011

Copy link to clipboard

Copied

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.?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 25, 2011 Nov 25, 2011

Copy link to clipboard

Copied

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>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Nov 25, 2011 Nov 25, 2011

Copy link to clipboard

Copied

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 25, 2011 Nov 25, 2011

Copy link to clipboard

Copied

Still no luck, unfortunately. Thanks for your help though.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 26, 2011 Nov 26, 2011

Copy link to clipboard

Copied

Still no luck, unfortunately. Thanks for your help though.

Pls post the virtual mappings bits of your jrun-web.xml file.

--

Adam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 26, 2011 Nov 26, 2011

Copy link to clipboard

Copied

Okay, I moved the CFIDE and cfdocs folders back to the wwwroot directory, and now the directory I'm trying to map to is C:\Web_Sites\Everett\. Here is the virtual mapping from the jrun-web.xml file:

<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/Everett/</system-path>

</virtual-mapping>

Do I need to map to the CFIDE folder if I haven't moved it from the wwwroot directory?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Nov 26, 2011 Nov 26, 2011

Copy link to clipboard

Copied

Do I need to map to the CFIDE folder if I haven't moved it from the wwwroot directory

No. IIRC the /CFIDE mapping information is stored in cf_root\lib\neo-runtime.xml. When using the built in web server it defaults to \wwwroot\CFIDE .

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 26, 2011 Nov 26, 2011

Copy link to clipboard

Copied

<virtual-mapping>

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

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

</virtual-mapping>

You need a star at the end of our resource-path.

<virtual-mapping>

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

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

</virtual-mapping>

Do I need to map to the CFIDE folder if I haven't moved it from the wwwroot directory?

Yes, because you've moved what's considered the web root by making the above mapping: /* will match everything, so it will look for everything in that directory.  Unless you tell it otherwise.

--

Adam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Nov 27, 2011 Nov 27, 2011

Copy link to clipboard

Copied

/

  • will match everything,

 

Oh yeah, he is right.  I overlooked the asterisk.

-Leigh

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 27, 2011 Nov 27, 2011

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 28, 2011 Nov 28, 2011

Copy link to clipboard

Copied

I don't know whether it should matter, but in my jrun-web.xml files, I do not have trailing slashes on the paths.

I have to say I only ever use the multi-server install of CF, so dunno if there are further / different considerations when using a standard install.

What do the JRun and CF logs have to say for themselves?

--

Adam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 28, 2011 Nov 28, 2011

Copy link to clipboard

Copied

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>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 28, 2011 Nov 28, 2011

Copy link to clipboard

Copied

Still no luck. At this point it's probably not worth the frustration, but I can't help but be fascinated by why it's not working. I feel like we've tried everything and it's still not working.

Weird.

The main reason I wanted to do this is so when I upload the site to the hosting server I don't have to change all those links. For example, when I have a redirect in a cf function inside a template, Dreamweaver isn't automatically updating the link depending on the directory containing the page that uses the template. That's why I wanted to use a root-relative link instead of a document-relative link in those instances. So I guess what I'll just do is add the extra directory to those root-relative links and then before I upload the site, I'll have Dreamweaver change them all and hope for the best.

Thanks everyone for your help! If anyone else has any expertise to offer, I'm all ears, but for now I'll just make it work as is.

Thanks again,

Jeremy

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 28, 2011 Nov 28, 2011

Copy link to clipboard

Copied

jawmusic wrote:

Still no luck. At this point it's probably not worth the frustration, but I can't help but be fascinated by why it's not working. I feel like we've tried everything and it's still not working.

Weird.

Indeed. I have been tempted to test it. I got it working by

1) Copying the directories CFIDE and WEB-INF into C:\Web_Sites\Everett2;

2) Modifying jrun-web.xml 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:/Web_Sites/Everett2/WEB-INF</system-path>

</virtual-mapping>

<virtual-mapping>

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

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

</virtual-mapping>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 28, 2011 Nov 28, 2011

Copy link to clipboard

Copied

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>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 28, 2011 Nov 28, 2011

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 26, 2011 Nov 26, 2011

Copy link to clipboard

Copied

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?

This is my experience too.  All one needs to do if one sets a new /* mapping is to make sure there's also a way for CF to find /CFIDE/* and /WEB-INF/*, so one would need mappings for those too.  One doesn't need to move the actual directories, though: just have a mapping to them.

--

Adam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation