cfdocument tag suddenly throwing "This function should be called while holding treeLock." error - coldfusion

I have an application that contains a form which, until recently, I was able to save as a PDF using cfdocument. A few weeks ago we swapped out a server. The old server was running CF 9.0.1. The new server is CF 10. Since then, I've been getting this error when I try to save this particular form as a PDF.
--
An exception occurred when performing document processing. The cause
of this exception was that:
coldfusion.document.spi.DocumentExportException:
java.lang.IllegalStateException: This function should be called while
holding treeLock.
--
I have another page in the application that saves PDFs just fine. It's just this page that's throwing the error. I can't find anything about TreeLock anywhere on the web (at least, nothing that pertains to ColdFusion).
Has anyone else run into this, and if so, how did you fix it? Thanks!

I started getting the error upon promoting a new version. Rendered the content in HTML. Found I had forgotten to promote an image (got the dreaded X for image). Promoted the image, cfdocument pdf works again. (I'm using localUrl="yes")
In other words, you can debug CF errors that halt the process but cfdocument pdf blithely assumes HTML content you supply is correct and complete.

I had the same problem and by process of elimination found that cfdocument doesn't like textarea elements within the form. It is fine with input type=text, but whenever I tried to add textarea elements it fell over with this error. Hope this helps someone

Related

WebKitGtk doesn't load local files

I've tried loading a local html file using webkit_web_view_load_uri() with a file:// URL. However, the webview would display a blank page. To circumvent this, I tried using webkit_web_view_load_html() and it worked correctly.
Now that I'm trying to load some images in the html using the <img> tag, the images aren't loaded (It displays a blank page).
I'm puzzled because I tried before (~ 2 months ago) a similar method and it worked.
Note: I copied the contents of the generated HTML into a file and loaded it with Firefox and it worked as it should (The images are visible), but with another WebKitGtk application I had lying around the images didn't load.
Note: I'm using C++ as the main programming language (I'd prefer having C++ types in the solutions only if possible)
Note: I have set webkit_settings_set_allow_file_access_from_file_urls() and webkit_settings_set_allow_universal_access_from_file_urls() to TRUE
Ok, I've managed to solve this. The solution had NOTHING to do with webkitgtk, which is strange. It seems that the application was trying to download the page instead of loading it. This traces to a faulty MIME type database.
Tl;Dr:
Execute this:
rm ~/.local/share/mime/packages/user-extension-html.xml
update-mime-database ~/.local/share/mime
and use webkit_web_view_load_uri() instead of webkit_web_view_load_html() with a file:// URI
I had the same problem in C. You have to explicitly set file:// as base_uri when you call webkit_web_view_load_html().
See also answer here

Coldfusion per application mapping randomly fails

In my application.cfc file I have the following code:
this.mappings["/includes"] = "#expandPath('../../priv/inc/')#";
and then on a page I have the following CF include set up:
<cfinclude template="/includes/imageOptimise-thumbnail.cfm">
For the majority of the time when the page is submitted the imageOptimise-thumbnail page runs without any issue but occasionally it will error saying that it can't find the imageOptimise-thumbnail.cfm. If I resubmit the page, chances are it will work but the question is, why is it sometimes not being able to find the page?
I had a look in the CF Admin and I can't see anything in the logs saying that there was an error but it is clearly showing a Coldfusion 'template not found' error message when it fails.
Anyone got any ideas?
I think your issues stem from the fact that the path used for the mapping is relative.
According to advice in ColdFusion Mappings and Relative Paths,
the moral of the story is to NEVER use expandPath() to create a
mapping that’s relative to the webroot.
Try to make the webroot static as the blog suggests
<cfset this.mappings["/myapplication"] =getDirectoryFromPath(getCurrentTemplatePath())
and navigate to /priv/inc/ from the webroot

POST http://exaple.com/index.php?route=checkout/cart/add 500 (Internal Server Error)

I am new to opencart. Some how I managed to create a website after reading online tutorial.
The website was worked well, but since two day the add to cart button is not working. Its showing some error on console. I tried different browser but same result.
Here I attached the screenshot.
The website is posakaworld.com
Any tips or hint is appreciated :)
I also having the similar issue, please check your
system/log/error.txt
For my case, I installed a new extension, and it shows and error
2017-06-25 9:49:03 - PHP Notice: Undefined variable: checkCart in /Users/Shiro/Sites/opencart/vqmod/vqcache/vq2-catalog_controller_checkout_cart.php on line 724
When I check ajax response, it does not show the error, it is due to production display error off, so finally, I manage to find out it is just a PHP Notice can break the system.
Once I fix the undefined variable notice, my ajax no more error. Everything back to normal. I hope this solution is helped.

content empty when using scrapy

Thanks for everyone in advance.
I encountered a problem when using Scrapy on Python 2.7.
The webpage I tried to crawl is a discussion board for Chinese stock market.
When I tried to get the first number "42177" just under the banner of this page (the number you see on that webpage may not be the number you see in the picture shown here, because it represents the number of times this article has been read and is updated realtime...), I always get an empty content. I am aware that this might be the dynamic content issue, but yet don't have a clue how to crawl it properly.
The code I used is:
item["read"] = info.xpath("div[#id='zwmbti']/div[#id='zwmbtilr']/span[#class='tc1']/text()").extract()
I think the xpath is set correctly and I have checked the return value of this response and it indeed told me that there is nothing under this directory. Results shown here:'read': [u'<div id="zwmbtilr"></div>']
If it has something, there should be something between <div id="zwmbtilr"> and </div>.
Really appreciated if you guys share any thoughts on this!
I just opened your link in Firefox with NoScript enabled. There nothing inside the <div #id='zwmbtilr'></div>. If I enable the javascripts, I can see the content you want. So, as you already new, it is a dynamic content issue.
Your first option is try to identify the request generated by javascript. If you can do that, you can send the same request from scrapy. If you can't do it, the next option is usually to use some package with javascript/browser emulation or someting like that. Something like ScrapyJS or Scrapy + Selenium.

Select all frames at once in Selenium

This could be a stupid questions for some. But its truly important for me.
I know how to switch frames using selenium webdriver.
However, is there a way to download all the page_source of the entire page for all the frames at once.
Instead of switching them again and again?
Could someone please let me know the command if it exists?
If not then please say there is none. And that should answer my question.
Thanks in advance
Webdrivers' getPageSource will return some state in some formatting of the last page the driver was on.
From the (java)docs, but most probably applies to other languages:
getPageSource
java.lang.String getPageSource()
Get the source of the last loaded page. If the page has been modified
after loading (for example, by Javascript) there is no guarantee that
the returned text is that of the modified page. Please consult the
documentation of the particular driver being used to determine whether
the returned text reflects the current state of the page or the text
last sent by the web server. The page source returned is a
representation of the underlying DOM: do not expect it to be formatted
or escaped in the same way as the response sent from the web server.
Think of it as an artist's impression.
Returns:
The source of the current page
http://selenium.googlecode.com/git/docs/api/java/org/openqa/selenium/WebDriver.html#getPageSource%28%29