Implementation of coldfusion.server.ServiceFactory getRuntimeService()?

240 views
Skip to first unread message

Tony Junkes

unread,
Jul 22, 2015, 1:51:05 PM7/22/15
to Lucee
The code below runs in ACF,

writeDump( createObject("java", "coldfusion.server.ServiceFactory").getRuntimeService().getMappings() );

In Lucee it results in: "the service [RuntimeService] is currently missing. At the moment you can use cfadmin tag instead"

I've found the way to get similar results using the <cfadmin> tag but the process is a bit more involved since it either requires a password or making read access open from the admin.

Is there a reason why this hasn't been implemented similar to ACF?

The reason I ask is currently, the Taffy REST framework is making use of the above object creation to check if a server-level mapping exists. For compatibility reasons, this would be ideal to have available from ACF and Lucee unless there's another method that I'm not aware of.

Cheers.

Jon Clausen

unread,
Jul 22, 2015, 3:18:38 PM7/22/15
to lu...@googlegroups.com

Is there a specific reason your taffy mappings need to exist at the server level? Their docs show that App-level mappings are acceptable: http://docs.taffy.io/3.0.0/

It’s much easier to handle those mappings at the app level and checking for them is as simple as a structKeyExists().

if(!structKeyExists(getApplicationSettings().mappings,'/mymapping')){
     
}

Server-level mappings seems so… 2008. :)

--
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/d51811ea-1244-4193-a5b5-896d0f970f86%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tony Junkes

unread,
Jul 22, 2015, 3:44:56 PM7/22/15
to Lucee
This is regarding code that's in Taffy's api.cfc

This cropped up when someone else ran into the issue. I did some testing and reported back to Adam about this in regards and have just been inquiring to try and close in on a solution until he gets a moment to look at it as well.

Adam Tuttle

unread,
Aug 14, 2015, 11:36:27 AM8/14/15
to Lucee
Taffy uses this factory to determine if there is a server level /resources mapping. It's part of a method used to find the resources the developer is defining, which could be in a variety of locations.

For more context, see the function guessResourcesPath, here: https://github.com/atuttle/Taffy/blob/master/core/api.cfc#L928

But my position is this:

- It exists and works in current supported versions ACF
- It existed and worked in Railo
- It existed and worked in earlier versions of Lucee

Therefore, if you're going to remove functionality from the platform, shouldn't you provide another reasonable way to accomplish the same goal?

For Taffy's purposes, asking for a CF Admin password is simply unacceptable.

In my opinion, the burden is on Lucee to justify why it was removed, rather than on the community to justify why it's needed. Even if that were not the case, in my opinion, Taffy's usage is a reasonable and clear justification.

Kai Koenig

unread,
Aug 14, 2015, 4:04:03 PM8/14/15
to lu...@googlegroups.com
I’m not sure what the history is of this not working anymore in Lucee (do you know from what version onwards it’s breaking — is it the 5.x branch only?), but from glancing over it, I’d agree with your opinion that Taffy’s use is reasonable and having to use cfadmin is not great.

However — the ServiceFactory was never official and Railo’s provisioning of it was to keep compatibility going. From that point of view and the goal to clean up certain things in the “new Lucee language”, I’d generally not rely on this object to be there.

Could either of you raise a ticket for this please?

Cheers
Kai


--
See Lucee at CFCamp Oct 22 & 23 2015 @ Munich Airport, Germany - Get your ticket NOW - http://www.cfcamp.org/
---
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.

Paul Klinkenberg

unread,
Aug 14, 2015, 4:06:57 PM8/14/15
to lu...@googlegroups.com
Hi Adam,

I wanted to check the source code history to see where it stopped working. Unfortunately, I can not find a working version...



In all those cases, it threw the "missingService" exception. Are you sure it worked in Railo and Lucee?

Kind regards,

Paul Klinkenberg



--
See Lucee at CFCamp Oct 22 & 23 2015 @ Munich Airport, Germany - Get your ticket NOW - http://www.cfcamp.org/
---
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.

Adam Tuttle

unread,
Aug 14, 2015, 9:37:35 PM8/14/15
to Lucee
To the best of my knowledge, yes, it worked on Railo and earlier versions (though I don't know specifics, sorry) of Lucee.

The code in question was contributed in April of this year, and I know we've got quite a few people using Taffy on Lucee. I imagine if it were broken for them they'd have spoken up.

I don't have time to setup a Lucee environment and run the tests, unfortunately (I shouldn't even be taking the time to write this email...)

Adam

Tony Junkes

unread,
Aug 14, 2015, 11:17:14 PM8/14/15
to Lucee
I'll admit, when I've toyed with Taffy it's been on ACF. I've never used it in production (which would be Lucee and Railo before it). Though, I thought I remembered the ServiceFactory object existing in some version of Railo; though, I could be wrong.

With that said, I went ahead and briefly tested Taffy (3.0.2) against a handful of express versions. See the list below.

Railo 4.2.1.008
Lucee 4.5.0.042
Lucee 4.5.1.023
Lucee 5.0.0.49

