Variable instance.appMapping not set for modules?

I am running into some problems with some views for a module in my application. Upon further testing, the “instance.appMapping” variable that is used in the Renderer.cfc locateModuleView() is empty … but only for the module. The same variable shows the expected value a few lines up in the locateView() function.

Is there some reason the appMapping variable is not available for the modules? I am running ColdBox 3.0.0 if that matters.

Thanks.

What is you app mapping, if it is the default / or “” then it would be “” in your modules. AppMapping is only used for applying situations for Application Servers that use context in the url for example

http://www.mydomain.com/context/

In some cases a central Application server is used, with many contexts to run that application.

So this begs the question, are you using AppMapping in this scenario, or are you wanting something else?

Andrew,

I have the appMapping value set because my config, handlers, etc. folders all live one level above the web root. The appMapping value is set to “app” which is a mapping defined to point to the folder above the web root. If I don’t set this value, the viewPath tries to render off of the web root and the fileExists check fails. Adding in the appMapping value works for the locateView() method, but as mentioned, in the locateModuleView() method, appMapping is empty and therefore it fails to find the correct view files.

Thanks.

Ok I just wanted to clarify what you are actually trying to do.

Your setup seems to be fairly unusual, why each site is setup that way is not recommended. Due to each site being open to a huge security hole.

Anyway, I am thinking that something else is going on here. Because each module when it loads the configuration file, is using the same setting in the global config.cfc

I would almost guess that you have run into the same issue, as most end up doing. If that is the case then you will need to look into your Administrator in ColdFusion and remove the caching of paths for components and save class files. If I recall right it is the paths that is the issue.

The reason I am thinking is that you are loading a default configuration of ColdBox, and it is the same instance right across all your sites. You maybe running into a race condition here, but I can’t be certain.

But I am not sure why the AppMapping is not being returned when a module is loaded, that seems really strange to me. Are you setting it any where else within the application? Just a thought.

Andrew,

Without derailing this, I am curious as to where you see the security hole here.

Back to the topic at hand … in my current CF 8 environment, I have all of the CF admin caching settings turned off and I cleared the cache just for. No difference.

As for the application, this is just about as stock of a ColdBox 3.0.0 app as you can get right now. I am just playing with the views and layouts as a proof of concept for this template system. The appMapping is defined at the Application.cfc level and that is it.

Because the Renderer.cfc does not check to see if the appMapping value exists, it ends up adding multiple slashes at the start of the file path which prevents the path from being expanded properly.

Thanks.

Jeff,

I guess it would mean that I would need to know more about the setup to comment on this, but if you’re using a single IIS site to provide a mapping that is not a virtual directory this means ColdFusion can traverse from code within one site to the next. But I don’t have enough information to know what you’re actually doing here.

As for the renderer it is indeed using the AppMapping, and which is why I hinted that you might be setting the AppMapping somehow elsewhere or there is a case where each application is using the same application name and the same coldbox instance can cause issues elsewhere.

So this is going to be finding a needle in a haystack, as I doubt this is an issue with ColdBox itself.

But I did pick up on the fact you stated it is set at the application.cfc, does that mean your defining this inside the application.cfc or are you defining the AppMapping in the config.cfc for each site to point to the location of Application.cfc which I think is your problem, now that I think about it.

Andrew,

The only place the mapping value was defined was the COLDBOX_APP_MAPPING in the Application.cfc file. It was not coded into the Coldbox.cfc config file.

In either case, this does not appear to do what I wanted even if the mapping issue was resolved. I was trying to potentially override an entire module based upon the “template” being used, but this was causing issues if the template for the module only included the views/layouts and not the rest of the code. Apparently, it would not pick up the handler in the “base” module, but use the views/layouts in the “template” module.

So now I am back to trying to figure out how to override the view and layout location for a module.

Thanks.

Ok this is a bit of a confusing issue, because COLDBOX_APP_MAPPING is more to define or force another instance of ColdBox, that means you can have two instances running with different settings.

However in your case, you need to use the AppMapping in the config.cfc, as this is where and how the application uses and defines the event route for the URL. Which is what you need to do.

The method I described at the beginning works I have done it on both normal core skinning and module skinning a long time ago, but never released the code for the site I was working on at the time.

Now the thing here is that you will need to rely on the logger, and put information into the logs to help you trace where it is falling back to and why. One thing that is hard to distinguish is where it is falling, because if it can’t find the current location it traverses back to other known locations.

Which is something you will need to take into consideration when tracing where this is going wrong, I know it was hard but adding log infos helped me trace why and how that was happening.