Announcement Announcement Module
Collapse
No announcement yet.
apache 2.2 with mod_jk Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • apache 2.2 with mod_jk

    Hi

    I am having some issues making tcServer work with Apache 2.2.

    To verify my install I checked the Apache 2.2 installation with tomcat 6.0.20 and it worked fine, i just restarted all servers and i was able to connect to tomcat via apache. so tomcat is working fine with apache 2.2

    But this installation doesn't work with tcServer. i have


    My config details are.


    I have installed mod_jk 1.2.28 and have tcServer installed on linux.

    i created worker.prop file under apache2.

    workers.properties
    -----------------
    worker.list=wkr01
    worker.wkr01.type=ajp13
    worker.wkr01.host=localhost
    worker.wkr01.port=8009

    httpd.conf
    -----------
    Include "/usr/local/apache2/conf/mod_jk.conf"

    mod_jk.conf
    -----------
    LoadModule jk_module modules/mod_jk.so
    JkShmFile /usr/local/apache2/logs/jk-runtime-status
    JkLogFile /usr/local/apache2/logs/mod_jk.log
    JkLogLevel debug
    JkWorkersFile /usr/local/apache2/conf/workers.properties
    JkMount /helloWorld wkr01
    <VirtualHost *:80>
    JkMount /helloWorld wkr01
    </VirtualHost>


    i have Connector entry in server.xml on tomcat as.
    server.xml
    -----------
    <Connector port="8009" enableLookups="false" protocol="AJP/1.3" redirectPort="8445" debug="1" />


    Apache is running on port 8079.
    tcServer is running on 8080


    i have helloWorld webapp installed on tcServer under webapps. (I created a new server intance)

    i am able to access helloWorld using tcServer: http://localhost:8080/helloWorld
    I am able to access apache: http://localhost ---> i see 'It works' page come up.

    When i try to access
    http://localhost:8079/helloWorld i am getting this error....



    ...
    ..
    init_jk::mod_jk.c (3183): mod_jk/1.2.28 initialized
    ...
    ...
    ajp_get_endpoint::jk_ajp_common.c (2977): acquired connection pool slot=0 after 0 retries
    ajp_marshal_into_msgb::jk_ajp_common.c (605): ajp marshaling done
    ajp_service::jk_ajp_common.c (2283): processing wkr01 with 2 retries
    ajp_send_request::jk_ajp_common.c (1501): (wkr01) all endpoints are disconnected.
    jk_open_socket::jk_connect.c (452): socket TCP_NODELAY set to On
    jk_open_socket::jk_connect.c (541): timeout 300 set for socket=13
    jk_open_socket::jk_connect.c (576): trying to connect socket 13 to 127.0.0.1:8009
    jk_open_socket::jk_connect.c (594): connect to 127.0.0.1:8009 failed (errno=111)
    ajp_connect_to_endpoint::jk_ajp_common.c (922): Failed opening socket to (127.0.0.1:8009) (errno=111)
    ajp_send_request::jk_ajp_common.c (1507): (wkr01) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=111)
    ajp_service::jk_ajp_common.c (2447): (wkr01) sending request to tomcat failed (recoverable), because of error during request sending (attempt=1)
    ajp_service::jk_ajp_common.c (2304): retry 1, sleeping for 100 ms before retrying


    *** I did a telnet to port 8009 and nothing was running there. I did a netstat as well, nothing running on this port **** Nothing else is running.


    Note: I tested this configuration by replacing tcServer with Tomcat 6.0.20 and it worked without any changes. (I sent to tomcat mailing list with same subject: tomcat6 + apache 2.2 mod_jk - Help‏ )


    Thanks
    Paul

  • #2
    Make sure that your <Connector> element is not commented out. And if it is configured correctly, then you would see

    Sep 21, 2009 6:16:45 PM org.apache.jk.common.ChannelSocket init
    INFO: JK: ajp13 listening on /0.0.0.0:8009

    in the catalina.out/wrapper.log file

    Filip

    Comment


    • #3
      Hi Filip

      It is working now...I had the Connector outside the Service. once i moved it in it was working fine.

      Thanks

      Comment


      • #4
        I am also facing a similar issue. In my case I chekced the server.xml file and the AJP connector is correctly configured.

        I am also able to do telnet to the AJP port. Still i am facing the same problem.

        Please let me know what I could be missing here.

        Comment


        • #5
          I am getting following exception in the catalina.out

          Code:
          Oct 8, 2009 7:58:21 AM org.apache.jk.common.ChannelSocket processConnection
          SEVERE: Error, processing connection
          java.lang.IndexOutOfBoundsException
                  at java.io.BufferedInputStream.read(BufferedInputStream.java:310)
                  at org.apache.jk.common.ChannelSocket.read(ChannelSocket.java:621)
                  at org.apache.jk.common.ChannelSocket.receive(ChannelSocket.java:578)
                  at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:686)
                  at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:891)
                  at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
                  at java.lang.Thread.run(Thread.java:619)
          Oct 8, 2009 8:12:03 AM org.apache.jk.common.MsgAjp processHeader
          SEVERE: BAD packet signature 18245
          Oct 8, 2009 8:12:03 AM org.apache.jk.common.ChannelSocket processConnection
          SEVERE: Error, processing connection
          java.lang.IndexOutOfBoundsException
                  at java.io.BufferedInputStream.read(BufferedInputStream.java:310)
                  at org.apache.jk.common.ChannelSocket.read(ChannelSocket.java:621)
                  at org.apache.jk.common.ChannelSocket.receive(ChannelSocket.java:578)
                  at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:686)
                  at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:891)
                  at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
                  at java.lang.Thread.run(Thread.java:619)
          Oct 8, 2009 8:12:03 AM org.apache.jk.common.MsgAjp processHeader
          SEVERE: BAD packet signature 18245
          Oct 8, 2009 8:12:03 AM org.apache.jk.common.ChannelSocket processConnection
          SEVERE: Error, processing connection
          java.lang.IndexOutOfBoundsException
                  at java.io.BufferedInputStream.read(BufferedInputStream.java:310)
                  at org.apache.jk.common.ChannelSocket.read(ChannelSocket.java:621)
                  at org.apache.jk.common.ChannelSocket.receive(ChannelSocket.java:578)
                  at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:686)
                  at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:891)
                  at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
                  at java.lang.Thread.run(Thread.java:619)
          Oct 8, 2009 8:12:06 AM org.apache.jk.common.MsgAjp processHeader
          SEVERE: BAD packet signature 18245
          Oct 8, 2009 8:12:06 AM org.apache.jk.common.ChannelSocket processConnection
          SEVERE: Error, processing connection
          java.lang.IndexOutOfBoundsException
                  at java.io.BufferedInputStream.read(BufferedInputStream.java:310)
                  at org.apache.jk.common.ChannelSocket.read(ChannelSocket.java:621)
                  at org.apache.jk.common.ChannelSocket.receive(ChannelSocket.java:578)
                  at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:686)
                  at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:891)
                  at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
          EVERE: BAD packet signature Error, processing connection
          I am using Apache 2.2.3, Tomcat 6, JK connector 1.2.28

          Comment


          • #6
            Originally posted by nitingupta183 View Post
            I am getting following exception in the catalina.out

            Code:
            Oct 8, 2009 7:58:21 AM org.apache.jk.common.ChannelSocket processConnection
            SEVERE: Error, processing connection
            java.lang.IndexOutOfBoundsException
                    at java.io.BufferedInputStream.read(BufferedInputStream.java:310)
                    at org.apache.jk.common.ChannelSocket.read(ChannelSocket.java:621)
                    at org.apache.jk.common.ChannelSocket.receive(ChannelSocket.java:578)
                    at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:686)
                    at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:891)
                    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
                    at java.lang.Thread.run(Thread.java:619)
            Oct 8, 2009 8:12:03 AM org.apache.jk.common.MsgAjp processHeader
            SEVERE: BAD packet signature 18245
            Oct 8, 2009 8:12:03 AM org.apache.jk.common.ChannelSocket processConnection
            SEVERE: Error, processing connection
            java.lang.IndexOutOfBoundsException
                    at java.io.BufferedInputStream.read(BufferedInputStream.java:310)
                    at org.apache.jk.common.ChannelSocket.read(ChannelSocket.java:621)
                    at org.apache.jk.common.ChannelSocket.receive(ChannelSocket.java:578)
                    at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:686)
                    at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:891)
                    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
                    at java.lang.Thread.run(Thread.java:619)
            Oct 8, 2009 8:12:03 AM org.apache.jk.common.MsgAjp processHeader
            SEVERE: BAD packet signature 18245
            Oct 8, 2009 8:12:03 AM org.apache.jk.common.ChannelSocket processConnection
            SEVERE: Error, processing connection
            java.lang.IndexOutOfBoundsException
                    at java.io.BufferedInputStream.read(BufferedInputStream.java:310)
                    at org.apache.jk.common.ChannelSocket.read(ChannelSocket.java:621)
                    at org.apache.jk.common.ChannelSocket.receive(ChannelSocket.java:578)
                    at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:686)
                    at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:891)
                    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
                    at java.lang.Thread.run(Thread.java:619)
            Oct 8, 2009 8:12:06 AM org.apache.jk.common.MsgAjp processHeader
            SEVERE: BAD packet signature 18245
            Oct 8, 2009 8:12:06 AM org.apache.jk.common.ChannelSocket processConnection
            SEVERE: Error, processing connection
            java.lang.IndexOutOfBoundsException
                    at java.io.BufferedInputStream.read(BufferedInputStream.java:310)
                    at org.apache.jk.common.ChannelSocket.read(ChannelSocket.java:621)
                    at org.apache.jk.common.ChannelSocket.receive(ChannelSocket.java:578)
                    at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:686)
                    at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:891)
                    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
            EVERE: BAD packet signature Error, processing connection
            I am using Apache 2.2.3, Tomcat 6, JK connector 1.2.28
            This means that Tomcat is not receiving correct AJP packets on the AJP port.
            For example, talking HTTP to Tomcat's AJP connector would yield this.

            best
            Filip

            Comment


            • #7
              Filip,

              I rechecked. Actually i accidentally entered the AJP port from my browser. That gave this exception.

              However, I am still struggling with my earlier issue. AJP connector in my case is not able to connect to the Tomcat AJP port on 8023 (i have configured this value in server.xml). I checked with Telnet and I am able to connect to this port.

              here is the log output of mod_jk

              Code:
               09:09:00 2009] [6239:4009170272] [info] ajp_service::jk_ajp_common.c (2447): (mobivite) sending request to tomcat failed (recoverable), because of error during request sending (attempt=1)
              [Thu Oct 08 09:09:00 2009] [6239:4009170272] [info] jk_open_socket::jk_connect.c (594): connect to 174.120.147.226:8023 failed (errno=13)
              [Thu Oct 08 09:09:00 2009] [6239:4009170272] [info] ajp_connect_to_endpoint::jk_ajp_common.c (922): Failed opening socket to (174.120.147.226:8023) (errno=13)
              [Thu Oct 08 09:09:00 2009] [6239:4009170272] [error] ajp_send_request::jk_ajp_common.c (1507): (mobivite) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=13)
              [Thu Oct 08 09:09:00 2009] [6239:4009170272] [info] ajp_service::jk_ajp_common.c (2447): (mobivite) sending request to tomcat failed (recoverable), because of error during request sending (attempt=2)
              [Thu Oct 08 09:09:00 2009] [6239:4009170272] [error] ajp_service::jk_ajp_common.c (2466): (mobivite) connecting to tomcat failed.
              [Thu Oct 08 09:09:00 2009] mobivite www.mobivite.in 0.100692
              [Thu Oct 08 09:09:00 2009] [6239:4009170272] [info] jk_handler::mod_jk.c (2615): Service error=-3 for worker=mobivite

              Comment


              • #8
                Can u post the server.xml mod_jk.conf and httpd.conf ?

                Comment


                • #9
                  Please find the files attached with this post

                  Comment


                  • #10
                    Please see this attachment, i missed server.xml in the older one.

                    Comment


                    • #11
                      Hey Paul,

                      Did you get a chance to look into this problem? I attached the files which you asked.

                      Request you to please help here as I am still stuck with this issue.

                      Comment


                      • #12
                        is Tomcat and httpd on the same server, that's what you have configured right now in your worker.properties

                        what do the logs file say now?

                        Comment


                        • #13
                          Yes, both are on same machine. I have attached the logs file as well in my previous post. Logs are still the same.

                          Comment


                          • #14
                            {code}
                            [Thu Oct 08 10:59:20 2009] [935:2785330528] [debug] jk_open_socket::jk_connect.c (576): trying to connect socket 21 to 127.0.0.1:8023
                            [Thu Oct 08 10:59:20 2009] [935:2785330528] [info] jk_open_socket::jk_connect.c (594): connect to 127.0.0.1:8023 failed (errno=13)
                            [Thu Oct 08 10:59:20 2009] [935:2785330528] [info] ajp_connect_to_endpoint::jk_ajp_common.c (922): Failed opening socket to (127.0.0.1:8023) (errno=13)
                            {code}

                            still shows that it cant connect.

                            Comment


                            • #15
                              Originally posted by fhanik View Post
                              {code}
                              [Thu Oct 08 10:59:20 2009] [935:2785330528] [debug] jk_open_socket::jk_connect.c (576): trying to connect socket 21 to 127.0.0.1:8023
                              [Thu Oct 08 10:59:20 2009] [935:2785330528] [info] jk_open_socket::jk_connect.c (594): connect to 127.0.0.1:8023 failed (errno=13)
                              [Thu Oct 08 10:59:20 2009] [935:2785330528] [info] ajp_connect_to_endpoint::jk_ajp_common.c (922): Failed opening socket to (127.0.0.1:8023) (errno=13)
                              {code}

                              still shows that it cant connect.
                              What I should have said, is that this is a basic error. mod_jk is unable to open a connection. There is nothing in the Tomcat or httpd config files that fixes this. Most likely your Tomcat is not up and running or you got some other networking snafu going on on your system.

                              Comment

                              Working...
                              X