Hello!

I am trying to execute JSP with apache.I am working on FedoraCore-4 and have tomcat5, apache2 and mod_jk already installed.

Apache and tomcat are working fine, but when i try connect them using mod_jk i don't get the correct execution of pages.

For Examples, if i execute http://localhost/jsp-examples/dates/date.jsp, i get the following result:

Code:
<%@ page session="false"%>

    * Day of month: is
    * Year: is
    * Month: is
    * Time: is
    * Date: is
    * Day: is
    * Day Of Year: is
    * Week Of Year: is
    * era: is
    * DST Offset: is
    * Zone Offset: is
, while if i execute the same example as http://localhost:8080/jsp-examples/dates/date.jsp, the results are:

Code:
#  Day of month: is 3
# Year: is 2006
# Month: is July
# Time: is 17:24:20
# Date: is 7/3/2006
# Day: is Monday
# Day Of Year: is 184
# Week Of Year: is 27
# era: is 1
# DST Offset: is 1
# Zone Offset: is 5
I have made the following additions to the files.
1. httpd.conf:

Code:
Include conf.d/*.conf

<IfModule mod_jk.c>
   JkWorkersFile "/etc/httpd/conf/workers.properties"
   JkLogFile "/var/log/mod_jk.log"
</IfModule>

<IfModule mod_jk.c>
     Alias /jsp-examples "/usr/share/tomcat5/webapps/jsp-examples"

     <Directory "/usr/share/tomcat5/webapps/jsp-examples">
         Options Indexes FollowSymLinks
         DirectoryIndex index.jsp index.html index.html
     </Directory>

     <Location "/jsp-examples/WEB-INF/*">
         AllowOverride None
         deny from all
     </Location>

</IfModule>
2. I have created workers.properties in /etc/httpd/conf, containing:

Code:
workers.tomcat_home=/usr/share/tomcat5
workers.java_home=/usr/java/jdk1.5.0
ps=/
worker.list=default

worker.default.port=8009
worker.default.host=localhost
worker.default.type=ajp13
worker.default.lbfactor=1
3. The jk2.properties is all commented file.

4. The server.xml file is:

Code:
<Server port="8005" shutdown="SHUTDOWN" debug="0">
 
 <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"
            debug="0"/>
 <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
            debug="0"/>

 <!-- Global JNDI resources -->
 <GlobalNamingResources>

    <!-- Test entry for demonstration purposes -->
    <Environment name="simpleValue" type="java.lang.Integer" value="30"/>

    <!-- Editable user database that can also be used by
    UserDatabaseRealm to authenticate users -->
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
              description="User database that can be updated and saved">
    </Resource>

    <ResourceParams name="UserDatabase">
      <parameter>
        <name>factory</name>
        <value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
      </parameter>
      <parameter>
        <name>pathname</name>
        <value>conf/tomcat-users.xml</value>
      </parameter>
    </ResourceParams>

 </GlobalNamingResources>

<!-- Define the Tomcat Stand-Alone Service -->
  <Service name="Catalina">

<!-- Define a non-SSL Coyote HTTP/1.1 Connector on port 8080 -->
    <Connector port="8080"
               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" redirectPort="8443" acceptCount="100"
               debug="0" connectionTimeout="20000"
               disableUploadTimeout="true" />

    <Connector port="8443"
               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" disableUploadTimeout="true"
               acceptCount="100" debug="0" scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS" />

    <!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 -->
    <Connector port="8009"
               enableLookups="false" redirectPort="8443" debug="0"
               protocol="AJP/1.3" />

    <!-- Define the top level container in our container hierarchy -->
    <Engine name="Catalina" defaultHost="localhost" debug="0">

    <!-- Global logger unless overridden at lower levels -->
    <Logger className="org.apache.catalina.logger.FileLogger"
              prefix="catalina_log." suffix=".txt"
              timestamp="true"/>

     <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
                 debug="0" resourceName="UserDatabase"/>

     <Host name="localhost" debug="0" appBase="webapps"
       unpackWARs="true" autoDeploy="true"
       xmlValidation="false" xmlNamespaceAware="false">

      <Context path="/jsp-examples" docBase="jsp-examples" debug="0"     
                     reloadable="true"/>

      <Valve className="org.apache.catalina.valves.AccessLogValve"
                 directory="logs"  prefix="localhost_access_log." suffix=".txt"
                 pattern="common" resolveHosts="false"/>

     <Logger className="org.apache.catalina.logger.FileLogger"
                 directory="logs"  prefix="localhost_log." suffix=".txt"
                 timestamp="true"/>

     </Host>
   </Engine>
 </Service>
</Server>
I have tried several tutorials and solutions on web, but didn't achieved the results.May be anyone can locate from these files what's the exact problem or what needs to be added.