First thing to realize is this is not like setting up PHP.  JSPs aren't
meant to live on their own like what you've setup below. 

Consider pointing your tomcat virtual host to /home/username/webapps. 
Then create a folder /home/username named ROOT (case is important here)
and place your .jsp file in it.  Next, add a folder named WEB-INF (case
is still important) under ROOT and then a basic web.xml file in that new
folder.  This is the basic architecture of a web application.

Second, I would HIGHLY recommend you read the servlet spec.  It's not
nearly as dry as reading an IEEE spec and you'll learn a lot about
what's expected of the app as well as the servlet container.

Basic web.xml file:

<?xml version="1.0" encoding="ISO-8859-1"?>

<webapp xmlns="http://java.sun.com/xml/ns/j2ee";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";
version="2.4">

</webapp>

--David

Werner Schalk wrote:

>Hi,
>
>as I have now spend several hours trying to get this work, I am asking for 
>your support guys. But please dare with me as I am a complete newbie to 
>Tomcat.
>
>Basically I installed Tomcat 5.5 and mod_jk 1.2.20 as decribed in 
>http://gentoo-wiki.com/HOWTO_Apache2_and_Tomcat5 and it works fine (the 
>samples work fine when I access them via http://localhost/index.jsp and 
>http://localhost:8080. Now for one of my customers wants to use Tomcat in his 
>Apache virtual host and run .jsp files. Therefore I added the following lines 
>to my httpd.conf:
>
>LoadModule jk_module    modules/mod_jk.so
>JkWorkersFile   conf/jk-workers.properties
>JkLogFile       logs/mod_jk.log
>JkLogLevel      info
>JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
>JkRequestLogFormat "%w %V %T"
>jkAutoAlias /var/lib/tomcat-5/default/webapps/
>jkMount /*.jsp ajp13
>
>Now, my jk-workers.properties file contains:
>
>worker.list=ajp13
>worker.ajp13.port=8009
>worker.ajp13.host=localhost
>worker.ajp13.type=ajp13
>worker.ajp13.lbfactor=1
>worker.ajp13.cachesize=10
>
>Finally here is my server.xml with the new Host section:
>
><Server port="8010" shutdown="XXXXXXXXXXXXXXX" address="127.0.0.1">
>
>  <Service name="Catalina">
>
>    <!-- Define an AJP 1.3 Connector on port 8009 -->
>    <Connector port="8009"  enableLookups="false" protocol="AJP/1.3" 
>address="127.0.0.1"/>
>
>    <Engine name="Catalina" defaultHost="localhost">
>
>      <Host name="localhost" appBase="" unpackWARs="true" autoDeploy="true" 
>xmlValidation="false" xmlNamespaceAware="false">
></Host>
>
>      <Host name="myuser" appBase="/home/username/htdocs" unpackWARs="true" 
>autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
>        <Alias>www.mydomain.com</Alias>
>
>        <Valve className="org.apache.catalina.valves.AccessLogValve"
>                 directory="logs"  prefix="myuser_access_log." suffix=".txt"
>                 pattern="common" resolveHosts="false"/>
>      </Host>
>    </Engine>
>  </Service>
></Server>
>
>Then I created the following "hello world" .jsp file in the htdocs directory 
>of my user (/home/username/htdocs) as defined above:
>
><HTML>
> <HEAD>
>  <TITLE>Hello World</TITLE>
> </HEAD>
> <BODY>
>  <H1>Hello World</H1>
>  Today is: <%= new java.util.Date().toString() %>
> </BODY>
></HTML>
>
>Now the problem is that after restarting both Apache and Tomcat, accessing 
>this file results in a blank page being displayed by the browser (with no 
>content whatsoever). But Tomcat is listening on the ports as defined:
>
># netstat -tunap | grep java
>tcp        0      0 127.0.0.1:8009          0.0.0.0:*               LISTEN     
> 
>17179/java
>tcp        0      0 127.0.0.1:8010          0.0.0.0:*               LISTEN     
> 
>17179/java
>
>And even the log is not really helpful:
>
>(Tomcat log)
>15.01.2007 17:58:35 org.apache.catalina.core.StandardHost start
>INFO: XML validation disabled
>15.01.2007 17:58:35 org.apache.catalina.realm.JAASRealm setContainer
>INFO: Set JAAS app name Catalina
>15.01.2007 17:58:36 org.apache.jk.common.ChannelSocket init
>INFO: JK: ajp13 listening on /127.0.0.1:8009
>15.01.2007 17:58:36 org.apache.jk.server.JkMain start
>INFO: Jk running ID=0 time=0/83  config=null
>15.01.2007 17:58:36 org.apache.catalina.startup.Catalina start
>INFO: Server startup in 1397 ms
>
>Is there anything more I need to do to get this working? What are the mistakes 
>that I made? I have found so much documentation online about Tomcat, but the 
>more I read, the more confused I got. So maybe you guys can shed some light 
>on this... 
>
>Thank you very much.
>
>Best regards,
>Werner
>
>---------------------------------------------------------------------
>To start a new topic, e-mail: users@tomcat.apache.org
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>  
>


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to