Follow me on Twitter - CFJamesAllen

I recently got introduced to the crazy world of Twitter and have to say I've got well and truly addicted! It's a brilliant new way to communicate, network and keep up to date with people. I have now setup a special Twitter account for Coldfusion and Internet programming related twittering so please feel free to follow me if your interested.

I've just setup a mini-feed on the right hand site of the blog which shows the recent 'tweets' that I've posted.

Follow as I get angry with CSS and tweet about all manor of Coldfusion and other Internet goodness.. Things often hot up around Friday evening when the weekend usually kicks off with beer, chips (fries to the US readers) and US TV shows. :)

My username on Twitter is CFJamesAllen.

Fixing "java method security exception" when installing Mango Blog

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.

New SagePay URL's

I thought it might be easier if I listed the new SagePay URL's here.

I'll start with some code for Coldfusion developers who want to quickly copy and paste straight into their payment pages.

Note: These URL's are for the VSPDirect product

Also, this is not a complete list of the operations available (I don't use all of them in my code so didn't include).

<cfset protx = StructNew()>
<cfset protx.live.purchaseURL = "https://live.sagepay.com/gateway/service/vspdirect-register.vsp">
<cfset protx.live.voidURL = "https://live.sagepay.com/gateway/service/void.vsp">
<cfset protx.live.refundURL = "https://live.sagepay.com/gateway/service/refund.vsp">
<cfset protx.live.releaseURL = "https://live.sagepay.com/gateway/service/release.vsp">
<cfset protx.live.repeatURL = "https://live.sagepay.com/gateway/service/repeat.vsp">
<cfset protx.live.authoriseURL = "https://live.sagepay.com/gateway/service/authorise.vsp">
<cfset protx.live.callbackURL = "https://live.sagepay.com/gateway/service/direct3dcallback.vsp">

<cfset protx.test.purchaseURL = "https://test.sagepay.com/gateway/service/vspdirect-register.vsp">
<cfset protx.test.voidURL = "https://test.sagepay.com/gateway/service/void.vsp">
<cfset protx.test.refundURL = "https://test.sagepay.com/gateway/service/refund.vsp">
<cfset protx.test.releaseURL = "https://test.sagepay.com/gateway/service/release.vsp">
<cfset protx.test.repeatURL = "https://test.sagepay.com/gateway/service/repeat.vsp">
<cfset protx.test.authoriseURL = "https://test.sagepay.com/gateway/service/authorise.vsp">
<cfset protx.test.callbackURL = "https://test.sagepay.com/gateway/service/direct3dcallback.vsp">

<cfset protx.sim.purchaseURL = "https://test.sagepay.com/Simulator/VSPDirectGateway.asp">
<cfset protx.sim.voidURL = "https://test.sagepay.com/Simulator/VSPServerGateway.asp?Service=VendorVoidTx">
<cfset protx.sim.refundURL = "https://test.sagepay.com/Simulator/VSPServerGateway.asp?Service=VendorRefundTx">
<cfset protx.sim.releaseURL = "https://test.sagepay.com/Simulator/VSPServerGateway.asp?Service=VendorReleaseTx">
<cfset protx.sim.repeatURL = "https://test.sagepay.com/Simulator/VSPServerGateway.asp?Service=VendorRepeatTx">
<cfset protx.sim.authoriseURL = "https://test.sagepay.com/Simulator/VSPServerGateway.asp?Service=VendorAuthoriseTx">
<cfset protx.sim.callbackURL="https://test.sagepay.com/Simulator/VSPDirectCallback.asp">

Now here are the URL's without the code:

LIVE

 

purchaseURL = https://live.sagepay.com/gateway/service/vspdirect-register.vsp
voidURL = https://live.sagepay.com/gateway/service/void.vsp
refundURL = https://live.sagepay.com/gateway/service/refund.vsp
releaseURL = https://live.sagepay.com/gateway/service/release.vsp
repeatURL = "ttps://live.sagepay.com/gateway/service/repeat.vsp
authoriseURL = https://live.sagepay.com/gateway/service/authorise.vsp
callbackURL = https://live.sagepay.com/gateway/service/direct3dcallback.vsp

TEST

purchaseURL = https://test.sagepay.com/gateway/service/vspdirect-register.vsp
voidURL = https://test.sagepay.com/gateway/service/void.vsp
refundURL = https://test.sagepay.com/gateway/service/refund.vsp
releaseURL = https://test.sagepay.com/gateway/service/release.vsp
repeatURL = https://test.sagepay.com/gateway/service/repeat.vsp
authoriseURL = https://test.sagepay.com/gateway/service/authorise.vsp
callbackURL = https://test.sagepay.com/gateway/service/direct3dcallback.vsp

