使用aspose-slides生成ppt内容保存报错问题,我们经过分析排查,仍然没有找到原因,请帮忙协助分析下
1)aspose-slides包是否有日志跟踪或其他办法可以跟踪到抛出来的错误原因
2)我们的用法是否存在问题,是否存在需要其他jar包配合或受影响的情况
3)提供aspose-slides最新版本(不是混淆后的,可以跟踪到报错日志且可以分析报错原因)
版本:aspose-slides-21.1-jdk16.jar
示例代码:
Presentation presentation = null;
try {
presentation = new Presentation("D:" + File.separator + "demo.ppt");
presentation.save("D:" + File.separator + "demo2.ppt", SaveFormat.Ppt);
} catch (Throwable t) {
t.printStackTrace();
} finally {
if (presentation != null) presentation.dispose();
}
我们怀疑 是不是引用的其他jar影响到了 但现在拿不到错误日志 所以想要个不混淆的试用版
demo.zip (42.0 KB)
@SalesDhorde,
感谢您联系免费支持。
我使用了 Aspose.Slides for Java 21.1/24.9、示例 PowerPoint 演示文件以及您提供的代码示例,没有出现任何错误。
不幸的是,Aspose.Slides for Java 不提供日志跟踪或其他方法来追踪错误的原因。捕获异常是处理错误的唯一方法。
不,您对 Aspose.Slides for Java 的使用是正确的。无需其他 jar 包进行配合。
不幸的是,我们无法提供 Aspose.Slides for Java 的未混淆版本。
请提供以下附加信息,我们将尽力解决该问题。
- 错误的堆栈跟踪
- 发生错误的操作系统版本
- 您应用程序项目中的 JDK 版本
JAVA_VERSION: 1.8.0_311 win10 专业版
java.lang.NullPointerException: null
at com.aspose.slides.internal.mv.class.do(Unknown Source)
at com.aspose.slides.internal.mv.class.new(Unknown Source)
at com.aspose.slides.internal.mv.class.for(Unknown Source)
at com.aspose.slides.internal.mv.class.do(Unknown Source)
at com.aspose.slides.internal.m4.for.do(Unknown Source)
at com.aspose.slides.internal.fm.this.if(Unknown Source)
at com.aspose.slides.internal.fm.this.case(Unknown Source)
at com.aspose.slides.internal.fm.long.do(Unknown Source)
at com.aspose.slides.internal.fm.long.(Unknown Source)
at com.aspose.slides.internal.fm.long.(Unknown Source)
at com.aspose.slides.internal.fm.long.(Unknown Source)
at com.aspose.slides.internal.oq.public.do(Unknown Source)
at com.aspose.slides.o4.do(Unknown Source)
at com.aspose.slides.o4.do(Unknown Source)
at com.aspose.slides.o4.do(Unknown Source)
at com.aspose.slides.ano.do(Unknown Source)
at com.aspose.slides.oi.do(Unknown Source)
at com.aspose.slides.ln.do(Unknown Source)
at com.aspose.slides.o0.do(Unknown Source)
at com.aspose.slides.ape.int(Unknown Source)
at com.aspose.slides.ape.boolean(Unknown Source)
at com.aspose.slides.db.do(Unknown Source)
at com.aspose.slides.BaseSlide.do(Unknown Source)
at com.aspose.slides.Slide.do(Unknown Source)
at com.aspose.slides.Slide.do(Unknown Source)
at com.aspose.slides.Slide.do(Unknown Source)
at com.aspose.slides.af6.do(Unknown Source)
at com.aspose.slides.af6.do(Unknown Source)
at com.aspose.slides.Presentation.do(Unknown Source)
at com.aspose.slides.Presentation.do(Unknown Source)
at com.aspose.slides.Presentation.save(Unknown Source)
at com.inspur.gs.ba.docplugin.ppt.AsposePPT.saveDocument(AsposePPT.java:80)
@SalesDhorde,
不幸的是,我无法重现该错误。请再次仔细检查问题,并尝试隔离可能影响错误发生的环境条件。
for /f "delims=" %%a in ('wmic os get TotalVisibleMemorySize /value^|find "="') do set %%a
set /a MemorySize=%TotalVisibleMemorySize% /1024
set TotalMemorySize=%MemorySize%M
48ac8d293275bd2ef92f7bf4742cdb0.png (19.5 KB)
在启动程序 中如果增加了这一句 就无法生成
@SalesDhorde,
感谢您提供的额外细节。我在使用您提供的命令与 Aspose.Slides for Java 21.1 时重现了类似错误,但在使用 24.9 版本时该错误没有出现。请您检查一下是否可以使用 24.9 版本解决该问题?
经验证 24.9可以 但24.8不行 是否可以给出一个当时出现此问题的原因 防止后续再反复出现
@SalesDhorde,
使用 Aspose.Slides for Java 21.1 时,我遇到了以下错误(它与您的错误不同):
java.lang.NullPointerException
at com.aspose.slides.Chart.do(Unknown Source)
at com.aspose.slides.fs.(Unknown Source)
at com.aspose.slides.fb.(Unknown Source)
at com.aspose.slides.Chart.do(Unknown Source)
at com.aspose.slides.aj6.do(Unknown Source)
at com.aspose.slides.ae0.do(Unknown Source)
at com.aspose.slides.ae0.do(Unknown Source)
at com.aspose.slides.be.if(Unknown Source)
at com.aspose.slides.be.do(Unknown Source)
at com.aspose.slides.ak6.do(Unknown Source)
at com.aspose.slides.afg.const(Unknown Source)
at com.aspose.slides.afg.byte(Unknown Source)
at com.aspose.slides.afg.do(Unknown Source)
at com.aspose.slides.Presentation.do(Unknown Source)
at com.aspose.slides.Presentation.save(Unknown Source)
在 24.8 和 24.9 版本中,您提供的代码示例在我这边运行良好。我使用了以下 CMD 指令:
for /f "delims=" %%a in ('wmic os get TotalVisibleMemorySize /value^|find "="') do set %%a
set /a MemorySize=%TotalVisibleMemorySize% /1024
set TotalMemorySize=%MemorySize%M
java -jar TestApp.jar
pause
您能否检查是否有其他条件,以帮助我重现您遇到的确切错误?