Not able to initialize org.apache.poi.xslf.usermodel.XMLSlideShow in coldfusion

大憨熊 提交于 2019-12-12 04:08:01

问题


<cfscript>
filepath = ExpandPath("./1.ppt");
fis = CreateObject( "java", "java.io.FileInputStream" ).init(filepath);
//initialize slideshow object with input stream
src = createObject("java","org.apache.poi.xslf.usermodel.XMLSlideShow").init(fis);
fis.close();
</cfscript>

I am not able to initialize org.apache.poi.xslf.usermodel.XMLSlideShow object in coldfusion. Getting following error: Unable to find a constructor for class org.apache.poi.xslf.usermodel.XMLSlideShow that accepts parameters of type ( java.io.FileInputStream )

Please help


回答1:


I know you said you are using POI 3.8, but the error message says you are using an older version.

As Antony mentioned, ColdFusion 9 is bundled with an older version (POI 3.5) which is what createObject() uses. There was no XMLSlideShow(InputStream) constructor back in version 3.5. Hence the error message.

There are two (2) ways to load a newer version of POI:

  1. Use the JavaLoader to run the newer version in parallel

  2. Replace the existing POI jars in {cf_root}\lib. Then restart the CF server. Note: I have not done this personally, so I do not know if doing so will break other features



来源:https://stackoverflow.com/questions/10612042/not-able-to-initialize-org-apache-poi-xslf-usermodel-xmlslideshow-in-coldfusion

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!