Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Apache2/Tomcat5.5 - How to enable vhosts to use .jsp's
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
wschalk
n00b
n00b


Joined: 30 Jan 2005
Posts: 38

PostPosted: Sat Jan 13, 2007 1:19 pm    Post subject: Apache2/Tomcat5.5 - How to enable vhosts to use .jsp's Reply with quote

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
View user's profile Send private message
uweklosa
Tux's lil' helper
Tux's lil' helper


Joined: 18 Feb 2005
Posts: 105

PostPosted: Sat Jan 13, 2007 3:34 pm    Post subject: Reply with quote

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
View user's profile Send private message
wschalk
n00b
n00b


Joined: 30 Jan 2005
Posts: 38

PostPosted: Sun Jan 14, 2007 9:49 am    Post subject: Empty page Reply with quote

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
View user's profile Send private message
wltjr
Retired Dev
Retired Dev


Joined: 31 Jan 2006
Posts: 73

PostPosted: Mon Mar 26, 2007 6:02 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum