Welcome Guest. Sign in or Signup

8 Answers

Linux, Apache and Tomcat..

Asked by: sanderson 1068 views Software

Guys,
I completed the installs for apache2, Tomcat5 and the mod_jk connector.
I think I got it correct as I can now run “HelloWorld.jsp” form both port 8080 and 80 fine.

When I try to update server.xml via the linux instructions It fails to find, untar Advertpro.war. I then ofcourse get 404 error.

I am tomcat illerate so not sure how best to setup server.xml and what needs to be there to get this to function. Do I add the the config lines given in the linux helpdoc or do I replace server.xml with that info?

Kinda at a loss any help would be great.
Thanks
Shannon

8 Answers



  1. on Jun 01, 2006

    The best thing to do is just replace the server.xml file with the one from the installation instructions. That config only loads the bare essential parts of Tomcat for running AdvertPRO. The only change you’ll need to make to it since you’re using mod_jk is to uncomment the for mod_jk, which is noted with a comment in the config file.

    If you can’t get the .war file to unpack, and I actually prefer to do it this way, is to use the jar command to unpack it while Tomcat is not running:

    mkdir /usr/local/tomcat/webapps/advertpro
    mv advertpro.war /usr/local/tomcat/webapps/advertpro
    cd /usr/local/tomcat/webapps/advertpro
    jar -xf advertpro.war
    rm -f advertpro.war

    If the jar command does not work, run these two commands:

    export JAVA_HOME=/usr/java/jdk1.5.0_07
    export PATH=$PATH:$JAVA_HOME/bin

    Just make sure /usr/java/jdk1.5.0_07 is where the JDK was installed.

    0 Votes Thumb up 0 Votes Thumb down 0 Votes



  2. sanderson on Jun 02, 2006

    New error, 404 is gone but now a server 500 error is up..

    Ok got it unpacked and updated the server.xml file so only what is show in “how-to” is in server.xml -changed “localhost” to “linux-web1.ecalton.com”.

    here is my httpd.conf for the tomcat service

    LoadModule jk_module “/usr/lib/httpd/modules/mod_jk.so”

    JkWorkersFile “/etc/httpd/conf/workers.properties”
    JkLogFile “/usr/local/tomcat/logs/mod_jk.log”

    JkLogLevel emerg


    ServerName linux-web1.ecalton.com

    JkMount /webdav ajp13
    JkMount /webdav/* ajp13

    JkMount /servlets-examples ajp13
    JkMount /servlets-examples/* ajp13

    JkMount /balancer ajp13
    JkMount /balancer/* ajp13

    JkMount /jsp-examples ajp13
    JkMount /jsp-examples/* ajp13

    JkMount /host-manager ajp13
    JkMount /host-manager/* ajp13

    JkMount /tomcat-docs ajp13
    JkMount /tomcat-docs/* ajp13

    JkMount /manager ajp13
    JkMount /manager/* ajp13

    JkMount /advertpro ajp13
    JkMount /advertpro/* ajp13

    Here is workers.properties file

    # Define 1 real worker using ajp13
    worker.list=worker1
    # Set properties for worker1 (ajp13) worker.worker1.type=ajp13
    worker.worker1.host=localhost
    worker.worker1.port=8009
    worker.worker1.lbfactor=50
    worker.worker1.cachesize=10
    worker.worker1.cache_timeout=600
    worker.worker1.socket_keepalive=1
    worker.worker1.recycle_timeout=300

    Any ideas?

    0 Votes Thumb up 0 Votes Thumb down 0 Votes



  3. on Jun 02, 2006

    Actually, try using “localhost” instead of “linux-web1.ecalton.com” in the server.xml file because Tomcat is not going to be directly accessed.

    This is how I usually configure everything in httpd.conf:


    LoadModule jk_module “/usr/lib/httpd/modules/mod_jk.so”


    JkWorkersFile “/etc/httpd/conf/workers.properties”
    JkLogFile “/usr/local/tomcat/logs/mod_jk.log”


    ServerName linux-web1.ecalton.com


    Alias /advertpro “/usr/local/tomcat/webapps/advertpro”


    Options Indexes FollowSymLinks
    DirectoryIndex index.jsp index.html index.htm


    AllowOverride None
    deny from all


    AllowOverride None
    deny from all

    JkMount /advertpro/backup/* ajp13w
    JkMount /advertpro/config/* ajp13w
    JkMount /advertpro/files/* ajp13w
    JkMount /advertpro/logs/* ajp13w
    JkMount /advertpro/servlet/* ajp13w
    JkMount /advertpro/sql/* ajp13w
    JkMount /advertpro/temp/* ajp13w
    JkMount /advertpro/*.jsp ajp13w

    And in the workers.properties file:

    worker.list=ajp13w
    worker.ajp13w.port=8009
    worker.ajp13w.host=localhost
    worker.ajp13w.type=ajp13

    Note that you can, and probably want to, delete the webdav, servlets-examples, jsp-examples, and tomcat-docs applications from the webapps directory. You don’t absolutely need to enable access to the host-manager or manager applications, but do not delete those. Configuring and even reloading AdvertPRO can be done from within the AdvertPRO control panel.

    If those settings don’t work, check the Apache error_log as well as the catalina.out and mod_jk.log in the Tomcat logs directory for errors.

    0 Votes Thumb up 0 Votes Thumb down 0 Votes



  4. sanderson on Jun 02, 2006

    Made the changes, Still get 500 error

    Checked logs and looks like we have a port issue..

    #####MOD_JK.Log######

    [Fri Jun 02 09:50:49 2006] [jk_uri_worker_map.c (445)]: Into jk_uri_worker_map_t::map_uri_to_worker
    [Fri Jun 02 09:50:49 2006] [jk_uri_worker_map.c (459)]: Attempting to map URI ‘/advertpro/servlet/setup’
    [Fri Jun 02 09:50:49 2006] [jk_uri_worker_map.c (483)]: jk_uri_worker_map_t::map_uri_to_worker, Found a context match ajp13w -> /advertpro/servlet/
    [Fri Jun 02 09:50:49 2006] [mod_jk.c (1689)]: Into handler r->proxyreq=0 r->handler=jakarta-servlet r->notes=153495536 worker=ajp13w
    [Fri Jun 02 09:50:49 2006] [jk_worker.c (90)]: Into wc_get_worker_for_name ajp13w
    [Fri Jun 02 09:50:49 2006] [jk_worker.c (94)]: wc_get_worker_for_name, done found a worker
    [Fri Jun 02 09:50:49 2006] [mod_jk.c (472)]: agsp=80 agsn=linux-web1.ecalton.com hostn=linux-web1.ecalton.com shostn=linux-web1.ecalton.com cbsport=0 sport=0
    [Fri Jun 02 09:50:49 2006] [jk_ajp_common.c (1741)]: Into jk_worker_t::get_endpoint
    [Fri Jun 02 09:50:49 2006] [jk_ajp_common.c (1367)]: Into jk_endpoint_t::service
    [Fri Jun 02 09:50:49 2006] [jk_ajp_common.c (257)]: Into ajp_marshal_into_msgb
    [Fri Jun 02 09:50:49 2006] [jk_ajp_common.c (425)]: ajp_marshal_into_msgb – Done
    [Fri Jun 02 09:50:49 2006] [jk_connect.c (136)]: Into jk_open_socket
    [Fri Jun 02 09:50:49 2006] [jk_connect.c (143)]: jk_open_socket, try to connect socket = 36 to 127.0.0.1:8009
    [Fri Jun 02 09:50:49 2006] [jk_connect.c (159)]: jk_open_socket, after connect ret = -1
    [Fri Jun 02 09:50:49 2006] [jk_connect.c (188)]: jk_open_socket, connect() failed errno = 111
    [Fri Jun 02 09:50:49 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 = 111
    [Fri Jun 02 09:50:49 2006] [jk_ajp_common.c (1024)]: Error connecting to the Tomcat process.
    [Fri Jun 02 09:50:49 2006] [jk_ajp_common.c (1468)]: sending request to tomcat failed in send loop. err=0

    ####Catalina.Out####################

    [Fri Jun 02 09:50:49 2006] [jk_uri_worker_map.c (445)]: Into jk_uri_worker_map_t::map_uri_to_worker
    [Fri Jun 02 09:50:49 2006] [jk_uri_worker_map.c (459)]: Attempting to map URI ‘/advertpro/servlet/setup’
    [Fri Jun 02 09:50:49 2006] [jk_uri_worker_map.c (483)]: jk_uri_worker_map_t::map_uri_to_worker, Found a context match ajp13w -> /advertpro/servlet/
    [Fri Jun 02 09:50:49 2006] [mod_jk.c (1689)]: Into handler r->proxyreq=0 r->handler=jakarta-servlet r->notes=153495536 worker=ajp13w
    [Fri Jun 02 09:50:49 2006] [jk_worker.c (90)]: Into wc_get_worker_for_name ajp13w
    [Fri Jun 02 09:50:49 2006] [jk_worker.c (94)]: wc_get_worker_for_name, done found a worker
    [Fri Jun 02 09:50:49 2006] [mod_jk.c (472)]: agsp=80 agsn=linux-web1.ecalton.com hostn=linux-web1.ecalton.com shostn=linux-web1.ecalton.com cbsport=0 sport=0
    [Fri Jun 02 09:50:49 2006] [jk_ajp_common.c (1741)]: Into jk_worker_t::get_endpoint
    [Fri Jun 02 09:50:49 2006] [jk_ajp_common.c (1367)]: Into jk_endpoint_t::service
    [Fri Jun 02 09:50:49 2006] [jk_ajp_common.c (257)]: Into ajp_marshal_into_msgb
    [Fri Jun 02 09:50:49 2006] [jk_ajp_common.c (425)]: ajp_marshal_into_msgb – Done
    [Fri Jun 02 09:50:49 2006] [jk_connect.c (136)]: Into jk_open_socket
    [Fri Jun 02 09:50:49 2006] [jk_connect.c (143)]: jk_open_socket, try to connect socket = 36 to 127.0.0.1:8009
    [Fri Jun 02 09:50:49 2006] [jk_connect.c (159)]: jk_open_socket, after connect ret = -1
    [Fri Jun 02 09:50:49 2006] [jk_connect.c (188)]: jk_open_socket, connect() failed errno = 111
    [Fri Jun 02 09:50:49 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 = 111
    [Fri Jun 02 09:50:49 2006] [jk_ajp_common.c (1024)]: Error connecting to the Tomcat process.
    [Fri Jun 02 09:50:49 2006] [jk_ajp_common.c (1468)]: sending request to tomcat failed in send loop. err=0

    I am assuming that I have tomcat “server.xml” wrong.

    #########server.xml############
    debug=”0″
    port=”8005″
    shutdown=”SHUTDOWN”>

    debug=”0″/> debug=”0″/> debug=”0″/>


    auth=”Container”
    type=”org.apache.catalina.UserDatabase”
    description=”User database that can be updated and saved”
    factory=”org.apache.catalina.users.MemoryUserDatabaseFactory”
    pathname=”conf/tomcat-users.xml”/>

    debug=”0″
    name=”Catalina”>