我正在尝试为 Eclipse BIRT 报告编写扩展(插件)。它涉及根据数据库条目从文件中提取图像并显示它们。

我正在使用 Sun 的 JAI-ImageIO 来访问 TIFF 文件数据并转换为 PNG 以在报告中显示。我的代码符合要求,但抛出 NoClassDefFound 运行时异常:

SEVERE: Error happened while running the report.
java.lang.NoClassDefFoundError: javax/media/jai/PlanarImage
  at org.eclipse.birt.sample.reportitem.rotatedlabel.util.GraphicsUtil.createDocImage
(GraphicsUtil.java:66)
  at org.eclipse.birt.sample.reportitem.rotatedlabel.RotatedLabelPresentationImpl.onRowSets
(RotatedLabelPresentationImpl.java:136)
  at org.eclipse.birt.report.engine.extension.ReportItemPresentationBase.onRowSets
(ReportItemPresentationBase.java:218)
  at org.eclipse.birt.report.engine.presentation.LocalizedContentVisitor.
processExtendedContent(LocalizedContentVisitor.java:966)
...

我正在使用 PlanarImage.getAsBufferedImage() 方法,因此它应该转换为更标准的图像对象。我已将 JAI jar 文件放入 JRE 中,并在 Eclipse 插件环境之外测试了相同的基本代码 —— 效果很好。这似乎是 CLASSPATH 问题,但我已经验证系统上的所有 JRE 在适当的位置都包含必要的 jar 和 DLL 文件。

对于新的 JDBC 驱动程序,您必须将 jar 放在插件的特殊子目录中——是否有一个特殊的位置可以放置其他第三方 jar,以便 BIRT 可以使用它们?

有帮助吗?

解决方案

这已经解决了 用于打开 TIFF 类型 4 图像的 Eclipse 扩展. 。基本上,您只需创建一个子目录并将所有 JAR 和 DLL 放入其中,将 jar 添加到类路径并将 DLL 添加到“所需本机库”下的“插件依赖项”中。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top