unexplained Compilation error - java-ee-5

In a project, the developer used HttpServletResponse.setContentTYpe(), followed by HttpServletResponse.setCharacterEncoding(); There was a compilation error at the deployment setup due to response.setCharacterEncoding.
It was quite apparent that the HttpServletResponse class was missing, yet to double check I did lots of research and figured out that the most plausible reason could be that servlet-api.jar and jsp-api.jar are not getting included in the classpath during build process. I got it checked at developer end also, yet the error was still there. So I asked on of the guys who is a veteran in the process, and the cause that he put up was that the error was due to HttpServletResponse.setContentTYpe(), followed by HttpServletResponse.setCharacterEncoding(), and after replacing the two lines with HttpServletResponse.setContentType("application/json;UTF8") its working fine.
I again went through the javadocs to see if it's possible, but I didnt got any such logic. Can anyone tell me if its possible that these two methods can cause compilation error.
Or do I need to start learning Java from Complete Reference.

Related

Coverage.py not giving valid results

I was hoping someone could explain how coverage.py works since after reading the documentation on it I am still rather confused. I am attempting to figure out code coverage by a TestCase class and the results haven't been very logical, particularly since after commenting out large chunks of tests the percent missing remains the same. I am working in the community version of PyCharm and haven't been able to find any alternatives to coverage.py so if you could recomend another option that would be appreciated too.

Compojure Ring Server Generated By 'lein ring server' Acting Oddly

So I was coding and I got an exception. I fixed the exception and then went back to check that things were working. Instead of seeing my fixes I instead saw the website that was generated prior to the exception having been thrown. Like my previous code had been cached and now it was being used. I double checked this intuition by commenting everything out and trying to put in a string instead of the web page and this still resulted in no changes to my site. So I went ahead and tried restarting the server. This didn't fix things. So then I tried running lein clean. This didn't fix things either. What the hell is going on here and how do I fix it?
I'm pretty sure my code is irrelevant, because I'm getting the same problem no matter what code I use. For those that are wondering the initial exception was that the function clojure.string/replace was already being used at clojure.core/replace or in other words I had a naming conflict. I resolved this by (:require [clojure.string :as string]).
Hmm, so I ended up restarting my computer and the problem was solved. The actual reason I had this problem I'm not so sure of.

Inconsistent 'Cannot find CFML template for custom tag' error

I have a CF9 site set up locally on OSX Snow Leopard, and it's started to behave very strangely - probably about 1 out of every 5 times I load any page in the site, it will throw a 'Cannot find CFML template for custom tag' error. I just refresh the page and then everything works fine. It can happen on any page, but it never happens consistently with any one page. Furthermore, this doesn't happen at all on the live server when the code is checked in through SVN, so I figure it has to be some kind of configuration problem on my local instance. I can still do my work, but it's pretty annoying having to refresh pages ALL the time. Has anyone run into similar difficulties?
Try using <cfmodule template="pathTo/yourTag.cfm"> rather than <cf_yourtag>, so you can specify the exact location of the template (in case the server is getting confused as to where it resides).
FYI, this is based on a tip from Raymond Camden's blog post: http://www.raymondcamden.com/index.cfm/2006/8/17/ColdFusion-Custom-Tag-Tips
Chris, odd that I should run into your question now, as this just started happening to me last night. I have all of my CF errors being emailed to me, and I am seeing that similar problems are happening across multiple sites that all run the same software, some of which haven't been touched in a long time. That got me thinking, it's probably a corrupt compiled template in the CF cache. You can recompile the template by making a slight change to it, say add an extra line or a comment or something, then access the site again. Or, purge the whole cache and let CF rebuild everything, which is likely what I'll do since who knows what else might be affected.
Clearing the Cache in Coldfusion Production server

.asmx file requires rebuild before allowing full site build to succeed

I've been working with my web application for a long time, and recently two of the asmx files have started behaving rather oddly. As far as I know, nobody has touched them in ages, but suddenly when I go to build the website it fails because custom classes being called in the asmx file aren't recognized, when all the other pages that use them are fine.
The weird thing is, if I individually click on the asmx file and select "Rebuild Page" for both of them, everything works fine until the next time I try to build the website.
Does anyone know what I can do to fix this issue? It's become a rather large annoyance, though I'm still able to work around it. Anything is helpful, even if it's just steps to follow to troubleshoot.
An example of some of the errors I get is:
Type expected
Type "Class.Subclass" is undefined
I finally figured it out :) It seems like the problem had to do with a class both of the .asmx files were using. I opened up the class, right clicked and used the Visual Studio "Rename" feature to give it (and all usages of it) a different name and the error no longer occurs.

FastCGI, Lighttpd Interface Error/Operational Error

I am getting an Interface Error/ Operational Error while running my Django application with FastCGI.On checking the access log ( of lighttpd) i find these errors pop up which are usually related to closing some db connection or the other.
The browser displays one of the two things - Unhandled Exception or Connection Terminated unsuccessfully message. Upon refreshing the page once ( usually) the errors seem to go off.
How can I prevent this from happening ? The system really behaves in an erratic fashion.
There could be 2 reasons for this problem occuring.
1. Not all URLs mentioned in your urls.py are reversing properly.
2. This is the tough part - Somewhere in the project an import is failing. It may be importing a method which does not exist.
I faced the same problem and I discovered that there were many imports like the ones mentioned in the second point.
I faced the same problem, and wrote my own solution after finding nothing from the web. Please check my blogpost here: Simple Python Utility to check all Imports in your project
Ofcourse this will only help you to get to the solution of the original issue pretty quickly and not the actual solution for your problem by itself.