Category: ColdFusion Tips

Trouble with CFX Tag Config in ColdFusion 8

We're conducting an upgrade at work, from ColdFusion 6.1 (shudder) to ColdFusion 8.  We haven't yet been authorized to upgrade to CF 9 and we have the licenses for CF 8, so we're going for it.

Straight away, I got an error when attempting to run our CFX tags:

com/allaire/cfx/CustomTag null

Not much help there, right?  Googling the issue didn't return too many results either.  So, I sat with Micky on it for a while and he pointed out that he had experienced a problem with CFX tags in ColdFusion 8 related to the location of cfx.jar.  We added the following to the Java Classpath in the jvm.config:

C:/ColdFusion8/wwwroot/WEB-INF/lib

Interestingly, we found that when we used the {application.home} variable at first like so:

{application.home}/wwwroot/WEB-INF/lib

Which was being translated as C:\ColdFusion8\runtime\wwwroot\WEB-INF\lib, an invalid path.  Using the path bolded above return successful results and we're happily running our CFX tags again on ColdFusion 8.

Converting Word Files to Text in ColdFusion

Download the TextMining.org Text Extractor and put the jar file in your CF classpath. This extractor is based on Jakarta POI. If you need more functionality than just reading the file, go get the full blown POI from Apache (http://jakarta.apache.org/poi/)

Here's the link to TextMining.org
http://www.textmining.org/modules.php?op=modload&name=Downloads&file=index

Once you get it setup, it’s simple to use:

<cfscript>
fileName = ExpandPath('ee.doc'); // this should be the full path to your file
try {
   input = CreateObject('java','java.io.FileInputStream').init(fileName);
   docText = CreateObject('java','org.textmining.text.extraction.WordExtractor').extractText(input);
} catch(Any e) {
   WriteOutput(’ERROR: ‘ & e.detail);
}
</cfscript>

<cfoutput>
contents of "#fileName#"<br />
<textarea cols="50" rows="12">#docText#</textarea>
</cfoutput>