________________________________
 From: Pid * <p...@pidster.com>
To: Tomcat Users List <users@tomcat.apache.org> 
Sent: Sunday, December 4, 2011 11:10:08 PM
Subject: Re: MVC or Model2 with Tomcat
 
On 4 Dec 2011, at 16:17, Blaxton <blaxx...@yahoo.com> wrote:

>
>
>
>
> ________________________________
> From: André Warnier <a...@ice-sa.com>
> To: Tomcat Users List <users@tomcat.apache.org>
> Sent: Sunday, December 4, 2011 6:51:58 PM
> Subject: Re: MVC or Model2 with Tomcat
>
> Blaxton wrote:
>> I have created ROOT directory and placed index.jsp in ROOT directory
>> the same as your example:
>> /path/to/appbase/ROOT/index.jsp    -> myhost.com/index.jsp
>>
>> but that didn't work.
>>
>> I followed following instructions but those didn't work either.
>>
>> http://www.jguru.com/faq/view.jsp?EID=91006
>>
>> http://wiki.apache.org/tomcat/HowTo#How_do_I_make_my_web_application_be_the_Tomcat_default_application.3F
>>
>> is there any thing else I should do to work this out?
>>
>
> I wrote that second faq, but I don't see what it has to do with your problem.
>
> You haven't answered Pid's question :
>
>> Why do you need to do that to implement MVC?
>
> Nor his second question :
>
>> Without more information about your config, e.g. workers.properties it's
>> impossible to tell why this didn't work.
>
> And please, do not top-post.  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.
>
> Also, thank you for providing the versions of Apache httpd and Tomcat 
> up-front.
> But "mod_jk version 2", that does not exist.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>
> My bad, the subject should have been "serving .jsp files from apache document 
> root"
> I just want to access my website as follow:
> www.mydomain.com/index.jsp
>
> the same as the solustion you wrote, but that solustion didn't work for me.
> maybe because in that solution you were talking about
> CATALINA_BASE/webapps/ROOT directory
> and I created CATALINA_BASE/webapps/myapplication/ROOT directory.
>
> can we have ROOT directory for each application ?
> like:
>
> CATALINA_BASE/webapps/ROOT
> CATALINA_BASE/webapps/firstapp/ROOT
> CATALINA_BASE/webapps/secondapp/ROOT

No, you can't. None of the docs day you can.

ROOT is the special name for the default application, which serves
resources from / and handles all requests which are not handled by
other applications.

Putting ROOT inside other apps just results in publishing that whole
dir as /appname/ROOT.

If you don't provide other details of your config, no-one here will be
able to help, without a really, really lucky guess.


p


> anyway, here is the out put of the package query on my FreeBSD box:
> ap22-mo_jk-ap2-1.2.30_1 Apache2 JK module for connecting to Tomcat using AJP1X

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Its a virtual host with following lines have been added to main httpd.conf:
LoadModule jk_module          libexec/apache22/mod_jk.so
JkWorkersFile /usr/local/etc/apache22/workers.properties
JkShmFile     /var/log/mod_jk.shm
JkLogFile     /var/log/mod_jk.log
JkLogLevel   debug 
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "

and following JkMount directives for each virtual host:
JkMount  /appexmp1/*     appexmp1
JkMount  /appexmp1/*.jsp appexmp1

and following is the worker file for two of the sites:
worker.list=appexmp2,appexmp1
worker.appexmp2.type=ajp13
worker.appexmp2.host=localhost
worker.appexmp2.port=8009
worker.appexmp1.type=ajp13
worker.appexmp1.host=localhost
worker.appexmp1.port=8109


Created separate directories in CATALINA_BASE/webapps/
for each application so , it contain following directories:
CATALINA_BASE/webapps/ROOT
CATALINA_BASE/webapps/appexmp1
CATALINA_BASE/webapps/appexmp2

context file for each application resides in 
CATALINA_BASE/conf/Catalina/localhost for example:
CATALINA_BASE/conf/Catalina/localhost/appexmp1.xml
CATALINA_BASE/conf/Catalina/localhost/appexmp2.xml

cat  CATALINA_BASE/conf/Catalina/localhost/appexmp1.xml
<Context path="/appexmp1" docBase="appexmp1" debug="0" reloadable="true" 
crossContext="true">
</Context>

and web.xml file as follow:
cat CATALINA_BASE/webapps/appexmp1/WEB-INF/web.xml
<web-app xmlns="http://java.sun.com/xml/ns/javaee"; version="2.5">
<servlet>
    <servlet-name>App1</servlet-name>
    <servlet-class>com.appexmp1.App1</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>App1</servlet-name>
    <url-pattern>/APP1</url-pattern>
  </servlet-mapping>

  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>

</web-app>


I already can access mydomain.com/App1/index.jsp and every thing works fine
but want to be able to serve .jsp files as follow:
mydomain.com/index.jsp
for each of my virtual hosts.

I hope I have provided enough information.

Thanks for help

Reply via email to