I've just setup a new blog which I'm going to use for tracking my weight loss and fitness goals this year. As part of the planning for the project I had to decide what blog software to use. I was all set to go with BlogCFC (as I use for this blog) but then Mango Blog came onto my radar. The brilliant API system and easy to use skinning facilities swung me so I decided to build the new blog using Mango.
However, when I uploaded the code to my CF7 hosting and accessed the web root I got this error:
java method security exception. A security exception occurred while
invoking java method on a "java.lang.Class" object. MethodName is
getMethods. Possible cause: createobject function and cfobject tag are
disabled in the security sand box.
After searching the MangoBlog forums I found other people had experienced this problem. However, the author of MangoBlog could only suggest that maybe the ISP has disabled the CreateObject function.
To check this, I did some tests but found that CreateObject was working perfectly.
Very weird. However, I have found the solution - though one which makes 0 sense to me.
If you get this, to fix open up application.cfc.
Now, comment out the entire onError function:
<cffunction name="onError" returnType="void">
<cfargument name="Exception" required="true" />
<cfargument name="EventName" type="String" required="true" />
<cfset request.message = createObject("component",variables.componentsPath & "Message") />
<cfset request.message.setTitle("Error: " & arguments.EventName) />
<cfset request.message.setText(arguments.exception.message) />
<cfset request.message.setStatus("error") />
<cfset request.message.setData(arguments.exception.detail) />
<!--- Set appropriate HTTP status code --->
<cfif REFindNoCase("NotFound$",arguments.exception.type)>
<cfheader statuscode="404" statustext="Not Found" />
<cfelse>
<cfheader statuscode="500" statustext="Internal Server Error" />
</cfif>
<cftry>
<cfsetting enablecfoutputonly="false">
<cfinclude template="generic.cfm">
<cfcatch type="any">
<cfsetting enablecfoutputonly="false">
<cfinclude template="error.cfm">
</cfcatch>
</cftry>
</cffunction>
Now access the webroot again.. The install wizard should appear as expected. At this point you can uncomment the onError handler and reupload. Everything should work fine then.
What the hell is going on here then? It could be just me who this works for but I'd be interested to hear from anyone else who has success with this fix. I am using Coldfusion MX 7.
My local development server running CF8 has no issues.