server.coldfusion.rootdir

102 views
Skip to first unread message

Dave Merrill

unread,
Oct 12, 2011, 9:54:04 PM10/12/11
to ra...@googlegroups.com
Hi folks,

In Railo 3.3.1, I'm getting empty string for
server.coldfusion.rootdir. Is this intentional, or a bug? It's clearly
a difference from ACF.

Re my actual use case, I'm looking for a way to uniquely distinguish
the CFML engine instance running my code on from others on the same
server. Ideally this would be a technique that's usable on ACF, Railo,
and Open BlueDragon. This is in environments that may have multiple CF
instances, potentially running on different CFML engines.

Starting my investigation from ACF, I thought
server.coldfusion.rootdir could do it, but hit the above empty string
behavior on Railo.

Thanks for any thoughts,

Dave

Dave Merrill

unread,
Oct 12, 2011, 10:16:42 PM10/12/11
to ra...@googlegroups.com
The other alternative so far is cgi.server_port, but my guess is that
may not be unique on a machine w more than one NIC (don't have the
hardware to test that right).

Dave

Todd Rafferty

unread,
Oct 12, 2011, 10:18:08 PM10/12/11
to ra...@googlegroups.com
Open a ticket and mark it as a compatibility issue.
--
~Todd Rafferty
Volunteer
Community Manager
Railo Server - Open Source
----

Todd Rafferty

unread,
Oct 12, 2011, 10:18:58 PM10/12/11
to ra...@googlegroups.com
Wait a sec, Doesn't Railo state that it's railo in the server scope somewhere? o_O

On Wed, Oct 12, 2011 at 9:54 PM, Dave Merrill <enig...@gmail.com> wrote:

Todd Rafferty

unread,
Oct 12, 2011, 10:20:34 PM10/12/11
to ra...@googlegroups.com
<cfdump var="#server.coldfusion.productname#"> is what you're looking for.

Dave Merrill

unread,
Oct 12, 2011, 11:15:51 PM10/12/11
to ra...@googlegroups.com
Sorry if I wasn't clear, I'm not trying to detect which engine it is,
I've got that.

I want a way to "fingerprint" each running instance, to tell it apart
from other running instances, regardless of what engine they're using,
even when there may be multiple instances of the same engine.

For example, my laptop has one instance each of latest Railo, latest
BD, and ACF 8, plus three instances of ACF 9, and I need to be able to
tell each of those apart in code.

Make sense?

Dave

Dave Merrill

unread,
Oct 12, 2011, 11:18:30 PM10/12/11
to ra...@googlegroups.com
Maybe the best choice is ExpandPath('/'). Even though I have seen some
sites that have a mapping for that, it still must be different from,
and outside, the path that defines for every other CFML instance.

Still curious about my original question though.

Dave

Denny

unread,
Oct 12, 2011, 11:22:02 PM10/12/11
to ra...@googlegroups.com
On 10/12/11 9:15 PM, Dave Merrill wrote:
> Sorry if I wasn't clear, I'm not trying to detect which engine it is,
> I've got that.
>
> I want a way to "fingerprint" each running instance, to tell it apart
> from other running instances, regardless of what engine they're using,
> even when there may be multiple instances of the same engine.
>
> For example, my laptop has one instance each of latest Railo, latest
> BD, and ACF 8, plus three instances of ACF 9, and I need to be able to
> tell each of those apart in code.

If you've got control of the startup, you can set a system property when
starting the engine and tell that way. I do something like this with
JBoss clusters to determine which node it's on, etc..

Or you could try something like expandPath("/") to see what the root dir
is. Or maybe drop to java and to a getResource() on something...

Obviously the most accurate is the explicit one (setting a property on
startup), but you may not have that control.

:Denny

--
Railo Technologies: getrailo.com Professional Open Source
Skype: valliantster (505)510.1336 de...@getrailo.com
GnuPG-FP: DDEB 16E1 EF43 DCFD 0AEE 5CD0 964B B7B0 1C22 CB62

Dave Merrill

unread,
Oct 12, 2011, 11:28:18 PM10/12/11
to ra...@googlegroups.com
Thanks for the thought Denny, but you hit it -- I don't have the
option to set a property at startup.

This is a "guest" package, designed to run under any app, that lets
you view and manipulate dbs and files, plus evaluate or run code you
type into it. Very very handy for debugging remotely.

Looks like ExpandPath('/') may win here; see my msg above. Still
wondering what's up w the blank rootdir though.

Dave

Randy Merrill

