0
votes
<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
Which version of ColdFusion, and are you using a custom poi package or the bundled poi package?Antony
@prashantgupta - Which version of CF? As Antony mentioned, ColdFusion 9 ships with an old version of POI. That version does not not have the constructor XMLSlideShow(InputStream). You said you are using POI 3.8. Did you replace the existing POI jars? From your error message it sounds like you did not, which would explain your error.Leigh

1 Answers

2
votes

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