java.lang.NoClassDefFoundError: org/json/JSONObject when Java Class runs on OAM Server

java.lang.NoClassDefFoundError: org/json/JSONObject when Java Class runs on OAM Server

当我 运行 我的 .classOracle Access Manager

上时,我得到 java.lang.NoClassDefFoundError: org/json/JSONObject

这是堆栈跟踪:

java.lang.NoClassDefFoundError: org/json/JSONObject
at phillplugin.PhillPlugin.process(PhillPlugin.java:118)

PhillPlugin.java:118 contains just a creation of an instance of a JSONObject

//Line 118:
 JSONObject x = new JSONObject();

我正在使用 JDeveloper IDE 并且我在我的 Libraries 和我的 部署 配置文件

Note that when i'm executing it from a simple main.class it runs perfectly

我必须将 org.json.jar 包含在部署 PhillPlugin.jar 的 MANIFEST.MF 文件中,我已按如下方式完成:

Manifest-Version: 1.0
Bundle-Version: 10
Bundle-Name: PhillPlugin
Bundle-Activator: phillplugin.PhillPlugin
Bundle-ManifestVersion: 2
Import-Package: 
 org.osgi.framework;version="1.3.0",
 oracle.security.am.plugin,
 oracle.security.am.plugin.authn,
 oracle.security.am.plugin.impl,
 oracle.security.am.plugin.api,
 oracle.security.am.common.utilities.principal,
 oracle.security.idm,
 javax.security.auth,
 org.json.JSONObject;resolution:=optional,
 org.json.JSONArray;resolution:=optional,
 org.json;resolution:=optional
Export-Package: 
 org.json.JSONObject;resolution:=optional,
 org.json.JSONArray;resolution:=optional,
 org.json;resolution:=optional
Bundle-SymbolicName: PhillPlugin
Bundle-ClassPath: org.json.jar,utilities.jar,oam-plugin.jar,felix.jar,identity-provider.jar

但服务器仍然无法识别我的导入

让我提一下 PhillPlugin.jar 包含:

我很乐意为您提供您需要的任何其他额外信息

我必须在 MANIFEST.MF(reference) 中包含外部库,正如我正确所做的那样,在最后的 PhillPlugin.jar 和 [=13] 中也包含 org.json.jar =] 图书馆 这样服务器就可以看到我的导入

这是对我有用的示例:

Note that, the exception was being triggered even if the org folder was missing or the org.json.jar was missing