I encountered a weird problem – when I put my application JAR within the WEB-INF/lib directory, it doesn’t work. But when create a WEB-INF/classes directory and unzip my JAR there it works just fine .
Any help?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The behavior you’re describing is wanted and completely natural.
/WEB-INF/classeshas to contain the classes of your Java EE application. If you had used an IDE to pack a WAR (Web application ARchive) file, you would have noticed your application getting placed exactly there. A WAR file is the usual way for deploying.As the name says
/WEB-INF/libis the default search path for libraries. Libraries are usually distributed as JAR file and therefore these are placed in thelibdirectory.In conclusion, it’s now obvious why it won’t work if you place your application JAR in the
libdirectory because of two mistakes – your files shouldn’t be packed in any archive and thelibdirectory is for (packed) libraries.