View previous topic :: View next topic |
Author |
Message |
wschalk n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 30 Jan 2005 Posts: 38
|
Posted: Sat Jan 13, 2007 1:19 pm Post subject: Apache2/Tomcat5.5 - How to enable vhosts to use .jsp's |
|
|
Hi,
I successfully installed Apache2 (2.0.58-r2), Tomcat 5.5.20-r7 and mod_jk 1.2.0 on my Gentoo box just as described on http://gentoo-wiki.com/HOWTO_Apache2_and_Tomcat5. Now my question is: How do I enable virtual hosts to use their own .jsp files?
The howto says "[ ... ] Then to add jsp capabilities to a virtual host simply add the jkMount command inside the <VirtualHost *:80> tag [ ... ]" so I added the following lines to my virtual host:
LoadModule jk_module modules/mod_jk.so
jkMount /*.jsp ajp13
jkMount /servlet/* ajp13
I restarted both Apache and Tomcat. Then I created an index.jsp file in the htdocs directory (/home/myuser/htdocs) of that virtual host:
<HTML>
<HEAD>
<TITLE>Hello World</TITLE>
</HEAD>
<BODY>
<H1>Hello World</H1>
Today is: <%= new java.util.Date().toString() %>
</BODY>
</HTML>
Now when I access this file, all I get is the default "Tomcat 5.5 works bla" page? So would anyone please tell me how to enable my virtual host to use their own .jsp files?
Thank you & bye,
Werner |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
uweklosa Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 18 Feb 2005 Posts: 105
|
Posted: Sat Jan 13, 2007 3:34 pm Post subject: |
|
|
You have to change the attribute appBase in the host defintinition in the file /etc/tomcat-5.5/server.xml to "/home/myuser/htdocs".
You should read the docs for tomcat. There are several different ways to achieve what you want. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
wschalk n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 30 Jan 2005 Posts: 38
|
Posted: Sun Jan 14, 2007 9:49 am Post subject: Empty page |
|
|
Hi,
okay I changed this and now when I access my test.jsp, a blank page is returned. Any ideas what causes this?
Thank you and bye,
Werner |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
wltjr Retired Dev
![Retired Dev Retired Dev](/images/ranks/rank-retired.gif)
Joined: 31 Jan 2006 Posts: 73
|
Posted: Mon Mar 26, 2007 6:02 pm Post subject: |
|
|
For a vhost you need a few things. Entries in /etc/tomcat-*/server.xml. The blank page is caused by a vhost existing in server.xml but not being configured properly outside of it.
Inside of /etc/tomcat-*/ there is a folder called Catalina /etc/tomcat-*/Catalina. For each vhost you need a directory in /etc/tomcat-*/Catalina/ like /etc/tomcat-*/Catalina/my.vhost.com/
Which inside of it, has the main root context.xml for the site. Usually the file is else where, so I will make a symlink to the file, and the symlink name is ROOT.xml example
/etc/tomcat-*/Catalina/my.vhost.com/ROOT.xml -> /path/to/my/web/META-INF/context.xml.
That will allow the application to fully deploy, and should return the content of the application instead of a blank page. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|