You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by James Gagan <jg...@shaw.ca> on 2002/09/16 02:06:24 UTC

oc4j can't find web.xml when WEB-INF is moved below application root.

Hi, I've just made my first web-app with Struts.
One of the standards I must adhere to is that the WEB-INF folder be under a
directory
called WEB in the application's root folder.  So instead of :  myApp\WEB-INF
I have to have : myApp\web\WEB-INF.  However, when I move the WEB-INF
folder,
the server (I'm using OC4J but I have the same problem when I try it on
TOMCAT)
can no longer find the application's web.xml file (or anything in WEB-INF).
I have tried just about everything, but to no avail.  And I have yet to see
any examples or
sample applications where the WEB-INF folder is anywhere other than in the
root
directory of the given application.  Is there something I'm not seeing in
one of the
server config files that tells the server where to find the WEB-INF folder
for each application?
Or could it be that I need something in my classpath? Any help would be
really appreciated.

James Gagan

reply to: jgagan@shaw.ca


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: oc4j can't find web.xml when WEB-INF is moved below application root.

Posted by Eddie Bush <ek...@swbell.net>.
No harm; no foul ;-)  Sorry about the tone.  I read it later and was 
ashamed of myself.  Yes, it was obvious this was at least your first 
application that had to adhere to spec 2.3 ;-)  I felt pretty stupid 
when I looked (already hit send) and saw Max gave a lot more succint 
answer -- and didn't come off condescending (I hate it when I do that :-/).

Yeah - sounds like you're on-track :-)  Good luck with it.  Struts is a 
lot of fun.

Regards,

Eddie

James Gagan wrote:

>Hi Eddie,
>
>Yes, I just got another reply saying almost the same thing.
>What you describe is exactly correct and describes the format I have to
>adhere to.
>I have been using ant to compile my project along the way.  Next I'll have
>to use it to
>build the project on the application test server.  So I should,
>from what I can tell, wind up with a directory structure the same as yours.
>My apologies for not scrutinizing the specification before posting!  This is
>my first Struts
>web-app (actually first web-app period!) so I'm still figuring a lot of
>stuff out.
>
>Thanks a lot!
>james
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: oc4j can't find web.xml when WEB-INF is moved below application root.

Posted by James Gagan <jg...@shaw.ca>.
Hi Eddie,

Yes, I just got another reply saying almost the same thing.
What you describe is exactly correct and describes the format I have to
adhere to.
I have been using ant to compile my project along the way.  Next I'll have
to use it to
build the project on the application test server.  So I should,
from what I can tell, wind up with a directory structure the same as yours.
My apologies for not scrutinizing the specification before posting!  This is
my first Struts
web-app (actually first web-app period!) so I'm still figuring a lot of
stuff out.

Thanks a lot!
james


----- Original Message -----
From: "Eddie Bush" <ek...@swbell.net>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Sunday, September 15, 2002 5:32 PM
Subject: Re: oc4j can't find web.xml when WEB-INF is moved below application
root.


