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.
Related
I am experiencing an API issue where a partner is trying to do a POST request to my server but it looks like it is loading the previous code from my server.
The previous code contained an error:
#'clj-time.coerce/ICoerce found for class: java.time.LocalDateTime
But it has been fixed and released through REPL.
Here is the previous code:
(defn- parse-data [{:keys [name start-date bestbefore-date]}]
{:product name
:start-date (timec/to-string start-date)
:bestbefore-date (timec/to-string bestbefore-date)})
Here is the fix from the previous code:
(defn- parse-data [{:keys [name start-date bestbefore-date]}]
{:product name
:start-date (.toString (.format start-date formatter))
:bestbefore-date (.toString (.format bestbefore-date formatter))})
The code was working perfectly but it stopped after a few months as it seems to be loading the previous code containing the error mentioned above.
On my end, I tried to run the affected method from the request through REPL, and it is working just fine.
The server is built in Clojure language.
I have no other error logs aside from the partner error response as it is working fine on my server.
The server has not been restarted, so the fix should have been still there. Thus, I have again do an REPL with the code fix but it looks like it is not taking any effect.
As I am pretty new to Clojure, and I am thinking that it might be a cache issue. REPL concept is still pretty vague to me and perhaps I am doing something wrong.
I would like to know if some of you already experienced this kind of issue? And what would be the solution to it? Or perhaps any advice?
I wish to thank you in advance for your responses.
Kind a weird issue but I have been able to resolve this.
I was unsure what was going, so I just re-built the code and restarted the server.
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
I sometimes get
Could not find the ColdFusion Component or Interface Answer.
and simply doing a refresh fixes the problem.
This is not case where the program is being refreshed from ftp while I try to browse from it: no development is being done. But every once in a while I'll get it while trying to do a createobject.
Q: Is there a best practice for sleeping and trying again if instantiating a component fails?
Are you using a cluster of servers? If so perhaps you have one server misconfigured - perhaps a missing mapping - and when you get served from that server you see the issue? That might explain the way it seems to only sometimes happen.
By the way, instansiation of CFCs should always work - you should not be trying to code around this issue by sleeping and trying again.
Phillip, any chance this is on cf 9.0.1, and you're using the "import" keyword?
The reason I ask is that I've seen behavior -- and logged a bug report on it -- where if I have two different object creations on the same page (or in another CFC... doesn't matter), both from the same package, and I'm not using the fully qualified CFC name but instead am using import, then the first createObject() will succeed and the second will fail with the "could not find ... " error.
I wonder if something like that could be at work here.
I occasionally get this problem, and generally work around it, but it's rather frustrating.
I have all of Incanter (check it out if you don't know it: it's superb) on my classpath. I try to import it (through a Slime REPL) like this: user> (use 'incanter.core), but fail.
Doing this: user> (use 'clojure.contrib.def) works just fine, and this file is in the same place–on my classpath.
Regardless, the error isn't anything about classpath: it's this:
Don't know how to create ISeq from: clojure.lang.Symbol
[Thrown class java.lang.IllegalArgumentException]
You can see my entire terminal here (a screenshot.)
I don't know what's going on here, and it's really frustrating, as I really would like to use Incancter, and I can from the Incanter binary's REPL. I definitely don't want to develop from that–and this should work.
Any help would be much appreciated.
EDIT:
It appears as though Incanter requires Clojure 1.2, and lein swank gives me Clojure 1.1. This might be the cause of my problems: if so, is there a way to continue to use Swank & Lein with Clojure 1.2?
Thanks again!
EDIT:
Apparently if you start using Clojure-1.1 and lein swank, you're stuck with it unless you make a new project.
If future people have this problem, this article helped me out, but also, at least for me, you must start a new lein project if you had begun it using leink swank and Clojure-1.1. Simply changing your project.clj file and then lein swanking again doesn't work.
Yes, you can use Leiningen and swank-clojure with Clojure 1.2. You might need to use a recent version of Leiningen (I'm not sure if a certain old limitation affected lein repl only or was it lein swank as well; anyway, try the 1.2-RC2 which you'll find in the downloads section on GitHub). You will also need to use a recent-enough swank-clojure; I use a bleeding edge checkout myself, get yours here.
Other than that, simply use 1.2 jars for Clojure and contrib. (Lein uses it's own Clojure, separate from the one used for lein swank, for its internal workings and you never need to care about it; swank-clojure has no AOT'd namespaces and doesn't particularly care about the Clojure version, except once in a (long!) while something breaks, a patch is applied and joy is restored.)
I hope the above helps, but if it doesn't: your problem description is not entirely sufficient for me to get a clear picture of what is happening. Could you add information on what it means for "all of Incanter" to be on your classpath (do you mean the jars? sources? where do you get them? how do you set your classpath?). Without knowing this, it'll be hard to replicate your setup to try to track down the source of the problem.
Of course if bumping some versions fixes things, please disregard my current confusion. ;-)
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.