?
Solved

Coldfusion 9 AJAX Error on Production Server

Posted on 2010-11-18
10
Medium Priority
?
1,190 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 does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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

Basic Security of Your VPC

So, you’ve got this shiny new VPC and a fancy new application configured on your EC2 servers ready to go. This application is only accessible from your computer, which is great for security, but you need your users to be able to access it! So, what’s the easiest way to do this?

Question has a verified solution.

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

PROBLEM: How to add your own buttons to the bottom toolbar with paging info ( result count ). While creating a cfgrid, I ran into an issue where I wanted to embed my own custom buttons where the default ones ( insert / delete / etc… ) are for aes…
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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

770 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