Solved

Coldfusion 9 AJAX Error on Production Server

Posted on 2010-11-18
10
1,185 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

 

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
 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

717 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