SIM

purchaseURL = https://test.sagepay.com/Simulator/VSPDirectGateway.asp
voidURL = https://test.sagepay.com/Simulator/VSPServerGateway.asp?Service=VendorVoidTx
refundURL = https://test.sagepay.com/Simulator/VSPServerGateway.asp?Service=VendorRefundTx
releaseURL = https://test.sagepay.com/Simulator/VSPServerGateway.asp?Service=VendorReleaseTx
repeatURL = https://test.sagepay.com/Simulator/VSPServerGateway.asp?Service=VendorRepeatTx
authoriseURL = https://test.sagepay.com/Simulator/VSPServerGateway.asp?Service=VendorAuthoriseTx
callbackURL = https://test.sagepay.com/Simulator/VSPDirectCallback.asp

 

Protx - SagePay URL switch today - Old URL's DO NOT work anymore due to forwarding failure

NOTE: It looks like this problem may only affect Coldfusion and Java.

Protx have just switched over to the new SagePay URL's today on LIVE and unfortunately the old URL's have broken. This was not supposed to happen and the old URL's should have continued for the forseeable future.

SagePay are telling developers to update all sites to the new URL system.

I can't imagine how many orders are being lost this morning.

Get your URL's updated ASAP, full details here:

https://support.sagepay.com/forum/Topic8090-22-1.aspx

ProtX is rebranding to SagePay - TEST and SIM servers now use different URL!

I wondered why when I tried to test my Protx VSPServer integration today that it just wouldn't work. I kept getting this SSL problem when submitting the HTTP POST:

I/O Exception: Name in certificate `test.sagepay.com'
does not match host name `ukvpstest.protx.com'

I assumed this was a temporary issue but have just found out that ProtX is rebranding to SagePay and you need to use the following domain for TEST and SIM:

http://test.sagepay.com

There is also a new path for each operation so check out the table posted on the ProtX support forums:

https://support.sagepay.com/forum/Topic8090-22-1.aspx

Error installing SQL Server 2005 SP3 - Setup Support Files

I just came across an annoying problem when trying to upgrade MS SQL 2005 my development server to SP3. Whatever I did it would fail on the first step of the process - "Setup Support Files". Here's the lines from the log file the patch created:

MSI (s) (B0:C8) [15:22:37:703]: Source for file 'ExceptionMessageBox.dll.476E40C2_BF50_44F5_B79F_85F11E8470B6' is compressed
MSI (s) (B0:C8) [15:22:38:328]: Note: 1: 2360 
MSI (s) (B0:C8) [15:22:38:328]: Note: 1: 2360
MSI (s) (B0:C8) [15:22:38:328]: Note: 1: 2360
MSI (s) (B0:C8) [15:22:38:328]: Note: 1: 2360
MSI (s) (B0:E0) [15:22:38:343]: Assembly Error:Version %d.%d is not a compatible version.
MSI (s) (B0:E0) [15:22:38:343]: Note: 1: 1935 2:  3: 0x80131107 4: IStream 5: Commit 6:  
MSI (s) (B0:C8) [15:22:38:343]: Note: 1: 1304 2: Microsoft.NetEnterpriseServers.ExceptionMessageBox.dll
MSI (s) (B0:C8) [15:22:38:406]: Product: Microsoft SQL Server Setup Support Files (English) -- Error 1304. Error writing to file: Microsoft.NetEnterpriseServers.ExceptionMessageBox.dll.  Verify that you have access to that directory.

Error 1304. Error writing to file: Microsoft.NetEnterpriseServers.ExceptionMessageBox.dll.  Verify that you have access to that directory.

This is the core error here:

MSP Error: 1304  Error writing to file: Microsoft.NetEnterpriseServers.ExceptionMessageBox.dll.  Verify that you have access to that directory.

I did a lot of searching but just couldn't find out what could be causing this or how to fix it.

I eventually discovered that the problem was down to the version of .NET I had installed. I *think* I was running the old V1.1 of the .NET assemblies as I had to downgrade to get something running on an ASP website.

Anyway, I installed the latest version of .NET - V3.5 and restarted the SP3 install and it went through without problem.

It's annoying that on the download page for SP3 there is no mention that you need an updated version of .NET installed or that that patch doesn't even tell you! Another Microsoft oversight that has wasted a few hours of my life!

