I have a ColdFusion application that reads a list of files from a directory and then converts each MSOffice document to a list in PDF using the JODConverter library and OpenOffice.org 3.4.1.
I wrote this application and installed my development PC in accordance with the instructions in two articles here:
http://cfsearching.blogspot.com/search/label/JODConverter
The only difference is that I installed the necessary JARs outside of cf_root .
<cffunction name="convertNonPDFFiles" returntype="Void" output="false"> <cfscript> // CONSTANTs var _NON_PDF_PATH = APPLICATION.PDFSource & "\NonPDFs"; var _PDF_PATH = APPLICATION.PDFSource & "\PDFs"; var _VALID_FILE_EXTENSIONS = "doc,docx,ppt,pptx"; // Set defaults for private variables var _qNonPDFDir = QueryNew(""); var _fileName = ""; var _documentId = 0; var _sourceFilePath = ""; var _destinationFilePath = ""; var _fileExtension = ""; var _isConversionSuccessful = true; var _tempSourceFilePath = ""; var _tempImageFilePath = ""; // Initialize Open Office Conversion Manager var _openOfficeManager = CreateObject( "java", "org.artofsolving.jodconverter.office.DefaultOfficeManagerConfiguration" ).setOfficeHome( APPLICATION.OpenOfficeProgramPath // Location of the OpenOffice.org 3.4.1 application directory on the server ).setTaskExecutionTimeout(60000).buildOfficeManager(); _openOfficeManager.start(); </cfscript> <!--- Retrieve a list of file names in the directory of unprocessed non-PDF files ---> <cfdirectory action="list" directory="#_NON_PDF_PATH#" name="_qNonPDFDir" type="file" listinfo="name" sort="datelastmodified DESC" /> <cfoutput query="_qNonPDFDir"> <cfscript> _fileName = _qNonPDFDir.name; _fileExtension = REQUEST.UDFLib.File.getFileExtension(_fileName); _sourceFilePath = _NON_PDF_PATH & "\" & _fileName; // File is a valid format for conversion if (ListFindNoCase(_VALID_FILE_EXTENSIONS, _fileExtension)) { _documentId = REQUEST.UDFLib.File.getFileNameWithoutExtension( _fileName ); _destinationFilePath = _PDF_PATH & "\" & REQUEST.UDFLib.File.getFileNameWithoutExtension( _fileName ) & ".pdf"; _isConversionSuccessful = true; _tempSourceFilePath = APPLICATION.TempDir & "\" & _documentId & "." & _fileExtension; /* Create of the copy of the original file in the temp directory */ FileCopy( APPLICATION.of_aprimo_root & "\" & _documentId & ".dat", _tempSourceFilePath ); // Attempt to convert the file to PDF try { // See convertFile() method below convertFile( openOfficeManager = _openOfficeManager, inputFilePath = _tempSourceFilePath, outputFilePath = _destinationFilePath ); } catch (any e) { _isConversionSuccessful = false; } if (_isConversionSuccessful) FileMove( _sourceFilePath, _NON_PDF_PATH & "\Processed\" ); else FileMove( _sourceFilePath, _NON_PDF_PATH & "\NonFunctioning\" ); } // File is not a valid format for conversion else { FileDelete(_sourceFilePath); } </cfscript> </cfoutput> <cfscript> _openOfficeManager.stop(); return; </cfscript> </cffunction> <cfscript> function convertFile(openOfficeManager, inputFilePath, outputFilePath) { CreateObject( "java", "org.artofsolving.jodconverter.OfficeDocumentConverter" ).init(ARGUMENTS.OpenOfficeManager).convert( CreateObject( "java", "java.io.File" ).init(ARGUMENTS.inputFilePath), CreateObject( "java", "java.io.File" ).init(ARGUMENTS.outputFilePath) ); return; } </cfscript>
This application works fine on my development machine, but as soon as I moved it to one of my web servers, it does not work there.
Install Dev PC:
OS: Windows 7 Professional SP1 IIS: 7 ColdFusion: 8.0.1
Server Tuning:
OS: Windows 2003 R2 Standard Edition SP2 IIS: 6.0 ColdFusion: 8.0.1
When I try to run the application on the server - either directly in the browser, or through scheduled tasks, it does not exclude any exceptions. It seems that he is running until he expires after 60 minutes. In the task manager, I see that soffice.bin starts when the application starts, but after a few seconds soffice.bin just disappears from the task manager.
Any ideas what could be the problem?