Solved

Coldfusion 9 AJAX Error on Production Server

Posted on 2010-11-18
10
1,175 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
Building an interactive eFuture classroom

Watch and learn how ATEN provided a total control system solution including seamless switching matrix switch, HDBaseT extenders, PDU, lighting control to build an interactive eFuture classroom.

 

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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
Today, I was working on some optimization and spam-stopping techniques when I encountered Ben Nadel's post to reduce spam feature using Math (http://www.bennadel.com/blog/197-How-I-Stop-Spammers-On-My-ColdFusion-Blog.htm). While this method is not o…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

730 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