java - Bluemix Java Liberty Web 项目 java.lang.NoClassDefFoundError : when loading third party jar

标签 java classnotfoundexception ibm-cloud websphere-liberty

我正在使用 IBM Bluemix 的 Java For Liberty 来部署 Web 应用程序。

我试图获取系统环境并将其转换为 JSONObject

enter image description here

我很确定我已经将 jar 文件添加到类路径中

enter image description here

但是,在我运行应用程序(尝试推送到 bluemix 云并在 liberty profile 应用服务器本地运行)后,它抛出 java.lang.NoClassDefFoundError

enter image description here

请指出我应该如何配置.....

最佳答案

dep-jar 文件夹中的 jar 不会与最终应用程序二进制文件 (war) 打包在一起。它只能在编译期间使用。如果你想让 jar 包含在 war 中(在运行时使用),你需要将它包含在 WebContent/WEB-INF/lib 文件夹中。

如果您创建并下载 Java DB Web Starter 样板文件,您将看到正确的结构设置 - WebContent/WEB-INF/lib/nosqljson.jar

关于java - Bluemix Java Liberty Web 项目 java.lang.NoClassDefFoundError : when loading third party jar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31581197/

相关文章:

java - 无法解释来自 GCM 的消息

java - 如何反向移植 6.1.1 jsf portlet 以使其在 6.1.0 liferay 门户上运行?

node.js - Bluemix - 对象存储 - node.js - pkgcloud - openstack 返回 401

swift - HTTP GET 请求时出现 Cloudant 函数子句错误

ibm-cloud - 如何使用 Watson QA REST API

java - Spring 表达式语言 - 在注释中获取系统属性

java - 从文本文件读取外来词时不显示 Unicode

java.lang.ClassNotFoundException : org. postgresql.Driver, 安卓

java - 如何在 Flowable 中执行高效的卸载过程

java - 有没有办法用java来执行一系列的命令行