> Huh - go figure.  I'd say that had something to do with the fact that
> your top-level directory (per servlet spec 2.3 I believe) *must* contain
> a WEB-INF directory in order for your application to be valid.
>
> I'm not sure what you mean by having to have a web directory.  I know
> that ... well here's what I have for a given application:
>
> /.../dvel/projects                    <-- I keep all my projects here
>    <project-name>/                    <-- One for each of them
>        src/                           <-- This is where my java files
> are.  I also keep my property files here.
>        web/                           <-- This is my root
> web-application directory.  This is what is going to actually get
> distributed.
>        .../                           <-- Depending on the project, I
> may have a doc directory -- and others, as necessary
>
> ... let's look at that web directory.  I said that was what got
> distributed, and it is.  The format for it is:
>
> web/
>    WEB-INF/
>        classes/
>        lib/
>
> Look familiar?  It should.  This is the mandatory format for a spec 2.3
> compiant web application.
>
> Ok, so I'm coding along in my src directory -- making all kinds of
> packages and what-not.  Then, I need to actually build the stuff up.
> How?  I use ant (and so should you!) to compile my src directory -- and
> then copy all of my .class and .properties files over into my
> web/WEB-INF/classes directory.  It's nice enough to preserve the package
> where the .java files lived, so I have no worries.  For property files
> that need to live in the top-level classes directory, I create them in
> my top-level src directory.  It's all pretty straight-forward from there.
>
> Now, I might be really confused, but I think something along these lines
> is what you want to do.  You can't just move the WEB-INF directory where
> you want it to be -- the specification states where it *must* be.
>
> Hope that helps!
>
> Eddie
>
>
> James Gagan wrote:
>
> >Hi, I've just made my first web-app with Struts.
> >One of the standards I must adhere to is that the WEB-INF folder be under
a
> >directory
> >called WEB in the application's root folder.  So instead of :
myApp\WEB-INF
> >I have to have : myApp\web\WEB-INF.  However, when I move the WEB-INF
> >folder,
> >the server (I'm using OC4J but I have the same problem when I try it on
> >TOMCAT)
> >can no longer find the application's web.xml file (or anything in
WEB-INF).
> >I have tried just about everything, but to no avail.  And I have yet to
see
> >any examples or
> >sample applications where the WEB-INF folder is anywhere other than in
the
> >root
> >directory of the given application.  Is there something I'm not seeing in
> >one of the
> >server config files that tells the server where to find the WEB-INF
folder
> >for each application?
> >Or could it be that I need something in my classpath? Any help would be
> >really appreciated.
> >
> >James Gagan
> >
> >reply to: jgagan@shaw.ca
> >
> >
> >--
> >To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> >For additional commands, e-mail:
<ma...@jakarta.apache.org>
> >
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: oc4j can't find web.xml when WEB-INF is moved below application root.

Posted by Eddie Bush <ek...@swbell.net>.
Huh - go figure.  I'd say that had something to do with the fact that 
your top-level directory (per servlet spec 2.3 I believe) *must* contain 
a WEB-INF directory in order for your application to be valid.

I'm not sure what you mean by having to have a web directory.  I know 
that ... well here's what I have for a given application:

/.../dvel/projects                    <-- I keep all my projects here
   <project-name>/                    <-- One for each of them
       src/                           <-- This is where my java files 
are.  I also keep my property files here.
       web/                           <-- This is my root 
web-application directory.  This is what is going to actually get 
distributed.
       .../                           <-- Depending on the project, I 
may have a doc directory -- and others, as necessary

... let's look at that web directory.  I said that was what got 
distributed, and it is.  The format for it is:

web/
   WEB-INF/
       classes/
       lib/

Look familiar?  It should.  This is the mandatory format for a spec 2.3 
compiant web application.

Ok, so I'm coding along in my src directory -- making all kinds of 
packages and what-not.  Then, I need to actually build the stuff up. 
How?  I use ant (and so should you!) to compile my src directory -- and 
then copy all of my .class and .properties files over into my 
web/WEB-INF/classes directory.  It's nice enough to preserve the package 
where the .java files lived, so I have no worries.  For property files 
that need to live in the top-level classes directory, I create them in 
my top-level src directory.  It's all pretty straight-forward from there.

Now, I might be really confused, but I think something along these lines 
is what you want to do.  You can't just move the WEB-INF directory where 
you want it to be -- the specification states where it *must* be.

Hope that helps!

Eddie


James Gagan wrote:

>Hi, I've just made my first web-app with Struts.
>One of the standards I must adhere to is that the WEB-INF folder be under a
>directory
>called WEB in the application's root folder.  So instead of :  myApp\WEB-INF
>I have to have : myApp\web\WEB-INF.  However, when I move the WEB-INF
>folder,
>the server (I'm using OC4J but I have the same problem when I try it on
>TOMCAT)
>can no longer find the application's web.xml file (or anything in WEB-INF).
>I have tried just about everything, but to no avail.  And I have yet to see
>any examples or
>sample applications where the WEB-INF folder is anywhere other than in the
>root
>directory of the given application.  Is there something I'm not seeing in
>one of the
>server config files that tells the server where to find the WEB-INF folder
>for each application?
>Or could it be that I need something in my classpath? Any help would be
>really appreciated.
>
>James Gagan
>
>reply to: jgagan@shaw.ca
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: oc4j can't find web.xml when WEB-INF is moved below application root.

Posted by James Gagan <jg...@shaw.ca>.
Thanks, Max.

That's probably exactly what's going on.  I just snooped on the application
server and the
directory structure actually follows the same convention that you
describe.....That clears things up a lot.
I should've joined the mailing list long ago...

james

