Why can't I pack certain JARs outside WEB-INF


I have read in several blogs that it is not advised (or not possible)to pack jars outside the WEB-INF folder. I am curious as to know why this is so..

For instatnce,

mainStuff.war | |-->WEB-INF | | | |-->lib (having many jars, used by the contents of specificStuff.jar | |-->classes | |-->web.xml | |-->META-INF (having the .MF file and signed files .SF and .DSA) | | |-->index.jsp (consists of a jnlp xml, referring to the jars in lib) | | |-->specificStuff.jar (this is a separate jar module, which is mentioned in the POM of the war)

In the jnlp configuration in index.jsp, i am referring to the jars in lib like:

<resources> <java version="1.6+"/> <jar href="specificStuff.jar"/> <jar href="lib/someJarthatIneed.jar"/> </resources>

Now, when i launch my JNLP, I get the error that someJarthatIneed failed to load. However, when i manually moved the lib outside WEB-INF, this error did not occur.

So, what I need to know is that, is there any way to pack the lib folder and all jars outside WEB-INF?? OR Why is it that my jnlp (which is outside WEB-INF) not able to load the jar from WEB-INF/lib. (I tried changing the path of jar as

<jar href="WEB-INF/lib/someJarthatIneed.jar"/>

but it did not work either..)

Any help on this will be apprciated. :)


Thanks for all the suggestions... But, I found a way to do it..

I used the maven-dependency-plugin (copy-dependencies) to copy all the dependency jars to a folder lib to a specified location.

<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version>2.10</version> <executions> <execution> <id>copy-dependencies</id> <phase>prepare-package</phase> <goals> <goal>copy-dependencies</goal> </goals> <configuration> <outputDirectory>${basedir}/src/main/webapp/lib</outputDirectory> <includeScope>compile</includeScope> </configuration> </execution> </executions> </plugin>

Then use


in the pom, where you are using maven-war-plugin to make the war, to remove the lib folder from WEB-INF..

So, now the index.jsp is able to fetch all the jars from the lib.


What is in WEB-INF is not available from http requests, and what is not in WEB-INF will be considered as resources and thus will not be loaded by the container.

If the jars you put in the WEB-INF/lib is not required by your application, simply moves them outside the WEB-INF folder, and they will be treated as resources.

You can also think about building an "uberjar" for you JNLP jar, packing all dependencies into a single jar.


  • Consuming stack traces noticeably slower in Java 11 than Java 8
  • Gradle build for javafx application: Virtual Keyboard is not working due to missing System property
  • Something goes wrong with the SSH while setting up hadoop
  • How to read a DICOM file of Dynamic DSA image
  • Grails 3 - How to publish to Artifactory
  • Type mismatch: cannot convert from Connection to Connection
  • Conditional render in tagfile depending on whether the attribute is specified or not
  • Spring MVC redirect with custom http headers
  • Is it mandatory to have a doGet or doPost method?
  • What is the equivalent of Android permissions in iOS development? [duplicate]
  • jersey/tomcat Description The origin server did not find a current representation for the target res
  • “mvn clean generate-source” could not resolve dependencies
  • How can I replace the server in Web Component Tester
  • Is there some graphical way to create my own configuration file on SonarLint?
  • Fail:(TESTMODE) Transactions of this market type cannot be processed on this system
  • Bash if statement with multiple conditions
  • Spring Cloud Microservice Architecture Confusion
  • JBoss External Properties Files in Classpath
  • How do I exclude a dependency in provided scope when running in Maven test scope?
  • Is there a perl module to validate passwords stored in “{crypt}hashedpassword” “{ssha}hashedpassword
  • Custom Tabgroup Appcelerator
  • iOS: Detect app start via notification press
  • Meteor helpers not available in Angular template
  • Jetty Server not starting: Unable to establish loopback connection
  • The plugin 'org.apache.maven.plugins:maven-jboss-as-plugin' does not exist or no valid ver
  • Initializer list vs. initialization method
  • PHPUnit_Framework_TestCase class is not available. Fix… - Makegood , Eclipse
  • How can I send an e-mail from a vbs script
  • Fetching methods from BroadcastReceiver to update UI
  • Does CUDA 5 support STL or THRUST inside the device code?
  • Rearranging Cells in UITableView Bug & Saving Changes
  • Is there a mandatory requirement to switch app.yaml?
  • Proper folder structure for lots of source files
  • Proper way to use connect-multiparty with express.js?
  • using HTMLImports.whenReady not working in chrome
  • costura.fody for a dll that references another dll
  • Observable and ngFor in Angular 2
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?
  • java string with new operator and a literal