Pages

Thursday, August 14, 2014

error c00c0240 - "Could not complete the operation due to error c00c0240." - AJAX request in Struts

I happened to encounter this error when I was attempting to debug an Ajax call to a Struts action. It made me feel miserable for a while as both firebug as well as eclipse debuggers with console showed no trace of the origins of the error. As usual I searched out for the error number and ended up with a lot of stack overflow posts. One of these posts were typically explaining me the same issue that I was facing and had a link to a blog post which contained a solution to the same. And to my relief, my companies network restrictions prevented that page from being loaded. Wait WTF!!! Yes... that’s how grateful I felt roflJ.

 

Enough of my story, the issue in my case was that the AJAX request that I framed and tested was

 

var x= new XMLHttpRequest();x.open("GET","http://localhost:7001/****/*************Action.do",false);x.send(null);x.responseText

 

This was giving me some un relevant message like the following and my debugging points never worked and neither the eclipse console had any logs printed in them through the log4j framework.

 

"
<html>
<head>
  <script type="text/javascript" src="/****/js/*****.js"></script>
   <script type="text/JavaScript">
           window.document.onkeydown=checkKeyCode;
   </script>
</head>
<body>
<table  width="100%" valign="top" height="100%">
<tr>
<td align="center"><font color="red"><h4>
There was a problem, please try again!</h4></font>
</td>
</tr>
<tr>
<td align="center">&nbsp;</td>
</tr>
</table>
</body>
</html>"

 

And I found the “THE ISSAC NEWTON” in me like most of the times, as something stuck me and I tried “POST” instead of “GET”

 

And now, I see some positive results. My debugging points in the eclipse is working.. Hurray!!!!!

 

var x= new XMLHttpRequest();x.open("POST","http://localhost:7001/****/*************Action.do",false);x.send(null);x.responseText

 

Hurray!!!!! Again. But wait, WTF its just that my debugging points in eclipse are working. So wait my work is not done yet

 

L J