无法在 Coldfusion 中初始化 org.apache.poi.xslf.usermodel.XMLSlideShow [英] Not able to initialize org.apache.poi.xslf.usermodel.XMLSlideShow in coldfusion

查看:22
本文介绍了无法在 Coldfusion 中初始化 org.apache.poi.xslf.usermodel.XMLSlideShow的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<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>

我无法在 Coldfusion 中初始化 org.apache.poi.xslf.usermodel.XMLSlideShow 对象.得到以下错误:无法为类 org.apache.poi.xslf.usermodel.XMLSlideShow 找到接受类型 (java.io.FileInputStream) 参数的构造函数

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 )

请帮忙

推荐答案

我知道您说您使用的是 POI 3.8,但错误消息显示您使用的是旧版本.

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

正如安东尼所说,ColdFusion 9 捆绑了一个旧版本 (POI 3.5),这是 createObject() 使用的.在 3.5 版中没有 XMLSlideShow(InputStream) 构造函数.因此出现错误消息.

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.

有两 (2) 种方法可以加载较新版本的 POI:

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

  1. 使用 JavaLoader 并行运行新版本

替换{cf_root}\lib 中现有的 POI jar.然后重新启动 CF 服务器.注意:我没有亲自做过,所以我不知道这样做是否会破坏其他功能

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

这篇关于无法在 Coldfusion 中初始化 org.apache.poi.xslf.usermodel.XMLSlideShow的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