In my findings, all of them threw an error in regards to the use of the ServiceFactory object with a suggestion in the stack trace to use <cfadmin> as a workaround. Upon removing this check in api.cfc, all seemed to work. It's surprising that only one person has spoken out about the issue through all of these Railo/Lucee versions (so far?).

I think, in this situation, it's worth filing a bug/feature request asking for, at least, partial functionality of ServiceFactory to be implemented. I'll go ahead and do that.

Cheers.

Kai Koenig

unread,
Aug 15, 2015, 3:09:10 AM8/15/15
to lu...@googlegroups.com
The question this raises to me is:

Should Lucee (even though it only be in the CFML compatibility layer) provide an undocumented functionality that even ACF doesn’t provide “officially”?

Or shouldn’t Lucee instead provide properly documented and supported functionality to achieve some of the things that the ServiceFactory provides through the backdoor instead?

Cheers
Kai


--
See Lucee at CFCamp Oct 22 & 23 2015 @ Munich Airport, Germany - Get your ticket NOW - http://www.cfcamp.org/
---
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.

Brad Wood

unread,
Aug 15, 2015, 9:51:06 AM8/15/15
to Lucee
> I don't have time to setup a Lucee environment and run the tests

You can run the Taffy tests in Lucee via CommandBox in a matter of seconds with the following commands:

CommandBox> install git://github.com/atuttle/Taffy.git
CommandBox> install mxunit
CommandBox> start --!openbrowser
CommandBox> server open /taffy/tests
CommandBox> server open /taffy/tests/tests

They are currently throwing the error you reported in this thread (getRuntimeService).

+1 to Jon C's suggestion of getApplicationSettings() as a work around.

And to suggest another, why does it matter whether the resources are defined as a mapping at all?  Wouldn't directoryExists( '/resources' ) be sufficient to determine whether resources had been defined via any means?

Regarding where they stopped working in Lucee, I can't say-- I've never tried to use it.  Railo/Lucee has provided several "undocumented" APIs before (like sessionfactory) just because they're popular.  If it worked before and not now, it's possible it was an accidental regression. Based on what Paul K says though, it makes me question if it ever worked.

Thanks!

~Brad

Tony Junkes

unread,
Aug 15, 2015, 10:16:03 AM8/15/15
to Lucee
I def have similar thoughts.

I'm thinking certain parts of cfadmin should be opened up as an object of functions carrying out the similar tasks it already does; but from a read only view. If certain info is to be deemed sensitive from even a read only standpoint, make the server/web context password a required parameter.

I don't know how sensitive some might feel this info to be, but from a framework developers perspective, I think it makes sense to make info like mappings and similar info available to view for config/environment setup etc.

Tony Junkes

unread,
Aug 15, 2015, 11:48:52 AM8/15/15
to Lucee
On Saturday, August 15, 2015 at 9:51:06 AM UTC-4, Brad Wood wrote:

And to suggest another, why does it matter whether the resources are defined as a mapping at all?  Wouldn't directoryExists( '/resources' ) be sufficient to determine whether resources had been defined via any means?


I'm not sure I was aware that directoryExists() works with mappings. Interesting.

Adam Tuttle

unread,
Aug 16, 2015, 9:51:15 AM8/16/15
to Lucee
Tony caught up with me elsewhere about the directoryExists() suggestion, and I like it. Thanks, Brad. I think we'll be switching to that.

To directly answer your question about "it only taking a few seconds in commandbox" ~~ that would require having CB installed and being familiar enough with it to (a) know that and (b) know what to do from there -- and I have neither of those things (until now, which solves A). Don't forget that as programmers once we've done/mastered something, we tend to think of it as fast and easy, when in reality it is not for those that haven't mastered it yet.

Also I'm working 14 hour days through the end of August to meet a deadline, so no, I don't have time to play with CommandBox.

So, I guess, for now... immediate problem solved. But as Kai has pointed out multiple times, it would be nice if Lucee supported functionality like this (and others) in some supported way.

Adam

Michael Offner

unread,
Aug 16, 2015, 12:51:04 PM8/16/15
to lu...@googlegroups.com
First of all Lucee nor Railo never supported this (serviceFactory.getRuntimeService).
Check out the Railo source

Our politic about this always was, if there is a high demand we implement also undocumented functionality. We did for example a lot of undocumented functionality back in the days when "Transfer" was popular, transfer has used a lot of undocumented functionality. But if something is not requested or there is an other way to do it we will not do it.
It is part of the base architecture of Lucee that you cannot change persistent setting without having a password, we have no plans to change that fact. Change this would be a security concern

Micha
--
See Lucee at CFCamp Oct 22 & 23 2015 @ Munich Airport, Germany - Get your ticket NOW - http://www.cfcamp.org/
---
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.

Adam Tuttle

unread,
Aug 17, 2015, 7:54:03 AM8/17/15
to Lucee
Micha, nobody is asking for the ability to _change_ mappings. Only to enumerate them.

Adam


