display标签的使用t required libraries are missing: com/lowagie/text/Element

本文记录了解决使用DisplayTag进行PDF导出时遇到的问题。由于缺少必要的itext库,项目在尝试导出PDF时出现了错误。通过添加itext-1.4.jar到项目的依赖库中成功解决了这个问题。

近期在我的项目中使用了display标签,原本以为特别容易,用起来就有错了:

在使用display标签的时候后台报错如下:

2011-03-22 19:03:47,224 org.displaytag.export.ExportViewFactory.<init>(ExportViewFactory.java:61) INFO [org.displaytag.export.ExportViewFactory] - <Initializing ExportViewFactory with type={csv,excel,xml,pdf,rtf}>

2011-03-22 19:03:47,268 org.displaytag.export.ExportViewFactory.registerExportView(ExportViewFactory.java:105) WARN [org.displaytag.export.ExportViewFactory] - <Unable to instantiate class for pdf export. org.displaytag.export.PdfView was found, but required libraries are missing: com/lowagie/text/Element>

2011-03-22 19:03:47,302 org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:704) ERROR [StandardWrapper[/tyut:jsp]] - <Servlet.service() for servlet jsp threw exception>

java.lang.NullPointerException

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Class.java:164)

at org.displaytag.util.ReflectHelper.classForName(ReflectHelper.java:43)

at org.displaytag.export.ExportViewFactory.registerExportView(ExportViewFactory.java:95)

at org.displaytag.export.JspServlet.service(JspServlet.java:241)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

经过查看官方文档,知道:

     If you would like to make use of the display taglib in your own application, do the following:

  1. Drop the displaytag-version.jar file in your application WEB-INF/lib directory
  2. Make sure that following libraries are in your WEB-INF/lib directory (or made available via the classpath to your application server). Refer to the dependencies document for the correct version of these libraries. You can download a copy of everything from jakarta or you can grab them from the example webapp in the bin distribution. The following is the list of dependencies:
    • commons-logging
    • commons-lang
    • commons-collections
    • commons-beanutils
    • log4j
    • itext (optional, for pdf/rtf export)

    You may want to include also the displaytag-export-poi jar, which adds an excel binary export using jakarta POI. The poi jar is required by displaytag-export-poi

  3. Optional. Depending on your architecture, you may need to configure a filter to make export work. See the export filter page for the details about how to do it and when you could need it. 缺少itext.jar就会报上面的错。所以我加了itext-1.4.jar,重新启动项目,ok
在 Android 开发中,当 module `libsdmcore` 缺少依赖 `vendor/xiaomi/proprietary/display/common/moduleUtils/displayfeatureintf` 时,可以尝试以下解决办法: ### 检查依赖文件是否存在 要确认 `vendor/xiaomi/proprietary/display/common/moduleUtils/displayfeatureintf` 文件或目录是否真实存在于项目中。若不存在,可能需要从官方渠道获取该依赖,或者从小米的源码仓库中拉取相应代码。 ### 检查 Android.bp 或 Android.mk 文件 - **Android.bp 文件**:若使用 Android.bp 文件来构建模块,需确保在 `libsdmcore` 的模块定义里正确添加了对 `displayfeatureintf` 的依赖。示例如下: ```python cc_library_shared { name: "libsdmcore", srcs: ["src/*.cpp"], shared_libs: ["displayfeatureintf"], } ``` - **Android.mk 文件**:若使用 Android.mk 文件,要保证在 `libsdmcore` 的模块定义中正确添加了对 `displayfeatureintf` 的依赖。示例如下: ```makefile LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := libsdmcore LOCAL_SRC_FILES := src/*.cpp LOCAL_SHARED_LIBRARIES := displayfeatureintf include $(BUILD_SHARED_LIBRARY) ``` ### 检查路径配置 要确保依赖的路径配置无误。有时候,路径拼写错误或者路径配置不正确会导致找不到依赖。 ### 同步代码和更新依赖 使用 `repo sync` 命令同步整个项目的代码,确保所有依赖都是最新的。同时,可以尝试运行 `go mod tidy`(若项目使用 Go 模块)或者 `composer install`(若项目使用 Composer 管理依赖)来更新依赖[^1][^2]。 ### 检查权限问题 若依赖文件存在,但由于权限问题无法访问,需要检查文件的权限设置。例如,若出现 `/vendor/lib64/libOpenCL.so` 无访问权限的情况,需要修改文件的权限设置[^3]。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值