Problem with classpath with jar files

I have a problem with classpath with commons-httpclient.jar.

The application uses the newer version of commons-httpclient.jar, which is commons-httpclient-3.0.1.jar.

After installing JBOSS, it installs the original version called commons-httpclient.jar in two different directories.

/opt/appname/lib and /opt/appname/server/default/lib 

It would be easy to simply delete them, but it turns out that they are used by another application in the system. I would like to know if there is a way to assign the order to which classes are used, for example.

First use commons-httpclient-3.0.1.jar, then use commons-httpclient.jar

Pretty new to Java, so any help would be appreciated.

+4
source share
1 answer

I believe that the only way to do this under the limitations that you mentioned is to move the right JAR to the server / default / lib folders of each application on your JBoss and remove it from / opt / appname / lib.

However, this can be problematic, as JBoss itself may also need a JAR. In this case, you may be out of luck.

As an extra note, you can create the / jboss / lib / endorsed folder. Libs placed there take precedence over them: jboss / lib.

+1
source

Source: https://habr.com/ru/post/1392568/


All Articles