users
[Top] [All Lists]

RE: [cinjug-users] directories in WAR files

To: "Amol Deshmukh" <adeshmukh@xxxxxxxxxxxxxx>, "Abraham Fathman" <abraham@xxxxxxxxxxx>, <users@xxxxxxxxxx>
Subject: RE: [cinjug-users] directories in WAR files
From: "Herbers, Joe" <herbers@xxxxxxx>
Date: Wed, 29 Jun 2005 15:21:11 -0400
Delivered-to: mailing list users@cinjug.org
Mailing-list: contact users-help@cinjug.org; run by ezmlm
Thread-index: AcV8vePjMEeBvNv8R/69xuD8FRk/wAAITDqw
Thread-topic: [cinjug-users] directories in WAR files

Thanks for the good info.  It turns out that the WAR was created via a Java program that uses the JarFile API to manually create the WAR from a recursive file listing (I’m not sure why).  That’s why it doesn’t include directories.

 

So does lack of directory entries make the WAR invalid?  I haven’t yet found anything on the web about this.  The WAR works in every AppServer I’ve tried until WLS SP4 (SP2 is fine).  So should it work? in which case this is a regression in WLS SP4 ?  Trying to figure out who to point the finger at J

 

Thanks, Joe

 


From: Amol Deshmukh [mailto:adeshmukh@xxxxxxxxxxxxxx]
Sent: Wednesday, June 29, 2005 11:15 AM
To: 'Abraham Fathman'; Herbers, Joe; users@xxxxxxxxxx
Subject: RE: [cinjug-users] directories in WAR files

 

If you are using ant's war task:

 

ant's war task has an attribute: filesonly which defaults to false (in which case empty dirs should show up).

You could check if it is explicitly set to true. Or try explicitly setting it to false.

 

~ amol

-----Original Message-----
From: Abraham Fathman [mailto:abraham@xxxxxxxxxxx]
Sent: Wednesday, June 29, 2005 10:47 AM
To: 'Herbers, Joe'; users@xxxxxxxxxx
Subject: RE: [cinjug-users] directories in WAR files

 Hey Joe,

 

I think that I have seen this problem before... Just to make sure I understand the problem... you will create a war file and when you open it in winzip it doesn't appear to have everything you expect to have in it. But then... if you do an unzip from the command line everything is unzipped from it just fine.

 

Is that basically what you are seeing?

 

I saw this at my previous employer and never could figure out what was causing it... I can't remember for certain but I think it happened when we were using the ant tasks zip, jar, and war (they all had the problem).

 

Right now we are using the jar command to build our war. Probably because we have the web.xml in the director we are warring and don't appreciate the warning that ant spits out (maybe there is a way to disable that...).

 

 Are you using Ant to build your war? What version? What JDK are you using?

 

We were using jdk 1.3.1 from IBM with ant 1.4 (I think) when we saw this problem...

 

I can't say that I have seen this problem when using a sun JDK... (also now using ant 1.6).

 

Hope this helps...

 

Abraham Fathman

 

 


From: Herbers, Joe [mailto:herbers@xxxxxxx]
Sent: Wednesday, June 29, 2005 10:18 AM
To: users@xxxxxxxxxx
Subject: [cinjug-users] directories in WAR files

I thought I'd toss this out in case anyone has any thoughts or experience.  I've found that with some WAR files (produced in a way that I'm still investigating), there are not entries in the WAR's table for directories; whereas with WARs I create with jar and winzip and my command-line zip, there are directory entries.  For example, in the output below from a normal war, you can see an entry for WEB-INF/ itself.

 

Why does this matter?  Well it comes up when we use ServletContext.getResourcePaths.  On Tomcat, WebSphere, WebLogic 8.1 SP2, etc. we are able to get a list of the files in the dir WEB-INF/bob by calling getResourcePaths and passing in "/WEB-INF/bob/".  Works fine.  However, with WLS SP4, they made a "fix" and now for the abnormal WARs (those without dir entries), this doesn't work!

 

The workaround is to unjar/zip, then rejar/zip the war, or even just update the files in the bob dir using jar, winzip, zip.  But who is at fault here?  Is it a WAR/jar requirement to have directory entries in the WAR? In which case the problem is with the creator of these abnormal WARs.  Or is this a regression in WLS?

 

> jar tf Bob_bad.war | grep WEB-INF

 

WEB-INF/

WEB-INF/classes/

WEB-INF/classes/Message.properties

...

WEB-INF/bob/

WEB-INF/bob/Bob1.xml

WEB-INF/bob/Bob2.xml

WEB-INF/web.xml

 

http://e-docs.bea.com/wls/docs81/notes/new.html#1202654

 

Thanks, Joe

 

-----Original Message-----
From: Abraham Fathman [mailto:abraham@xxxxxxxxxxx]
Sent: Wednesday, June 29, 2005 10:47 AM
To: 'Herbers, Joe'; users@xxxxxxxxxx
Subject: RE: [cinjug-users] directories in WAR files

 Hey Joe,

 

I think that I have seen this problem before... Just to make sure I understand the problem... you will create a war file and when you open it in winzip it doesn't appear to have everything you expect to have in it. But then... if you do an unzip from the command line everything is unzipped from it just fine.

 

Is that basically what you are seeing?

 

I saw this at my previous employer and never could figure out what was causing it... I can't remember for certain but I think it happened when we were using the ant tasks zip, jar, and war (they all had the problem).

 

Right now we are using the jar command to build our war. Probably because we have the web.xml in the director we are warring and don't appreciate the warning that ant spits out (maybe there is a way to disable that...).

 

 Are you using Ant to build your war? What version? What JDK are you using?

 

We were using jdk 1.3.1 from IBM with ant 1.4 (I think) when we saw this problem...

 

I can't say that I have seen this problem when using a sun JDK... (also now using ant 1.6).

 

Hope this helps...

 

Abraham Fathman

 

 


From: Herbers, Joe [mailto:herbers@xxxxxxx]
Sent: Wednesday, June 29, 2005 10:18 AM
To: users@xxxxxxxxxx
Subject: [cinjug-users] directories in WAR files

I thought I'd toss this out in case anyone has any thoughts or experience.  I've found that with some WAR files (produced in a way that I'm still investigating), there are not entries in the WAR's table for directories; whereas with WARs I create with jar and winzip and my command-line zip, there are directory entries.  For example, in the output below from a normal war, you can see an entry for WEB-INF/ itself.

 

Why does this matter?  Well it comes up when we use ServletContext.getResourcePaths.  On Tomcat, WebSphere, WebLogic 8.1 SP2, etc. we are able to get a list of the files in the dir WEB-INF/bob by calling getResourcePaths and passing in "/WEB-INF/bob/".  Works fine.  However, with WLS SP4, they made a "fix" and now for the abnormal WARs (those without dir entries), this doesn't work!

 

The workaround is to unjar/zip, then rejar/zip the war, or even just update the files in the bob dir using jar, winzip, zip.  But who is at fault here?  Is it a WAR/jar requirement to have directory entries in the WAR? In which case the problem is with the creator of these abnormal WARs.  Or is this a regression in WLS?

 

> jar tf Bob_bad.war | grep WEB-INF

 

WEB-INF/

WEB-INF/classes/

WEB-INF/classes/Message.properties

...

WEB-INF/bob/

WEB-INF/bob/Bob1.xml

WEB-INF/bob/Bob2.xml

WEB-INF/web.xml

 

http://e-docs.bea.com/wls/docs81/notes/new.html#1202654

 

Thanks, Joe

 

<Prev in Thread] Current Thread [Next in Thread>