----- Original Message -----
From: "Max Cooper" <ma...@maxcooper.com>
To: <st...@jakarta.apache.org>; <jg...@shaw.ca>
Sent: Sunday, September 15, 2002 5:23 PM
Subject: Re: oc4j can't find web.xml when WEB-INF is moved below application
root.


> James,
>
> WEB-INF must be in the root directory of your web application.
>
> We have a convention at our company where we have a 'web' folder in the
> project's directory structure. Here is an example:
>
> c:\myproject (root of project files)
> c:\myproject\web (root of this project's web app files)
> c:\myproject\web\WEB-INF (the WEB-INF dir)
> c:\myproject\src (root of this project's source tree)
> ... etc
>
> I suspect that you have a similar standard but got the ideas of "project
> root" and "web app root" mixed up. In this example, the files for the
> project/application are rooted at c:\myproject, but the web app part of
the
> project is rooted at c:\myproject\web. You would configure the server to
> find your application at c:\project\web rather than c:\project. It would
be
> silly to have all the URLs start with /web/, so it seems very likely to me
> that this is what is going on.
>
> -Max
>
>
> ----- Original Message -----
> From: "James Gagan" <jg...@shaw.ca>
> To: <st...@jakarta.apache.org>
> Sent: Sunday, September 15, 2002 5:06 PM
> Subject: oc4j can't find web.xml when WEB-INF is moved below application
> root.
>
>
> > Hi, I've just made my first web-app with Struts.
> > One of the standards I must adhere to is that the WEB-INF folder be
under
> a
> > directory
> > called WEB in the application's root folder.  So instead of :
> myApp\WEB-INF
> > I have to have : myApp\web\WEB-INF.  However, when I move the WEB-INF
> > folder,
> > the server (I'm using OC4J but I have the same problem when I try it on
> > TOMCAT)
> > can no longer find the application's web.xml file (or anything in
> WEB-INF).
> > I have tried just about everything, but to no avail.  And I have yet to
> see
> > any examples or
> > sample applications where the WEB-INF folder is anywhere other than in
the
> > root
> > directory of the given application.  Is there something I'm not seeing
in
> > one of the
> > server config files that tells the server where to find the WEB-INF
folder
> > for each application?
> > Or could it be that I need something in my classpath? Any help would be
> > really appreciated.
> >
> > James Gagan
> >
> > reply to: jgagan@shaw.ca
> >
> >
> > --
> > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> >
> >
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: oc4j can't find web.xml when WEB-INF is moved below application root.

Posted by Max Cooper <ma...@maxcooper.com>.
James,

WEB-INF must be in the root directory of your web application.

We have a convention at our company where we have a 'web' folder in the
project's directory structure. Here is an example:

c:\myproject (root of project files)
c:\myproject\web (root of this project's web app files)
c:\myproject\web\WEB-INF (the WEB-INF dir)
c:\myproject\src (root of this project's source tree)
... etc

I suspect that you have a similar standard but got the ideas of "project
root" and "web app root" mixed up. In this example, the files for the
project/application are rooted at c:\myproject, but the web app part of the
project is rooted at c:\myproject\web. You would configure the server to
find your application at c:\project\web rather than c:\project. It would be
silly to have all the URLs start with /web/, so it seems very likely to me
that this is what is going on.

-Max


----- Original Message -----
From: "James Gagan" <jg...@shaw.ca>
To: <st...@jakarta.apache.org>
Sent: Sunday, September 15, 2002 5:06 PM
Subject: oc4j can't find web.xml when WEB-INF is moved below application
root.


> Hi, I've just made my first web-app with Struts.
> One of the standards I must adhere to is that the WEB-INF folder be under
a
> directory
> called WEB in the application's root folder.  So instead of :
myApp\WEB-INF
> I have to have : myApp\web\WEB-INF.  However, when I move the WEB-INF
> folder,
> the server (I'm using OC4J but I have the same problem when I try it on
> TOMCAT)
> can no longer find the application's web.xml file (or anything in
WEB-INF).
> I have tried just about everything, but to no avail.  And I have yet to
see
> any examples or
> sample applications where the WEB-INF folder is anywhere other than in the
> root
> directory of the given application.  Is there something I'm not seeing in
> one of the
> server config files that tells the server where to find the WEB-INF folder
> for each application?
> Or could it be that I need something in my classpath? Any help would be
> really appreciated.
>
> James Gagan
>
> reply to: jgagan@shaw.ca
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>