You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Nick Roberts <NR...@Silverplatter.com> on 2000/07/13 20:56:46 UTC
Running the Struts Example under Apache
Hi,
I have installed the struts-documentation and struts-example
applications under tomcat and they both work fine.
I can also access the struts-documentation application fine via Apache
but the struts-example simply displays a message saying the database
could not be loaded.
The error is because index.jsp cannot retrieve the appropriate attribute
from the application context. As this was added to the application
context by the DatabaseServlet init method why is index.jsp unable to
retrieve it ?
What is different about running under Apache that causes the JSP page
and DatabaseServlets to think they are in separate application whereas
under Tomcat they are happy to believe they are in the same application
?
My settings from httpd.conf are based on those in the example in the
Tomcat users guide and are below
Any suggestions much appreciated,
Nick Roberts
Silverplatter Information Ltd
#
# Mounting a servlet context for the struts examples:
#
Alias /struts-example e:\jakarta-tomcat\webapps\struts-example
<Directory "e:\jakarta-tomcat\webapps\struts-example">
Options Indexes FollowSymLinks
DirectoryIndex index.jsp
</Directory>
<Location /struts-example/WEB-INF/>
AllowOverride None
deny from all
</Location>
<LocationMatch /struts-example/*.jsp>
SetHandler jserv-servlet
</LocationMatch>
ApJServMount /struts-example/servlet /struts-example
ApJServMount /servlet /ROOT
Re: Running the Struts Example under Apache
Posted by Nick Roberts <NR...@Silverplatter.com>.
Ok fixed it.
I realised rather belatedly that index.jsp was being displayed as a
static page and the browser just ignored sufficient tags to make it look
like it had been processed.
I changed the LocationMatch to Location and added one for *.do, I don't
know why adding the global AddHandlers didn't work.
Nick Roberts
SilverPlatter Information Ltd.
Nick Roberts wrote:
>
> The Servlet has started ok and added the appropriate entries in the
> servlet log.
> I'm using Tomcat 3.1.
> I added the mapping for *.do as you suggested and changed the
> LocationMatch to a global handler for *.jsp.
> And no joy, I still get the same error messages.
>
> Nick Roberts
> SilverPlatter Information Ltd
>
> "Craig R. McClanahan" wrote:
> >
> > Could you take a look at the Tomcat log files to see if the database servlet
> > and controller servlet were actually initialized? Depending on which build
> > of Tomcat you are running, there were some problems with load-on-startup
> > servlets being processed.
> >
> > Also, see below for some other notes.
> >
> > Nick Roberts wrote:
> >
> > > Hi,
> > > I have installed the struts-documentation and struts-example
> > > applications under tomcat and they both work fine.
> > >
> > > I can also access the struts-documentation application fine via Apache
> > > but the struts-example simply displays a message saying the database
> > > could not be loaded.
> > >
> > > The error is because index.jsp cannot retrieve the appropriate attribute
> > > from the application context. As this was added to the application
> > > context by the DatabaseServlet init method why is index.jsp unable to
> > > retrieve it ?
> > >
> > > What is different about running under Apache that causes the JSP page
> > > and DatabaseServlets to think they are in separate application whereas
> > > under Tomcat they are happy to believe they are in the same application
> > > ?
> > >
> > > My settings from httpd.conf are based on those in the example in the
> > > Tomcat users guide and are below
> > >
> > > Any suggestions much appreciated,
> > >
> > > Nick Roberts
> > > Silverplatter Information Ltd
> > >
> > > #
> > > # Mounting a servlet context for the struts examples:
> > > #
> > > Alias /struts-example e:\jakarta-tomcat\webapps\struts-example
> > > <Directory "e:\jakarta-tomcat\webapps\struts-example">
> > > Options Indexes FollowSymLinks
> > > DirectoryIndex index.jsp
> > > </Directory>
> > >
> > > <Location /struts-example/WEB-INF/>
> > > AllowOverride None
> > > deny from all
> > > </Location>
> > >
> > > <LocationMatch /struts-example/*.jsp>
> > > SetHandler jserv-servlet
> > > </LocationMatch>
> > >
> >
> > I've never actually tried using <LocationMatch> like this -- the default way
> > that Tomcat generates its integration file includes a global
> >
> > AddHandler jserv-servlet *.jsp
> >
> > directive.
> >
> > Regardless of which way you do the JSP forwarding, you are also going to
> > need to add forwarding for the "*.do" extension that is used for the
> > controller servlet submits. The simplest way would be another line:
> >
> > AddHandler jserv-servlet *.do
> >
> > which does it globally, but the LocationMatch trick ought to work here as
> > well.
> >
> > >
> > > ApJServMount /struts-example/servlet /struts-example
> > >
> > > ApJServMount /servlet /ROOT
> >
> > Craig
Re: Running the Struts Example under Apache
Posted by Nick Roberts <NR...@Silverplatter.com>.
The Servlet has started ok and added the appropriate entries in the
servlet log.
I'm using Tomcat 3.1.
I added the mapping for *.do as you suggested and changed the
LocationMatch to a global handler for *.jsp.
And no joy, I still get the same error messages.
Nick Roberts
SilverPlatter Information Ltd
"Craig R. McClanahan" wrote:
>
> Could you take a look at the Tomcat log files to see if the database servlet
> and controller servlet were actually initialized? Depending on which build
> of Tomcat you are running, there were some problems with load-on-startup
> servlets being processed.
>
> Also, see below for some other notes.
>
> Nick Roberts wrote:
>
> > Hi,
> > I have installed the struts-documentation and struts-example
> > applications under tomcat and they both work fine.
> >
> > I can also access the struts-documentation application fine via Apache
> > but the struts-example simply displays a message saying the database
> > could not be loaded.
> >
> > The error is because index.jsp cannot retrieve the appropriate attribute
> > from the application context. As this was added to the application
> > context by the DatabaseServlet init method why is index.jsp unable to
> > retrieve it ?
> >
> > What is different about running under Apache that causes the JSP page
> > and DatabaseServlets to think they are in separate application whereas
> > under Tomcat they are happy to believe they are in the same application
> > ?
> >
> > My settings from httpd.conf are based on those in the example in the
> > Tomcat users guide and are below
> >
> > Any suggestions much appreciated,
> >
> > Nick Roberts
> > Silverplatter Information Ltd
> >
> > #
> > # Mounting a servlet context for the struts examples:
> > #
> > Alias /struts-example e:\jakarta-tomcat\webapps\struts-example
> > <Directory "e:\jakarta-tomcat\webapps\struts-example">
> > Options Indexes FollowSymLinks
> > DirectoryIndex index.jsp
> > </Directory>
> >
> > <Location /struts-example/WEB-INF/>
> > AllowOverride None
> > deny from all
> > </Location>
> >
> > <LocationMatch /struts-example/*.jsp>
> > SetHandler jserv-servlet
> > </LocationMatch>
> >
>
> I've never actually tried using <LocationMatch> like this -- the default way
> that Tomcat generates its integration file includes a global
>
> AddHandler jserv-servlet *.jsp
>
> directive.
>
> Regardless of which way you do the JSP forwarding, you are also going to
> need to add forwarding for the "*.do" extension that is used for the
> controller servlet submits. The simplest way would be another line:
>
> AddHandler jserv-servlet *.do
>
> which does it globally, but the LocationMatch trick ought to work here as
> well.
>
> >
> > ApJServMount /struts-example/servlet /struts-example
> >
> > ApJServMount /servlet /ROOT
>
> Craig
Re: Running the Struts Example under Apache
Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Could you take a look at the Tomcat log files to see if the database servlet
and controller servlet were actually initialized? Depending on which build
of Tomcat you are running, there were some problems with load-on-startup
servlets being processed.
Also, see below for some other notes.
Nick Roberts wrote:
> Hi,
> I have installed the struts-documentation and struts-example
> applications under tomcat and they both work fine.
>
> I can also access the struts-documentation application fine via Apache
> but the struts-example simply displays a message saying the database
> could not be loaded.
>
> The error is because index.jsp cannot retrieve the appropriate attribute
> from the application context. As this was added to the application
> context by the DatabaseServlet init method why is index.jsp unable to
> retrieve it ?
>
> What is different about running under Apache that causes the JSP page
> and DatabaseServlets to think they are in separate application whereas
> under Tomcat they are happy to believe they are in the same application
> ?
>
> My settings from httpd.conf are based on those in the example in the
> Tomcat users guide and are below
>
> Any suggestions much appreciated,
>
> Nick Roberts
> Silverplatter Information Ltd
>
> #
> # Mounting a servlet context for the struts examples:
> #
> Alias /struts-example e:\jakarta-tomcat\webapps\struts-example
> <Directory "e:\jakarta-tomcat\webapps\struts-example">
> Options Indexes FollowSymLinks
> DirectoryIndex index.jsp
> </Directory>
>
> <Location /struts-example/WEB-INF/>
> AllowOverride None
> deny from all
> </Location>
>
> <LocationMatch /struts-example/*.jsp>
> SetHandler jserv-servlet
> </LocationMatch>
>
I've never actually tried using <LocationMatch> like this -- the default way
that Tomcat generates its integration file includes a global
AddHandler jserv-servlet *.jsp
directive.
Regardless of which way you do the JSP forwarding, you are also going to
need to add forwarding for the "*.do" extension that is used for the
controller servlet submits. The simplest way would be another line:
AddHandler jserv-servlet *.do
which does it globally, but the LocationMatch trick ought to work here as
well.
>
> ApJServMount /struts-example/servlet /struts-example
>
> ApJServMount /servlet /ROOT
Craig