unread,
Oct 12, 2011, 11:38:12 PM10/12/11
to ra...@googlegroups.com
Could the rootdir in Railo actually be what context it is running in?
--
Randy Merrill

Denny

unread,
Oct 12, 2011, 11:42:29 PM10/12/11
to ra...@googlegroups.com
On 10/12/11 9:28 PM, Dave Merrill wrote:
> Thanks for the thought Denny, but you hit it -- I don't have the
> option to set a property at startup.
>
> This is a "guest" package, designed to run under any app, that lets
> you view and manipulate dbs and files, plus evaluate or run code you
> type into it. Very very handy for debugging remotely.
>
> Looks like ExpandPath('/') may win here; see my msg above. Still
> wondering what's up w the blank rootdir though.

Most the time it would probably work, but...

I'd lean towards a getPageContext() type of deal probably.
getPageContext().getServletConfig() maybe? Something like that, which
is tied to the servlet vs. a potentially incorrect file system path.

As for the rootdir, it sounds like it's a valid ticket. File away! :)

Denny

unread,
Oct 13, 2011, 12:13:29 AM10/13/11
to ra...@googlegroups.com
It looks like we could change ServerImpl.java rootDir to:

String rootdir= pc.getConfig().getRootDirectory().getAbsolutePath();

And get the web context web root, but Micha would know for sure.

:Denny

Gert Franz

unread,
Oct 13, 2011, 2:44:49 AM10/13/11
to ra...@googlegroups.com
Well something that works definitely on Railo is
expandPath("{railo-server}"). This will return you where the server context
directory is under Railo and this is unique per instance (has to be).
expandPath("/") imho wouldn't help since you might end up getting the same
directory for two instances in CF if you use them in a cluster and all point
to the same webroot. I guess best is to file a bug.

Greetings from Switzerland
Gert Franz
 
Railo Technologies      Professional Open Source
skype: gert.franz         ge...@getrailo.com
+41 76 5680 231           www.getrailo.com


-----Ursprüngliche Nachricht-----
Von: ra...@googlegroups.com [mailto:ra...@googlegroups.com] Im Auftrag von
Denny
Gesendet: Donnerstag, 13. Oktober 2011 06:13
An: ra...@googlegroups.com
Betreff: Re: [railo] server.coldfusion.rootdir

Michael Offner

unread,
Oct 13, 2011, 3:00:44 AM10/13/11
to ra...@googlegroups.com
server.coldfusion.rootdir works for me?!
i have no idea atm why this is not working in your case, but we will check.

/micha



2011/10/13 Gert Franz <ge...@getrailo.com>

Todd Rafferty

unread,
Oct 13, 2011, 6:13:21 AM10/13/11
to ra...@googlegroups.com

It is empty on a windows machine.

Michael Offner

unread,
Oct 13, 2011, 6:54:26 AM10/13/11
to ra...@googlegroups.com
do you see a stacktrace in error stream?

/micha

2011/10/13 Todd Rafferty <to...@getrailo.org>

Todd Rafferty

unread,
Oct 13, 2011, 8:10:34 AM10/13/11
to ra...@googlegroups.com
No, there's no error on the page or stacktrace. It's a valid "empty" string.

Robert Zehnder

unread,
Oct 13, 2011, 9:04:01 AM10/13/11
to ra...@googlegroups.com
FWIW, I am getting a blank string as well for server.coldfusion.rootdir on Ubuntu 10.10 and Railo 3.1.1.000
--
Robert Zehnder

Dave Merrill

unread,
Oct 13, 2011, 9:39:20 AM10/13/11
to ra...@googlegroups.com
I will file the bug when I get a chance, since it's clearly an
incompatibility with ACF, and apparently different on different
platforms, regardless of what you need it for.

However, thinking through my specific use case, it turns out that I
don't actually need to tell engine instances apart, only the root
directories they serve from. Given that, ExpandPath('/') is probably
better in the cluster case.

Dave

Tom Lenz

unread,
Oct 13, 2011, 9:36:07 AM10/13/11
to ra...@googlegroups.com
Works for me too, Windows XP, Railo 3.3.1.000

Dave Merrill

unread,
Oct 13, 2011, 9:54:57 AM10/13/11
to ra...@googlegroups.com

Todd Rafferty

unread,
Oct 13, 2011, 10:41:48 AM10/13/11
to ra...@googlegroups.com
FYI: I'm on Windows 7, Railo 3.3.1.000 and Tomcat 6 & 7. I haven't tested my linux machines yet.
Reply all
Reply to author
Forward
0 new messages