I am assuming this would have worked fine if I had upgraded to V2 of .NET as well.

You can get the latest .NET installer from here

JQuery selector problem - 'Syntax error, unrecognized expression' fix

I just spent a little time wrestling with an annoying JQuery error when trying to select a form element by name.

I was using the following code to simply grab the contents of a hidden field named 'required':

var req = $("input[@name=required]").val();

I got this syntax from a quick google search and found it referenced on a number of web guides about JQuery.

However, when I used it I got the following error in Firefox:

'Syntax error, unrecognized expression: [@name=required]' when calling method: ..... '

Well after some head scratching and then some more searching I found the answer. The @ syntax is no longer supported in JQuery 1.3+.

So the simple fix is to just remove the @ and it'll work as expected:

var req = $("input[name=required]").val();

Hopefully this will help someone who, like me, hit's Google when looking for a quick fix to a problem.. :)

How to get Microsoft Script Debugger to work in IE7 on Vista

I've just come across a problem when installing the Microsoft Script Debugger in IE7 on Vista.
It installs fine, but as soon as I restart IE the browser hangs. I then had to kill the IE task.

At this point an 'Internet Explorer Security' error popup appeared:

I then clicked 'Allow'. However, upon restarting IE it hung again.

Very frustrating until I realised the simple solution. All you have to do is run the browser, let it hang and then kill it. When the above popup appears, tick the box which says 'Do not show me the warning for this program again' and then click 'Allow'.

Now, when you start IE it will start fine without the hang and debugging working perfectly.

Annoying that this is the way to get it to work but at least there is a workaround.

I am running Vista x64 Ultimate for what it's worth.

By the way, if you do any development with IE 7 and Javascript you NEED 'My Debug Bar' - www.my-debugbar.com. It add's a FireBug type debug interface to IE which lets you debug Javascript without the need to drop into the awful Microsoft Visual Debugger thing. The same guy also develops DebugBar which is also a fantastic piece of kit for adding comprehensive debugging to IE.

CFAjaxProxy - setCallBackHandler is global - remember that

Just a quick gotcha that caught me out for hours while using CFAjaxProxy in a messaging application I'm currently building.

When using CFAjaxProxy in asyncronous mode and setting a callback handler (setCallBackHandler(function)), be aware that this then becomes the callback handler for ALL subsequent calls. This is very important when building a complex Ajax application.

Basically when the user sends a message, I set a callback handler which then dynamically reloads the lists of past messages in the thread without leaving the message page.

Outside of this I have a global 30 second poll function which also uses CJAjaxProxy to obtain various user data (to alert of new messages etc). What I couldnt understand was that every 30 seconds the message list on this page would reload all by itself.. Spooky.. I searched my code looking for a call to my reloadThreadMessage() function but couldn't find one, outside of the send message function..

After much head scratching and shouting I finally realised that what was happening is every 30 seconds when the global poll was run, the CFAjaxProxy call to get the global data was still using the callback handler that was set when I sent the earlier message!

To fix this I simply place a call to setSyncMode() before the global data call and this removes the callback handler routine.

Something to bear in mind if your seeing weirdness while making multiple CFAjaxProxy calls in asyncronous mode..

Flex applications hanging when using gzip http header / body compression

I just discovered a problem while attempting to use Brian Rinaldi's excellent Illudium PU36 Code Generator on my development server. It would load up but then after entering my Coldfusion administrator password it would just hang. It always used to work so I realised that something must have changed on my server.

Upon monitoring the HTTP requests going to the server I noticed that the first request to /flex2gateway/ on the server was hanging. The response header was received, but then it was waiting for the response body that never seemed to arrive.

After some head scratching I realised that I had implemented gzip http header / body compression on my development server (a filter for the JRun server). As soon as I removed this the code generator started working perfectly.

This is almost 100% a problem that will affect most Flex apps, so it's something to look out for if you have any issues with hangs when trying to use Flex.

Disclaimer: As I have only used one Flex application I have not been able to test the above assertion. If you know of Flex apps that work with the http compression filter I'm using, please let me know.

 

The compression filter I am using is GZIP2WayFilter by Thomas Bayer. Apart from the issue with Flex this works very well indeed with compression of CFM templates to crazy sizes.

More Entries

© 2014 James Allen | Contact Me
This blog runs on the awesome power of BlogCFC - created by Raymond Camden. This blog is running version 5.9.