=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 4:13:33 AM=0ASubject: Re: MVC or Model2 with Tomcat=0A =
=0ABlaxton wrote:=0A> =0A> =0A> =0A> ________________________________=0A>=
=A0 From: Andr=E9 Warnier <aw@ice-sa.com>=0A> To: Tomcat Users List <users@=
tomcat.apache.org> =0A> Sent: Monday, December 5, 2011 2:00:09 AM=0A> Subje=
ct: Re: MVC or Model2 with Tomcat=0A>=A0 =0A> Blaxton wrote:=0A>>=0A>>=0A>>=
________________________________=0A>>=A0 From: Pid * <pid@pidster.com>=0A=
>> To: Tomcat Users List <users@tomcat.apache.org> =0A>> Sent: Sunday, Dece=
mber 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 <blaxxton@yahoo.com> wrote:=0A>>=
=0A>>>=0A>>>=0A>>> ________________________________=0A>>>
From: Andr=E9 War=
nier <aw@ice-sa.com>=0A>>> To: Tomcat Users List <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 di=
rectory and placed index.jsp in ROOT directory=0A>>>> the same as your exam=
ple:=0A>>>> /path/to/appbase/ROOT/index.jsp=A0 =A0 -> myhost.com/index.jsp=
=0A>>>>=0A>>>> but that didn't work.=0A>>>>=0A>>>>
I followed following ins=
tructions but those didn't work either.=0A>>>>=0A>>>> http://www.jguru.com/=
faq/view.jsp?EID=3D91006=0A>>>>=0A>>>> http://wiki.apache.org/tomcat/HowTo#=
How_do_I_make_my_web_application_be_the_Tomcat_default_application.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 your probl=
em.=0A>>>=0A>>> You haven't answered Pid's question :=0A>>>=0A>>>>
Why do y=
ou 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 =
not top-post.=A0 It is very hard to follow a discussion when you have to ju=
mp 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 Tom=
cat up-front.=0A>>> But "mod_jk version 2", that does not exist.=0A>>>=0A>>=
> ---------------------------------------------------------------------=0A>=
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org=0A>>> For ad=
ditional commands, e-mail: users-help@tomcat.apache.org=0A>>>=0A>>>=0A>>>
M=
y bad, the subject should have been "serving .jsp files from apache documen=
t root"=0A>>> I just want to access my website as follow:=0A>>> www.mydomai=
n.com/index.jsp=0A>>>=0A>>> the same as the solustion you wrote, but that
s=
olustion didn't work for me.=0A>>> maybe because in that solution you were =
talking about=0A>>> CATALINA_BASE/webapps/ROOT directory=0A>>> and I create=
d CATALINA_BASE/webapps/myapplication/ROOT directory.=0A>>>=0A>>> can we
ha=
ve ROOT directory for each application ?=0A>>> like:=0A>>>=0A>>>
CATALINA_B=
ASE/webapps/ROOT=0A>>> CATALINA_BASE/webapps/firstapp/ROOT=0A>>> CATALINA_B=
ASE/webapps/secondapp/ROOT=0A>> No, you can't. None of the docs day you can=
.=0A>>=0A>> ROOT is the special name for the default application, which ser=
ves=0A>> resources from / and handles all requests which are not handled by=
=0A>> other applications.=0A>>=0A>> Putting ROOT inside other apps just
res=
ults in publishing that whole=0A>> dir as /appname/ROOT.=0A>>=0A>> If you
d=
on't provide other details of your config, no-one here will be=0A>> able to=
help, without a really, really 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 Apache2 JK module for connecting to Tomcat using =
AJP1X=0A>> ----------------------------------------------------------------=
-----=0A>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org=0A>>=
For additional commands, e-mail: users-help@tomcat.apache.org=0A>>=0A>>=0A=
>>=0A>> Its a virtual host with following lines have been added to main htt=
pd.conf:=0A>> LoadModule jk_module=A0 =A0 =A0 =A0 =A0 libexec/apache22/mod_=
jk.so=0A>> JkWorkersFile /usr/local/etc/apache22/workers.properties=0A>> Jk=
ShmFile=A0 =A0 /var/log/mod_jk.shm=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 directives for each virtual host:=0A>>
=
JkMount=A0 /appexmp1/*=A0 =A0 appexmp1=0A>> JkMount=A0 /appexmp1/*.jsp app=
exmp1=0A>>=0A>> and following is the worker file for two of the sites:=0A>>=
worker.list=3Dappexmp2,appexmp1=0A>> worker.appexmp2.type=3Dajp13=0A>> wor=
ker.appexmp2.host=3Dlocalhost=0A>> worker.appexmp2.port=3D8009=0A>> worker.=
appexmp1.type=3Dajp13=0A>> worker.appexmp1.host=3Dlocalhost=0A>> worker.app=
exmp1.port=3D8109=0A>>=0A>>=0A>> Created separate directories in CATALINA_B=
ASE/webapps/=0A>> for each application so , it contain following directorie=
s:=0A>> CATALINA_BASE/webapps/ROOT=0A>> CATALINA_BASE/webapps/appexmp1=0A>>=
CATALINA_BASE/webapps/appexmp2=0A>>=0A>> context file for each application=
resides in =0A>> CATALINA_BASE/conf/Catalina/localhost for example:=0A>> C=
ATALINA_BASE/conf/Catalina/localhost/appexmp1.xml=0A>> CATALINA_BASE/conf/C=
atalina/localhost/appexmp2.xml=0A>>=0A>> cat=A0 CATALINA_BASE/conf/Catalina=
/localhost/appexmp1.xml=0A>> <Context path=3D"/appexmp1" docBase=3D"appexmp=
1" debug=3D"0" reloadable=3D"true" crossContext=3D"true">=0A>> </Context>=
=0A>>=0A>> and web.xml file as follow:=0A>> cat CATALINA_BASE/webapps/appex=
mp1/WEB-INF/web.xml=0A>> <web-app xmlns=3D"http://java.sun.com/xml/ns/javae=
e" version=3D"2.5">=0A>> <servlet>=0A>>=A0 =A0 =A0 <servlet-name>App1</serv=
let-name>=0A>>=A0 =A0 =A0 <servlet-class>com.appexmp1.App1</servlet-class>=
=0A>>=A0 =A0 </servlet>=0A>>=0A>>=A0 =A0 <servlet-mapping>=0A>>=A0
=A0 =A0 =
<servlet-name>App1</servlet-name>=0A>>=A0 =A0 =A0 <url-pattern>/APP1</url-p=
attern>=0A>>=A0 =A0 </servlet-mapping>=0A>>=0A>>=A0 =A0 <welcome-file-list>=
=0A>>=A0 =A0 =A0 <welcome-file>index.jsp</welcome-file>=0A>>=A0 =A0
</welco=
me-file-list>=0A>>=0A>> </web-app>=0A>>=0A>>=0A>> I
already can access mydo=
main.com/App1/index.jsp and every thing works fine=0A>> but want to be able=
to serve .jsp files as follow:=0A>> mydomain.com/index.jsp=0A>> for each o=
f my virtual hosts.=0A>>=0A>> I hope I have provided enough information.=0A=
>>=0A> No. :-)=0A> =0A> What we are still missing, is how you have defined
=
the DocumentRoot in each of your Apache =0A> httpd VirtualHost's. And also =
any Alias directive which mentions "App1".=0A> =0A> Because with your above=
setup, calling "mydomain.com/App1/index.jsp" can only work, if you =0A> ha=
ve allowed Apache httpd to access your Tomcat applications directory direct=
ly.=A0 Which =0A> you should not do.=0A> =0A> Here is a reason why you shou=
ld not do this :=0A> Try the following URL :=0A> mydomain.com/App1/WEB-INF/=
web.xml=0A> What do you see ?=0A> Do you want users to see that ?=0A> =0A> =
=0A> =0A> =0A> ------------------------------------------------------------=
---------=0A> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org=
=0A> For additional commands, e-mail: users-help@tomcat.apache.org=0A> =0A>=
Sorry, based on context file the URL that I should have mentioned is =0A> =
mydomain.com/appexmp1/index.jsp and not mydomain.com/App1/index.jsp=0A> =0A=
> App1 is a servlet that just print some helloworld and that works fine.=0A=
> probably should have not mentioned that as it has nothing to do with jsp.=
=0A> =0A> Apache DocumentRoot is not overlapping Tomcat's docbase.=0A> I al=
ready have provided context file and here is the apache DocumentRoot:=0A> D=
ocumentRoot "/var/www/appexmp1/httpdocs"=0A> =0A> accessing mydomain.com/ap=
pexmp1/WEB-INF/web.xml results file not exist.=0A> =0A> mydomain.com/appexm=
p1/index.jsp=A0 works fine but want to access mydomain.com/index.jsp=0A=0AI=
f you only want that index page there, then just move it under /ROOT/.=0A=
=0ABut if you want the whole of "appexmp1" to be called without the /appexm=
p1/ prefix, then :=0A=0AIn Tomcat itself, it is not complicated, just follo=
w the earlier-mentioned FAQ.=0A(from memory: make a backup of /ROOT/*; dele=
te what is under /ROOT/; move what is in =0A/appexmp1/* to /ROOT/*; delete =
/appexmp1; modify your Context files accordingly; restart =0ATomcat).=0A=0A=
BUT, you are going to have a harder time making the JkMount's work under Ap=
ache httpd.=0ABecause now, you would have to replace this :=0A>> JkMount=A0=
/appexmp1/*=A0 =A0 appexmp1=0Aby this :=0A>> JkMount=A0 /*=A0 =A0 appexm=
p1=0A=0AThat's fine if you still want /appexmp2/* to be forwarded to the ot=
her application.=0ABut if you also want the other application on the other =
tomcat to be ROOT on that tomcat, =0Ayou have a problem, because of course =
you cannot have=0A>> JkMount=A0 /*=A0 =A0 appexmp1=0A>> JkMount=A0 /*=A0 =
=A0 appexmp2=0A=0AThink about it.=A0 Maybe a better way would be to have a=
/index.html under Apache, with =0Alinks to /appexmp1 and /appexmp2 ?=0A=0A=
Also by the way, another little error in your previous setup :=0AIn this :=
=0A>> JkMount=A0 /appexmp1/*=A0 =A0 appexmp1=0A>> JkMount=A0 /appexmp1/*.j=
sp appexmp1=0AIn the first line, you are already forwarding /appexmp1/* any=
way, so the second line is =0Auseless.=0A=0A=0A----------------------------=
-----------------------------------------=0ATo unsubscribe, e-mail: users-u=
nsubscribe@tomcat.apache.org=0AFor additional commands, e-mail: users-help@=
tomcat.apache.org=0A=0AOne of the reasons I have installed stand alone Apac=
he along with Tomcat=0A is =0Amaybe in future use a load balancing feature =
and load balance several =0ATomcats.=0Ado you think linking /index.html to =
/appexmp1 would make problem in tomcat ?=0A=0ABy linking /index.html=A0 to =
/appexmp1, do you mean forwarding by placing=0Afollowing metadata in index.=
html file:=0A<meta http-equiv=3D"Refresh" =0Acontent=3D"5;url=3Dmydomain.co=
m/appexmp1/index.jsp" />=0A=0Aor there are other ways of linking index.html=
to mydomain.com/appexmp1/index.jsp ?
|