MADC0D3R
MADC0D3R

Reputation: 331

classpath issue with jar files

I'm having a classpath issue with commons-httpclient.jar.

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

Once JBOSS is installed it installs the original version named commons-httpclient.jar in two different directories.

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

It would be easy to simply remove them, but it turns out that they are being used by another application on the system. I would like to know if there is any way to designate an order to which classes are used, for example.

Use commons-httpclient-3.0.1.jar first then use commons-httpclient.jar

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

Upvotes: 4

Views: 238

Answers (1)

stmoebius
stmoebius

Reputation: 692

I believe the only way to do this under the constraints you mention is to move the right JAR into the server/default/lib folders of each of the apps on your JBoss, and remove it from /opt/appname/lib.

That said, this may still be problematic, as JBoss itself may also need the JAR. In that case, you may be out of luck.

As a side note, you can create a folder /jboss/lib/endorsed. Libs placed there take precedence over those is jboss/lib.

Upvotes: 1

Related Questions