本文介绍了WebSphere如何选择文件夹中的类加载顺序(WEB-INF/lib)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前面临一个有趣的问题,由于类加载问题,我们的应用程序无法在3/4节点上启动.

I am currently facing an interesting problem where our application fails to start up on 3/4 nodes due to classloading issues.

问题似乎是WAS在a.jar之前加载b.jar.经过更多的故障排除后,我发现所有节点都以不同的顺序(通过控制台中的Classpath查看器)加载jar,而工作节点可能只是a幸.

The problem seems to be that WAS is loading b.jar before a.jar. After troubleshooting more, I found that all of the nodes load the jars in different orders (via Classpath viewer in console) and the working node may have just been a fluke.

WebSphere如何确定已安装的应用程序WEB-INF/lib文件夹中的类加载顺序?

How does WebSphere determine the classloading order within an installed applications WEB-INF/lib folder?

推荐答案

在Websphere中,未定义加载jar的顺序.为了解决您的问题,我建议您使用以下选项之一.

Order of loading jars is undefined in websphere. To solve your problem I can suggest you to use one of the below option.

使用清单类路径设置,方法是按照要加载它们的顺序提及jar名称.

Use manifest classpath settings by mentioning the jar names in a order like how you want them to be loaded.

OR

您可以从a.jar中提取类,并将其放在 WEB-INF/classes 目录中.然后从lib文件夹中删除a.jar.因为 classes 目录将在 lib 目录之前加载.

You can extract the classes from a.jar and put it in the WEB-INF/classes directory. Then remove a.jar from the lib folder. Because classes directory will be loaded before lib directory.

这篇关于WebSphere如何选择文件夹中的类加载顺序(WEB-INF/lib)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-27 19:58