On Sunday, August 16, 2015 at 12:51:04 PM UTC-4, Micha wrote:
First of all Lucee nor Railo never supported this (serviceFactory.getRuntimeService).
Check out the Railo source

Our politic about this always was, if there is a high demand we implement also undocumented functionality. We did for example a lot of undocumented functionality back in the days when "Transfer" was popular, transfer has used a lot of undocumented functionality. But if something is not requested or there is an other way to do it we will not do it.
It is part of the base architecture of Lucee that you cannot change persistent setting without having a password, we have no plans to change that fact. Change this would be a security concern

Micha

Am Sonntag, 16. August 2015 schrieb Adam Tuttle :
Tony caught up with me elsewhere about the directoryExists() suggestion, and I like it. Thanks, Brad. I think we'll be switching to that.

To directly answer your question about "it only taking a few seconds in commandbox" ~~ that would require having CB installed and being familiar enough with it to (a) know that and (b) know what to do from there -- and I have neither of those things (until now, which solves A). Don't forget that as programmers once we've done/mastered something, we tend to think of it as fast and easy, when in reality it is not for those that haven't mastered it yet.

Also I'm working 14 hour days through the end of August to meet a deadline, so no, I don't have time to play with CommandBox.

So, I guess, for now... immediate problem solved. But as Kai has pointed out multiple times, it would be nice if Lucee supported functionality like this (and others) in some supported way.

Adam

On Saturday, August 15, 2015 at 11:48:52 AM UTC-4, Tony Junkes wrote:
On Saturday, August 15, 2015 at 9:51:06 AM UTC-4, Brad Wood wrote:

And to suggest another, why does it matter whether the resources are defined as a mapping at all?  Wouldn't directoryExists( '/resources' ) be sufficient to determine whether resources had been defined via any means?


I'm not sure I was aware that directoryExists() works with mappings. Interesting.

--
See Lucee at CFCamp Oct 22 & 23 2015 @ Munich Airport, Germany - Get your ticket NOW - http://www.cfcamp.org/
---
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+unsubscribe@googlegroups.com.

Mark Drew

unread,
Aug 17, 2015, 8:22:52 AM8/17/15
to lu...@googlegroups.com
You can do
getApplicationSettings()  (Lucee/Railo only)
getApplicationMetadata() (Lucee/Railo and ACF)


and you have a mappings key so you can do

getApplicationMetadata().mappings.keyExists('/mapping');

and of course, if you don't have to have a list but just check it's there:

DirectoryExists("/mapping") (as has been said before)

HTH

MD




Adam Tuttle wrote:
        it, send an email to lucee+un...@googlegroups.com.

        To post to this group, send email to lu...@googlegroups.com.
        To view this discussion on the web visit
        https://groups.google.com/d/msgid/lucee/96d6966e-375b-4844-bbd6-32e728e5cc83%40googlegroups.com

        For more options, visit https://groups.google.com/d/optout


--
See Lucee at CFCamp Oct 22 & 23 2015 @ Munich Airport, Germany - Get
your ticket NOW - http://www.cfcamp.org/
---
You received this message because you are subscribed to the Google
Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send

To post to this group, send email to lu...@googlegroups.com

To view this discussion on the web visit

Adam Tuttle

unread,
Aug 17, 2015, 10:09:53 AM8/17/15
to Lucee
Mark, does getApplicationMetadata() return *server-level* mappings? That's what we're after in this case.

As I've already mentioned, Taffy is (and has already) converted to use directoryExists for this purpose; so we DON'T need this for Taffy support. But that said, I continue to believe this is a valuable asset for the platform to have.

That's my last word on it. Add it or don't. I've made my case and I tire of repeating myself.

Have a wonderful day, everyone.

Adam

Brad Wood

unread,
Aug 17, 2015, 10:14:46 AM8/17/15
to lu...@googlegroups.com
I think this is a Lucee-only thing, it's worth nothing there is a "Access Read" and "Access Write" setting in the admin under "Security > Access" which will allow read-only access via the cfadmin tag.  It defaults to "password protected" but also allows "open" and 'closed". I think I had to use that to get Transfer ORM working on Lucee recently.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp 

ColdBox Platform: http://www.coldbox.org 


You received this message because you are subscribed to a topic in the Google Groups "Lucee" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/lucee/AA3hFdg0k_M/unsubscribe.
To unsubscribe from this group and all its topics, send an email to lucee+un...@googlegroups.com.

To post to this group, send email to lu...@googlegroups.com.

Mark Drew

unread,
Aug 17, 2015, 11:57:00 AM8/17/15
to lu...@googlegroups.com


Adam Tuttle wrote:
> Mark, does getApplicationMetadata() return *server-level* mappings?
> That's what we're after in this case.
You are right, it only returns Per-Application settings rather than
server or web settings. You are right, that should be something you can
do as an app developer.

Glad directoryExists() works for your use case.

MD

Zac Spitzer

unread,
Jan 4, 2016, 11:07:36 PM1/4/16
to Lucee
If's it just going to be an alias, it should be fixed just for ACF compat
Reply all
Reply to author
Forward
0 new messages