tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pid <...@pidster.com>
Subject Re: MVC or Model2 with Tomcat
Date Mon, 05 Dec 2011 10:40:19 GMT

>> 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-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@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>

path & docBase are surplus to requirements here.  debug is no longer
functional.



> 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.

If the ROOT application is just a default one, you can remove it.
You will need a separate appBase for each virtual host.

In server.xml, define multiple hosts, with _separate_ appBase's:

 <Host name="hostexmp1" appBase="/path/to/host1/appBase" ... >
 </Host>

 <Host name="hostexmp2" appBase="/path/to/host2/appBase" ... >
 </Host>

copy appexmp1 and appexmp2 into the appBase & rename them 'ROOT'.
Your app is now the default app in each host, so in each HTTPD virtual
host, add:

 JkMount  /*     appexmp1



p




-- 

[key:62590808]


Mime
View raw message