Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19
Tomcat5, Apache2 and mod_jk!
Results 1 to 7 of 7

Thread: Tomcat5, Apache2 and mod_jk!

Hybrid View

  1. #1
    Member honey bee's Avatar
    Join Date
    Feb 2006
    Location
    Pakistan
    Posts
    146

    Question Tomcat5, Apache2 and mod_jk!

    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.

  2. #2
    Hi

    I too had the same problem... then i inside the virtual host container... have configured like the below items...

    Inside the virtual Host container... (uncomment those items which are required..)

    # JkMount /* ajp13
    # JkMount /jsp-page/* ajp13
    # JkMount //* ajp13
    JkMount /jspwebpages/* ajp13
    # JkMount /pages/* ajp13
    # JkMount /trial/* ajp13
    JkMount /web/* ajp13

    Then restart the apache server... (no need for tomcat)
    Then it shud work...

    I did the same thing some months backk... using centos + tomcat + apache.
    Your other configurations are fine and i think suitable...

    Try this method....
    Regards
    Arun

  3. #3
    Member honey bee's Avatar
    Join Date
    Feb 2006
    Location
    Pakistan
    Posts
    146

    Question

    Hello!

    Thanks a lot for your reply .I have added these lines to the file, but still i am not getting the correct result.

    I have placed the jsp-examples folder to my hosts document root.Now i have added the lines to host like this:

    <VirtualHost 192.168.0.3:80>
    ServerName hinahayat.com
    DocumentRoot "/webspace/hinahayat.com/docs/html"
    JkMount /jsp-examples/* default
    </VirtualHost>
    and i also tried this:

    <VirtualHost 192.168.0.3:80>
    ServerName hinahayat.com
    DocumentRoot "/webspace/hinahayat.com/docs/html"

    <IfModule mod_jk.c>
    Alias /html "/webspace/hinahayat.com/docs/html"

    <Directory "/webspace/hinahayat.com/docs/html">
    Options Indexes FollowSymLinks
    DirectoryIndex index.jsp index.html index.html
    </Directory>

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

    JkMount /html/jsp-examples/* default
    </IfModule>
    </VirtualHost>
    , but still i am not getting any results.Similarly, when i try to execute the pages through the localhost the results aren't correct.

  4. #4
    Member honey bee's Avatar
    Join Date
    Feb 2006
    Location
    Pakistan
    Posts
    146

    Unhappy

    Ok,

    In my httpd.conf i have added:

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

    JkLogLevel info
    JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "

    JkOptions +ForwardKeySize +ForwardURICompat +ForwardDirectories
    JkRequestLogFormat "%w %V %T"

    JkMount /jsp-examples/servlet/* default
    JkMount /jsp-examples/*.jsp default

    </IfModule>
    and this to my virtual host:

    <VirtualHost 192.168.0.3:80>
    ServerName hinahayat.com
    DocumentRoot "/webspace/hinahayat.com/docs/html"

    <IfModule mod_jk.c>
    Alias /html "/webspace/hinahayat.com/docs/html"

    <Directory "/webspace/hinahayat.com/docs/html">
    Options Indexes FollowSymLinks
    DirectoryIndex index.jsp index.html index.html
    </Directory>

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

    JkMount /*.jsp default
    </IfModule>
    </VirtualHost>
    my jsp pages open when i try to execute the page, but don't shows the correct result ann in my mod_jk.log i have the following errors when my localhost execurtes page:

    [Tue Jul 04 17:48:21 2006] [jk_connect.c (188)]: jk_open_socket, connect() failed errno = 13
    [Tue Jul 04 17:48:21 2006] [jk_ajp_common.c (720)]: Error connecting to tomcat. Tomcat is probably not started or is listening on the wrong host/port (127.0.0.1:8009). Failed errno = 13
    [Tue Jul 04 17:48:21 2006] [jk_ajp_common.c (1024)]: Error connecting to the Tomcat process.
    [Tue Jul 04 17:48:21 2006] [jk_ajp_common.c (1468)]: sending request to tomcat failed in send loop. err=0
    [Tue Jul 04 17:48:21 2006] [jk_connect.c (188)]: jk_open_socket, connect() failed errno = 13
    [Tue Jul 04 17:48:21 2006] [jk_ajp_common.c (720)]: Error connecting to tomcat. Tomcat is probably not started or is listening on the wrong host/port (127.0.0.1:8009). Failed errno = 13
    [Tue Jul 04 17:48:21 2006] [jk_ajp_common.c (1024)]: Error connecting to the Tomcat process.
    [Tue Jul 04 17:48:21 2006] [jk_ajp_common.c (1468)]: sending request to tomcat failed in send loop. err=1
    [Tue Jul 04 17:48:21 2006] [jk_connect.c (188)]: jk_open_socket, connect() failed errno = 13
    [Tue Jul 04 17:48:21 2006] [jk_ajp_common.c (720)]: Error connecting to tomcat. Tomcat is probably not started or is listening on the wrong host/port (127.0.0.1:8009). Failed errno = 13
    [Tue Jul 04 17:48:21 2006] [jk_ajp_common.c (1024)]: Error connecting to the Tomcat process.
    [Tue Jul 04 17:48:21 2006] [jk_ajp_common.c (1468)]: sending request to tomcat failed in send loop. err=2
    [Tue Jul 04 17:48:21 2006] [jk_ajp_common.c (1477)]: Error connecting to tomcat. Tomcat is probably not started or is listening on the wrong port. worker=default failed errno = 13
    [Tue Jul 04 17:48:21 2006] default localhost 0.002482
    and the following errors when host executes the page:

    [Tue Jul 04 17:51:00 2006] [jk_connect.c (188)]: jk_open_socket, connect() failed errno = 13
    [Tue Jul 04 17:51:00 2006] [jk_ajp_common.c (720)]: Error connecting to tomcat. Tomcat is probably not started or is listening on the wrong host/port (127.0.0.1:8009). Failed errno = 13
    [Tue Jul 04 17:51:00 2006] [jk_ajp_common.c (1024)]: Error connecting to the Tomcat process.
    [Tue Jul 04 17:51:00 2006] [jk_ajp_common.c (1468)]: sending request to tomcat failed in send loop. err=0
    [Tue Jul 04 17:51:00 2006] [jk_connect.c (188)]: jk_open_socket, connect() failed errno = 13
    [Tue Jul 04 17:51:00 2006] [jk_ajp_common.c (720)]: Error connecting to tomcat. Tomcat is probably not started or is listening on the wrong host/port (127.0.0.1:8009). Failed errno = 13
    [Tue Jul 04 17:51:00 2006] [jk_ajp_common.c (1024)]: Error connecting to the Tomcat process.
    [Tue Jul 04 17:51:00 2006] [jk_ajp_common.c (1468)]: sending request to tomcat failed in send loop. err=1
    [Tue Jul 04 17:51:00 2006] [jk_connect.c (188)]: jk_open_socket, connect() failed errno = 13
    [Tue Jul 04 17:51:00 2006] [jk_ajp_common.c (720)]: Error connecting to tomcat. Tomcat is probably not started or is listening on the wrong host/port (127.0.0.1:8009). Failed errno = 13
    [Tue Jul 04 17:51:00 2006] [jk_ajp_common.c (1024)]: Error connecting to the Tomcat process.
    [Tue Jul 04 17:51:00 2006] [jk_ajp_common.c (1468)]: sending request to tomcat failed in send loop. err=2
    [Tue Jul 04 17:51:00 2006] [jk_ajp_common.c (1477)]: Error connecting to tomcat. Tomcat is probably not started or is listening on the wrong port. worker=default failed errno = 13
    Now, plz help me with this.What needs to be done to solve it out?

  5. #5
    Hi,

    I did the mod_jk some months backkk....

    so i am not able to give you any options immediately...

    I have my document, which describes how it worked... which i used to refer.. often...(at that time)
    I put that doc under this place also....
    http://rhcenotes.blogspot.com/2006/0...tegration.html

    Apache tomcat integration using mod_jk


    Install apache and make it work.
    (Make sure apache is running on Virtual Host Container)
    Make sure tomcat can be started/stopped using scripts
    Make sure tomcat is running on port 4000 or 8080 (if jboss is not running on port 8080)
    Get the rpm file for mod_jk (mod_jk-1.2.6-3jpp_4fc.i386) (or for AMD 64 bit OS)
    Stop Both Apache and Tomcat
    Install the rpm mod_jk-1.2.6-3jpp_4fc.i386
    Check whether you have the file mod_jk.so under the folder /etc/httpd/modules/
    Edit the file /etc/httpd/conf/httpd.conf and include an entry "LoadModule jk_module modules/mod_jk.so" under LoadModule category. (These lines lists all the available modules for the apache server.
    Under $TomcatHome/conf create a folder called auto and copy the mod_jk.conf inside this folder. (Get mod_jk.conf by running $rpm -ql mod_jk and subsequent mod_jk.conf.sample file. ($TomcatHome/conf/auto/mod_jk.conf)
    Edit mod_jk.conf file and make sure the following entries are fine.
    LoadModule jk_module modules/mod_jk.so
    JkWorkersFile /etc/httpd/conf/jk/workers.properties
    JkLogFile logs/mod_jk.log
    (make sure they have the correct path)


    Create a folder under $TomcatHome/conf/jk
    Copy workers.properties.sample from installation(rpm -ql) and put it here in $TomcatHome/conf/jk/workers.properties

    Edit the workers.properties file and make sure the following are edited properly.
    workers.tomcat_home=/usr/local/tomcat
    workers.java_home=/usr/java/jdk

    do not edit anything else.

    go to $TOMCATHOME/conf/ and
    cp server.xml server.xml.original
    cp server-minimal.xml server.xml

    Edit the file server.xml and make the port to be 4000

    <Service name="Catalina">
    <Connector port="4000" />

    tomcat part is over..


    Just before the Section 3 : Virtual Host container --- add the following three lines..

    JkWorkersFile "/usr/local/tomcat/conf/jk/workers.properties"
    #JkLogFile "/usr/local/tomcat/logs/mod_jk.log"
    #JkLogLevel info
    JkLogStampFormat "[%a %b %d %H %M:%S %Y]"

    Which tells the location of workers.properties file for apache.

    Inside the virtual Host container...

    # JkMount /* ajp13
    # JkMount /firstwebapp/* ajp13
    # JkMount /webapp2/* ajp13
    JkMount /webapp3/* ajp13
    # JkMount /webapp4/* ajp13
    # JkMount /web/* ajp13
    JkMount /webr/* ajp13


    service httpd start
    service tomcat start

    access apache by
    http://localhost/

    and tomcat containers by

    http://localhost/webapps/

  6. #6
    I used CentOS 4.2 + Apache 2.2 + Tomcat 5.0.18 under a AMD 64 bit processor.

Similar Threads

  1. Apache2.2 + PHP = foobar
    By Kernel_Killer in forum Ubuntu / Debian
    Replies: 2
    Last Post: 10-25-2006, 06:22 AM
  2. Default How to turn on SSL support for Apache2
    By Compunuts in forum Linux - Hardware, Networking & Security
    Replies: 0
    Last Post: 09-15-2006, 07:55 AM
  3. Error in mod_jk.log!(Tomcat5 & Aapche2)
    By honey bee in forum Linux - Hardware, Networking & Security
    Replies: 2
    Last Post: 09-14-2006, 12:40 AM
  4. Apache2,Tomcat5 and mod_jk2
    By honey bee in forum Linux - Hardware, Networking & Security
    Replies: 2
    Last Post: 07-10-2006, 12:40 PM
  5. Apache2 and throttleing
    By Freakazoid in forum Linux - Hardware, Networking & Security
    Replies: 4
    Last Post: 06-18-2002, 04:00 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •