Railo - Error in Using CFSpreadsheet extension

Railo error in Using CFSpreadsheet

We have a coldfusion application running on Railo, we added the cfspreadsheet extension and when reading spreadsheets started generating an error. Like the following.

java.lang.NoClassDefFoundError, Could not initialize class org.apache.poi.openxml4j.opc.internal.unmarshallers.PackagePropertiesUnmarshaller.


The issue in manipulating the spreadsheet is caused by the loaded dom4j module with the Spreadsheet.cfc file. You can find it in the following path. Suppose, your website is "railo.sudosu.in" and it's document root is /home/railosudo/public_html/. You can find the Spreadsheet.cfc file in the following path.

# vim /home/railosudo/public_html/WEB-INF/railo/components/org/cfpoi/spreadsheet/Spreadsheet.cfc

Open the file in your favorite editor and around line number 20 you can find a line like the following in it. What you need to do is just comment the line.

arrayAppend(Local.paths, expandPath('{railo-web-directory}'&'/lib/dom4j-1.6.1.jar'));

When you comment this line, the 'dom4j' module will not load anymore for that website with cfspreadsheet. Once you have made the changes, you need to restart railo to make the changes in effect.

# /etc/init.d/railo_ctl restart

Try to use cfspreadsheet function in your code now...