wood burning stoves 2.0*
The moose likes Servlets and the fly likes Standard folder location for META-INF in a JEE war application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Standard folder location for META-INF in a JEE war application" Watch "Standard folder location for META-INF in a JEE war application" New topic
Author

Standard folder location for META-INF in a JEE war application

K Mansoor
Ranch Hand

Joined: Jan 10, 2006
Posts: 52
I always thought (don't know why) that META-INF along with WEB-INF should be at the root of a web app.

+mywebapp
---WEB-INF
------classes
------lib
---META-INF

apparently this is wrong, I found that the JPA persistence.xml should be under META-INF folder which in turn should be on the classpath, so the structure should be:

+mywebapp
---WEB-INF
------classes
---------com/blah
---------META-INF
------------persistence.xml

Don't know why, but for this reason this just don't look right. I searched for a 'standard' META-INF location, but couldn't find an answer, apparently this is an obvious thing except for boneheads like me :-)

Another thing is, (although this may not be the right forum) why Ant <jar> creates META-INF on the root of the war if META-INF is supposed to be on the classpath?

Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30361
    
150

The second is correct because META-INF should be in the place as the .class files. To visualize why this makes sense, think of a jar file. It has a META-INF folder in the root and the top level package also in the root. The same goes for the WEB-INF/classes directory. Both are at the same level.

Some IDEs show the META-INF higher up because they put it with the source code. It still jars up into the standard format though.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Standard folder location for META-INF in a JEE war application