如何将 JAR 文件添加到 IBM WebSphere 服务器中的项目类路径?

Yak*_*oob 4 java websphere classpath

我可以访问部署在 WebSphere 中的项目。我只创建.class文件并将它们放在WEB-INF下。

现在,我的一个 Java 类需要一个 JAR。我无权添加 JAR 并重新部署。只需要将同机C盘的JAR添加到项目的类路径中即可;这样它就可以在加载时加载 JAR。

我怎样才能做到这一点?

cov*_*ner 5

在传统的 websphere 中,又名“完整配置文件”:

如果您不想在构建过程中将其放置在 WEB-INF/lib 中,可以在管理控制台中将其配置为“共享库”,然后将其与一个或多个应用程序关联。

https://www.ibm.com/support/knowledgecenter/en/SSAW57_8.5.5/com.ibm.websphere.nd.doc/ae/tcws_sharedlib.html

由于这是一个 GUI,所以我不会费心去讨论细节。在管理控制台的顶层,有一个“环境”>“共享库”页面,基本上用于此专用目的。

如果您使用的是 WebSphere Liberty,则可以直接通过 server.xml 进行等效配置:

https://www.ibm.com/support/knowledgecenter/en/SSEQTP_liberty/com.ibm.websphere.wlp.doc/ae/cwlp_sharedlibrary.html

<library id="someLibrary">
   <!-- All the jar files in ther servers lib folder -->
   <fileset dir="${server.config.dir}/lib" includes="*.jar" scanInterval="5s" />
</library>

<application location ="webStore.war">
   <classloader commonLibraryRef="someLibrary" />
</application>
Run Code Online (Sandbox Code Playgroud)