PDA

View Full Version : GetPageContext include method causing a security exception - in hosted environment



scaph01
December 27th, 2010, 02:50 PM
Maybe someone can point me in the right direction. I an a noob with Coldfusion and I am trying to call a jsp page from a cold fusion page. On my local development environment the following code works fine (taken from Adobe documentation)


<cfscript>
GetPageContext().include('testvars.jsp?name=Robi%2 0Sen');
</cfscript>

where testvars.jsp is in the same directory as the CFM file.

When i upload to host, i get the following error:


Security: The requested template has been denied access to C:\ColdFusion9\wwwroot\Mobile\testvars.jsp.

I do know that the pages are on the D: drive and not on the C:\ drive. So the reference to the C:\ColdFusion... path has me scratching my head....

I can directly access the JSP file and for now, I have placed it in an IFRAME as a short term hack.


From the java documentation fior the include method i have read:

If the relativeUrlPath begins with a "/" then the URL specified is calculated relative to the DOCROOT of the ServletContext for this JSP. If the path does not begin with a "/" then the URL specified is calculated relative to the URL of the request that was mapped to the calling JSP.

the host does not have many Cold fusion settings to change / tweak or view...so any debugging pointers or assistance will be welcomed

Phil

Brian
December 27th, 2010, 03:40 PM
Phil,

I would suggest giving the include the full path to your .jsp file like:



<cfscript>
GetPageContext().include('d:/home/your_domain.com/wwwroot/testvars.jsp?name=Robi%20Sen');
</cfscript>

scaph01
December 27th, 2010, 05:33 PM
Thanks for the fast response Brian, I tried the code you recommended



<cfscript>
GetPageContext().include('d:/home/your_domain.com/wwwroot/testvars.jsp?name=Robi%20Sen');
</cfscript>



but i see the root directory is some sort of constant....as i get the following exception now...



Security: The requested template has been denied access to C:\ColdFusion9\wwwroot\Mobile\d:\home\slingping.co m\wwwroot\Mobile\testvars.jsp.

The following is the internal exception message: access denied (java.io.FilePermission C:\ColdFusion9\wwwroot\Mobile\d:\home\slingping.co m\wwwroot\Mobile\testvars.jsp read)



Thanks for your help!

Phil

Brian
December 28th, 2010, 02:20 PM
Phil,

That's weird. It find sthe correct path when it's a .cfm file, but not when a .jsp. I've had a couple of our guys research this and didn't come up with anything. You may want to ask Adobe about this in a shared environment.

scaph01
December 29th, 2010, 09:51 PM
Thanks Brian, i have started some threads elsewhere on this same topic. Is there any more settings for cold fusion in Parrallels Helm control panel that i check out? I only see "enable cold fusion" and "enable sand box". From what I think the hostek server is using Java 1.4, my local environment has 1.6

Thanks
Phil

Brian
December 30th, 2010, 09:07 AM
That's all of the CF related options in the Helm control panel. I checked this server and it was running the default Java version that ships with CF9. Most of our servers use 1.6. I have updated this server to use 1.6 build 22.

scaph01
January 5th, 2011, 09:26 AM
Thanks for the help,

I have now been seeing some random JRun compilation errors with my simple JSP so there is something happening on this server ever since the jave upgrade.

Back to my original issue...

I have raised a question on Adobe support and have not had any pointers or help...

http://forums.adobe.com/thread/771225

I also asked this question on house of fusion here: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:62408


The last suggestion was to try to emulate hostek's setup, i see i am running the site in sandboxed environment (checked in the Help control panel under Coldfusion options).

What settings are used for jrun - and are they tunable?

Can you give me a dump of all of the coldfusion settings in place - so i can setup my envirnment to match hosteks?

Thanks
Phil