3 Replies Latest reply on Mar 1, 2012 10:39 AM by Satish S

# How to use shared libraries in jboss 5.0

I have an EAR deployed in default profile.

I need to use some external JAR files as part of my CLASSPATH and they should not be deployed as part of defalut/lib directory.

Is there some way to refer external shared libraries into a nenterprise application?

I found some results from googling that it should be mentioned in jboss-app.xml. But still not clear where by JARS should be placed. Supposed if I mentioned shared/lib as my directory in jboss-app.xml then where this directory should be placed on hardrive?

• ###### 1. Re: How to use shared libraries in jboss 5.0

You might pack it into the EAR file and reference it within the application.xml (see dtd for details).

Also I recommend that you should use a JBoss5.1 instead of 5.0

• ###### 2. Re: How to use shared libraries in jboss 5.0

My requirement here is that I dont want to package the external JARs into the EAR. The JARs should be put into an external directory and using some option I should be able to use the same in CLASSPATH.

Say I will put the external JARS in D:\temp\shared\lib and my JBoss server is installed at D:\appservers/Jboss-5.0/jboss-eap-5.0. My EAR is deplyed under D:\appservers\Jboss-5.0\jboss-eap-5.0\jboss-as\server\default\deploy. Now I want use the JARs which are presetn under D:\temp\shared\lib in CLASSPATH of my EAR.

How can the same be achieved?

• ###### 3. Re: How to use shared libraries in jboss 5.0

You can use a custom EAR Deployer that extends org.jboss.deployment.EarClassLoaderDeployer.

The VFSDeploymentUnit can then be used to add the external directory to the VFSDeploymentUnit's classpath.