Solved

Coldfusion 9 AJAX Error on Production Server

Posted on 2010-11-18
10
1,157 Views
Last Modified: 2012-05-10
I am having a problem with some <cfajaxproxy> calls on my production web server.  I have made a very simple example to illustrate this problem.  This code works perfect on our local development server (same OS and CF version as the production server) but it fails on the production server.

First the example code...

<!---This is index.cfm--->
<cfajaxproxy cfc="test" jsclassname="testCFC">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>  
        <script type="text/javascript">
            $(document).ready(function()
            {
                var myTest = new testCFC();
                myTest.setCallbackHandler(callback);
                myTest.setErrorHandler(errorHandler);
                myTest.testMethod();
            });
            callback = function(result)
            {
                $("#output").html(result)
            }
        
            errorHandler = function()
            {
                alert("There was a problem running method.");
            }
        </script>
	</head>
	<body>
		<div id="output"></div>
	</body>
</html>

Open in new window


<!---This is test.cfc--->
<cfcomponent output="false">
<cffunction name="testMethod" displayname="test" access="remote" output="false" returntype="string">
  <cfset CONTENT="This is the Result">
  <cfreturn CONTENT>
</cffunction>
</cfcomponent>

Open in new window


Both machines are Ubuntu 9.04 with CF 9.  The only thing I can find different between the servers is for some reason the JVM encoding on the dev server is UTF8 and the JVM encoding on the production server is ASCII.  I do not know why these are different and I cannot find a way to change them.

Also, when I inspect the code in Firebug, the argumentCollection submitted on the production server is always:

argumentCollection      "5F7D909A"

No matter what is passed it is always  the same as above.  On the dev server you can see the arguments pass as expected.  In the simple example above there are no arguments passed and the argumentCollection on the dev server is:

argumentCollection      {}

as expected ...

Thanks for any help in advance, this is really confusing me.
0
Comment
Question by:gr1z
  • 7
  • 3
10 Comments
 
LVL 36

Expert Comment

by:SidFishes
ID: 34166584
wild guess (and probably not helpful...) but is your directory structure exactly the same name (specifically the case of the files)

when we were running CF on a linux hosted machine years ago as I windows guy, I was always getting bit by its case sensitive nature

0
 

Author Comment

by:gr1z
ID: 34166781
yes the directory structure is exactly the same on both machines, the production server is an rsync of the development server.
0
 
LVL 36

Expert Comment

by:SidFishes
ID: 34167502
well, I warned you it wouldn't be much help. :)

fwiw, I tried your test code on my win server2008/cf8 set up and it works fine.

if the only truly different thing is the encoding then I'd focus on that as the culprit

Based on a quick search, i think it may be a jquery issue and not a cf issue

 http://stackoverflow.com/questions/553463/jquery-ajax-character-encoding-problem

if the string isn't passed correctly due to encoding you could be seeing issues. Unfortunately, I'm not a linux guy, but you'd generally change encoding in the locale settings. this might be of help http://www.linuxquestions.org/questions/ubuntu-63/change-default-character-encoding-323706/

you could also try starting the jvm with java -Dfile.encoding=UTF-8

http://stackoverflow.com/questions/81323/changing-the-default-encoding-for-stringbyte




0
 

Author Comment

by:gr1z
ID: 34167684
here is the actual error CF is giving:

WDDX packet parse error at line 1, column 1. Content is not allowed in prolog..

Just doesn't make any sense, has to be something in the server setup.  
0
 

Author Comment

by:gr1z
ID: 34167717
can you tell me what "Java File Encoding" your JVM is using?  

It is in the CF administrator under "Settings Summary" and "Java Details"
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 36

Expert Comment

by:SidFishes
ID: 34168449
Cp1252  

and that error is due to malformed xml - actually a character or characters before the xml declaration

ie:

a
<?xml version="1.0" encoding='UTF-8'?>

and that is almost certainly due to the encoding on the server
0
 

Author Comment

by:gr1z
ID: 34189038
i cant figure out how to change it .. any ideas?
0
 

Author Comment

by:gr1z
ID: 34189250
i think it is giving the "Content is not allowed in prolog" because the cfc return is the contents of the error message
0
 

Accepted Solution

by:
gr1z earned 0 total points
ID: 34197421
finally solved my problem.

the dev server had a hotfix patch applied to it, and this patch was not applied to the production server.  the rsync was copying the CFIDE folder from the dev server to the production server and this was causing the issues.  

applied the hotfix to the production server and everything is working now.
0
 

Author Closing Comment

by:gr1z
ID: 34224605
Found the solution myself
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Magento error 9 67
apache and php 3 91
Utility for identifying files that are different 5 71
HHTP and HTTPS redirect question 3 58
Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now