=0A=0A=0A=0A________________________________=0A From: Andr=E9 Warnier <aw@i=
ce-sa.com>=0ATo: Tomcat Users List <users@tomcat.apache.org> =0ASent: Monda=
y, December 5, 2011 2:00:09 AM=0ASubject: Re: MVC or Model2 with Tomcat=0A =
=0ABlaxton wrote:=0A> =0A> =0A> =0A> ________________________________=0A>=
=A0 From: Pid * <pid@pidster.com>=0A> To: Tomcat Users List <users@tomcat.a=
pache.org> =0A> Sent: Sunday, December 4, 2011 11:10:08 PM=0A> Subject: Re:=
MVC or Model2 with Tomcat=0A>=A0 =0A> On 4 Dec 2011, at 16:17, Blaxton <bl=
axxton@yahoo.com> wrote:=0A> =0A>>=0A>>=0A>>=0A>> _________________________=
_______=0A>> From: Andr=E9 Warnier <aw@ice-sa.com>=0A>> To: Tomcat Users
Li=
st <users@tomcat.apache.org>=0A>> Sent: Sunday, December 4, 2011 6:51:58 PM=
=0A>> Subject: Re: MVC or Model2 with Tomcat=0A>>=0A>> Blaxton wrote:=0A>>>=
I have created ROOT directory and placed index.jsp in ROOT directory=0A>>>=
the same as your example:=0A>>> /path/to/appbase/ROOT/index.jsp=A0 =A0 -> =
myhost.com/index.jsp=0A>>>=0A>>> but that didn't work.=0A>>>=0A>>>
I follow=
ed following instructions but those didn't work either.=0A>>>=0A>>> http://=
www.jguru.com/faq/view.jsp?EID=3D91006=0A>>>=0A>>> http://wiki.apache.org/t=
omcat/HowTo#How_do_I_make_my_web_application_be_the_Tomcat_default_applicat=
ion.3F=0A>>>=0A>>> is there any thing else I should do to work this out?=0A=
>>>=0A>> I wrote that second faq, but I don't see what it has to do with yo=
ur problem.=0A>>=0A>> You haven't answered Pid's question :=0A>>=0A>>>
Why =
do you need to do that to implement MVC?=0A>> Nor his second question :=0A>=
>=0A>>> Without more information about your config, e.g. workers.properties=
it's=0A>>> impossible to tell why this didn't work.=0A>> And please, do no=
t top-post.=A0 It is very hard to follow a discussion when you have to jump=
up and down in the mesage to understand what each phrase relates to.=0A>>=
=0A>> Also, thank you for providing the versions of Apache httpd and Tomcat=
up-front.=0A>> But "mod_jk version 2", that does not exist.=0A>>=0A>> ----=
-----------------------------------------------------------------=0A>> To u=
nsubscribe, e-mail: users-unsubscribe@tomcat.apache.org=0A>> For additional=
commands, e-mail: users-help@tomcat.apache.org=0A>>=0A>>=0A>> My bad, the
=
subject should have been "serving .jsp files from apache document root"=0A>=
> I just want to access my website as follow:=0A>> www.mydomain.com/index.j=
sp=0A>>=0A>> the same as the solustion you wrote, but that solustion didn't=
work for me.=0A>> maybe because in that solution you were talking about=0A=
>> CATALINA_BASE/webapps/ROOT directory=0A>> and I created CATALINA_BASE/we=
bapps/myapplication/ROOT directory.=0A>>=0A>> can we have ROOT directory fo=
r each application ?=0A>> like:=0A>>=0A>> CATALINA_BASE/webapps/ROOT=0A>>
C=
ATALINA_BASE/webapps/firstapp/ROOT=0A>> CATALINA_BASE/webapps/secondapp/ROO=
T=0A> =0A> No, you can't. None of the docs day you can.=0A> =0A> ROOT is th=
e special name for the default application, which serves=0A> resources from=
/ and handles all requests which are not handled by=0A> other applications=
.=0A> =0A> Putting ROOT inside other apps just results in publishing that w=
hole=0A> dir as /appname/ROOT.=0A> =0A> If you don't provide other details =
of your config, no-one here will be=0A> able to help, without a really, rea=
lly lucky guess.=0A> =0A> =0A> p=0A> =0A> =0A>> anyway, here is the out
put=
of the package query on my FreeBSD box:=0A>> ap22-mo_jk-ap2-1.2.30_1 Apach=
e2 JK module for connecting to Tomcat using AJP1X=0A> =0A> ----------------=
-----------------------------------------------------=0A> To unsubscribe, e=
-mail: users-unsubscribe@tomcat.apache.org=0A> For additional commands, e-m=
ail: users-help@tomcat.apache.org=0A> =0A> =0A> =0A> Its a virtual host wit=
h following lines have been added to main httpd.conf:=0A> LoadModule jk_mod=
ule=A0 =A0 =A0 =A0 =A0 libexec/apache22/mod_jk.so=0A> JkWorkersFile /usr/lo=
cal/etc/apache22/workers.properties=0A> JkShmFile=A0 =A0 /var/log/mod_jk.s=
hm=0A> JkLogFile=A0 =A0 /var/log/mod_jk.log=0A> JkLogLevel=A0 debug =0A> =
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "=0A> =0A> and following JkMount d=
irectives for each virtual host:=0A> JkMount=A0 /appexmp1/*=A0 =A0 appexmp=
1=0A> JkMount=A0 /appexmp1/*.jsp appexmp1=0A> =0A> and following is the wor=
ker file for two of the sites:=0A> worker.list=3Dappexmp2,appexmp1=0A> work=
er.appexmp2.type=3Dajp13=0A> worker.appexmp2.host=3Dlocalhost=0A> worker.ap=
pexmp2.port=3D8009=0A> worker.appexmp1.type=3Dajp13=0A> worker.appexmp1.hos=
t=3Dlocalhost=0A> worker.appexmp1.port=3D8109=0A> =0A> =0A> Created separat=
e directories in CATALINA_BASE/webapps/=0A> for each application so , it co=
ntain following directories:=0A> CATALINA_BASE/webapps/ROOT=0A> CATALINA_BA=
SE/webapps/appexmp1=0A> CATALINA_BASE/webapps/appexmp2=0A> =0A> context fil=
e for each application resides in =0A> CATALINA_BASE/conf/Catalina/localhos=
t for example:=0A> CATALINA_BASE/conf/Catalina/localhost/appexmp1.xml=0A> C=
ATALINA_BASE/conf/Catalina/localhost/appexmp2.xml=0A> =0A> cat=A0 CATALINA_=
BASE/conf/Catalina/localhost/appexmp1.xml=0A> <Context path=3D"/appexmp1" d=
ocBase=3D"appexmp1" debug=3D"0" reloadable=3D"true" crossContext=3D"true">=
=0A> </Context>=0A> =0A> and web.xml file as follow:=0A> cat CATALINA_BASE/=
webapps/appexmp1/WEB-INF/web.xml=0A> <web-app xmlns=3D"http://java.sun.com/=
xml/ns/javaee" version=3D"2.5">=0A> <servlet>=0A>=A0 =A0 <servlet-name>App=
1</servlet-name>=0A>=A0 =A0 <servlet-class>com.appexmp1.App1</servlet-clas=
s>=0A>=A0 </servlet>=0A> =0A>=A0 <servlet-mapping>=0A>=A0 =A0
<servlet-n=
ame>App1</servlet-name>=0A>=A0 =A0 <url-pattern>/APP1</url-pattern>=0A>=A0=
</servlet-mapping>=0A> =0A>=A0 <welcome-file-list>=0A>=A0 =A0 <welcome-=
file>index.jsp</welcome-file>=0A>=A0 </welcome-file-list>=0A> =0A>
</web-a=
pp>=0A> =0A> =0A> I already can access mydomain.com/App1/index.jsp and ever=
y thing works fine=0A> but want to be able to serve .jsp files as follow:=
=0A> mydomain.com/index.jsp=0A> for each of my virtual hosts.=0A> =0A> I ho=
pe I have provided enough information.=0A> =0ANo. :-)=0A=0AWhat we are stil=
l missing, is how you have defined the DocumentRoot in each of your Apache =
=0Ahttpd VirtualHost's. And also any Alias directive which mentions "App1".=
=0A=0ABecause with your above setup, calling "mydomain.com/App1/index.jsp" =
can only work, if you =0Ahave allowed Apache httpd to access your Tomcat ap=
plications directory directly.=A0 Which =0Ayou should not do.=0A=0AHere is =
a reason why you should not do this :=0ATry the following URL :=0Amydomain.=
com/App1/WEB-INF/web.xml=0AWhat do you see ?=0ADo you want users to see tha=
t ?=0A=0A=0A=0A=0A---------------------------------------------------------=
------------=0ATo unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org=
=0AFor additional commands, e-mail: users-help@tomcat.apache.org=0A=0ASorry=
, based on context file the URL that I should have mentioned is =0Amydomain=
.com/appexmp1/index.jsp and not mydomain.com/App1/index.jsp=0A=0AApp1 is a =
servlet that just print some helloworld and that works fine.=0Aprobably sho=
uld have not mentioned that as it has nothing to do with jsp.=0A=0AApache D=
ocumentRoot is not overlapping Tomcat's docbase.=0AI already have provided =
context file and here is the apache DocumentRoot:=0ADocumentRoot "/var/www/=
appexmp1/httpdocs"=0A=0Aaccessing mydomain.com/appexmp1/WEB-INF/web.xml res=
ults file not exist.=0A=0Amydomain.com/appexmp1/index.jsp=A0 works fine but=
want to access mydomain.com/index.jsp
|