Solved

Coldfusion 9 AJAX Error on Production Server

Posted on 2010-11-18
10
1,162 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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Server specifications for web hosting 7 90
CSS HELP 6 84
Align a <div> to a table row 3 58
Why Xampp showing MySQL as Maria DB on Welcome Page ? 8 45
It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

920 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

16 Experts available now in Live!

Get 1:1 Help Now