Apache-Tomcat Servlet Mapping Issues
System: Solaris SunOS 5.9 Apache: 2.0.52 Tomcat: 4.1.31 Mod JK: 1.2.6 The problem: Apache/mod_jk cannot resolve servlet URL mappings When Tomcat is running stand-alone, it can resolve servlet mappings without any problems; so that a page with this form definition: FORM name=login method=POST action=loginhandler correctly invokes the com.company.LoginHandler servlet (which suggests there's nothing syntactically wrong with the servlet and servlet-mapping entries in web.xml); When Tomcat stand-alone is turned off and Apache is turned on, that same page always throws a 404 error for site/loginhandler; these are the error messages in mod_jk.log: [Wed Jun 22 09:04:08 2005] [mod_jk.c (2313)]: mod_jk::jk_translate, check alias_dir: /usr/apache/tomcat/webapps [Wed Jun 22 09:04:08 2005] [mod_jk.c (2337)]: mod_jk::jk_translate, AutoAlias child_dir: loginhandler [Wed Jun 22 09:04:08 2005] [mod_jk.c (2363)]: mod_jk::jk_translate, AutoAlias OK for file: /usr/apache/tomcat/webapps/aiwosc/loginhandler [Wed Jun 22 09:04:08 2005] [jk_uri_worker_map.c (445)]: Into jk_uri_worker_map_t::map_uri_to_worker [Wed Jun 22 09:04:08 2005] [jk_uri_worker_map.c (459)]: Attempting to map URI '/aiwosc/loginhandler' [Wed Jun 22 09:04:08 2005] [jk_uri_worker_map.c (577)]: jk_uri_worker_map_t::map_uri_to_worker, done without a match What terribly simple configuration error have I made here? These are the web.xml entries for this servlet: servlet servlet-nameloginhandler/servlet-name servlet-classcom.company.aiwosc.LoginHandler/servlet-class /servlet servlet-mapping servlet-nameloginhandler/servlet-name url-pattern/loginhandler/url-pattern /servlet-mapping This is the workers.properties file: worker.list=ajp13 worker.ajp13.port=8009 worker.ajp13.host=server.org worker.ajp13.type=ajp13 This is the app section from mod_jk.conf: server.org:/aiwosc # Static files Alias /aiwosc /var/apache/tomcat/webapps/aiwosc Directory /var/apache/tomcat/webapps/aiwosc Options Indexes FollowSymLinks DirectoryIndex index.html /Directory # Deny direct access to WEB-INF and META-INF # Location /aiwosc/WEB-INF/* AllowOverride None deny from all /Location Location /aiwosc/META-INF/* AllowOverride None deny from all /Location JkMount /aiwosc/addtitleservlet ajp13 JkMount /aiwosc/submittitleservlet ajp13 JkMount /aiwosc/transfertitleservlet ajp13 JkMount /aiwosc/saveoscservlet ajp13 JkMount /aiwosc/reordercastservlet ajp13 JkMount /aiwosc/loginhandler ajp13 JkMount /aiwosc/editcategoryservlet ajp13 JkMount /aiwosc/edittitleservlet ajp13 JkMount /aiwosc/addaddendumservlet ajp13 JkMount /aiwosc/*.jsp ajp13 JkMount /aiwosc/addcategoryservlet ajp13 This is the Context entry for the app in server.xml: !-- Oscars OSC Context -- Context path=/aiwosc docBase=aiwosc debug=5 reloadable=true crossContext=true Logger className=org.apache.catalina.logger.FileLogger prefix=aiwosc_log. suffix=.txt timestamp=true/ Resource name=jdbc/oscars auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/oscars parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namedriverClassName/name valueoracle.jdbc.driver.OracleDriver/value /parameter parameter nameurl/name valuejdbc:oracle:thin:@gtsora2.gtsgraphics.com:1521:ACAD/value /parameter parameter nameusername/name valueIMPC_ADMIN/value /parameter parameter namepassword/name valuePIRANHA/value /parameter parameter namemaxActive/name value20/value /parameter parameter namemaxIdle/name value10/value /parameter parameter namemaxWait/name value-1/value /parameter /ResourceParams /Context And these are the mod_jk load/configuration entries from httpd.conf: IfModule !mod_jk.c LoadModule jk_module modules/mod_jk.so /IfModule Include /usr/apache/tomcat/conf/auto/mod_jk.conf JkWorkersFile /usr/apache/tomcat/conf/workers.properties JkLogFile /usr/apache/logs/mod_jk.log JkLogLevel debug JkLogStampFormat [%a %b %d %H:%M:%S %Y] JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories JkRequestLogFormat %w %V %T JkAutoAlias /usr/apache/tomcat/webapps JkMount /*.jsp ajp13 JkMount /*/servlet/ ajp13 -- David Rickard Software Engineer TechBooks/GTS Your Single Source Solution! Los Angeles CA * York, PA * Boston,MA * New Delhi, India Visit
Re: Apache-Tomcat Servlet Mapping Issues
Hi David: An alternate to using mod_JK is to proxy http (or https) request to the Tomcat from Apache. i.e: ProxyPass /path http://localhost:port/path ProxyPassReverse /path http://localhost/path There are valid reasons for using mod_JK - above just an alternate suggestion if you can do without mod_JK regards, Hari Mailvaganam On 6/22/05, David Rickard [EMAIL PROTECTED] wrote: System: Solaris SunOS 5.9 Apache: 2.0.52 Tomcat: 4.1.31 Mod JK: 1.2.6 The problem: Apache/mod_jk cannot resolve servlet URL mappings When Tomcat is running stand-alone, it can resolve servlet mappings without any problems; so that a page with this form definition: FORM name=login method=POST action=loginhandler correctly invokes the com.company.LoginHandler servlet (which suggests there's nothing syntactically wrong with the servlet and servlet-mapping entries in web.xml); When Tomcat stand-alone is turned off and Apache is turned on, that same page always throws a 404 error for site/loginhandler; these are the error messages in mod_jk.log: [Wed Jun 22 09:04:08 2005] [mod_jk.c (2313)]: mod_jk::jk_translate, check alias_dir: /usr/apache/tomcat/webapps [Wed Jun 22 09:04:08 2005] [mod_jk.c (2337)]: mod_jk::jk_translate, AutoAlias child_dir: loginhandler [Wed Jun 22 09:04:08 2005] [mod_jk.c (2363)]: mod_jk::jk_translate, AutoAlias OK for file: /usr/apache/tomcat/webapps/aiwosc/loginhandler [Wed Jun 22 09:04:08 2005] [jk_uri_worker_map.c (445)]: Into jk_uri_worker_map_t::map_uri_to_worker [Wed Jun 22 09:04:08 2005] [jk_uri_worker_map.c (459)]: Attempting to map URI '/aiwosc/loginhandler' [Wed Jun 22 09:04:08 2005] [jk_uri_worker_map.c (577)]: jk_uri_worker_map_t::map_uri_to_worker, done without a match What terribly simple configuration error have I made here? These are the web.xml entries for this servlet: servlet servlet-nameloginhandler/servlet-name servlet-classcom.company.aiwosc.LoginHandler/servlet-class /servlet servlet-mapping servlet-nameloginhandler/servlet-name url-pattern/loginhandler/url-pattern /servlet-mapping This is the workers.properties file: worker.list=ajp13 worker.ajp13.port=8009 worker.ajp13.host=server.org worker.ajp13.type=ajp13 This is the app section from mod_jk.conf: server.org:/aiwosc # Static files Alias /aiwosc /var/apache/tomcat/webapps/aiwosc Directory /var/apache/tomcat/webapps/aiwosc Options Indexes FollowSymLinks DirectoryIndex index.html /Directory # Deny direct access to WEB-INF and META-INF # Location /aiwosc/WEB-INF/* AllowOverride None deny from all /Location Location /aiwosc/META-INF/* AllowOverride None deny from all /Location JkMount /aiwosc/addtitleservlet ajp13 JkMount /aiwosc/submittitleservlet ajp13 JkMount /aiwosc/transfertitleservlet ajp13 JkMount /aiwosc/saveoscservlet ajp13 JkMount /aiwosc/reordercastservlet ajp13 JkMount /aiwosc/loginhandler ajp13 JkMount /aiwosc/editcategoryservlet ajp13 JkMount /aiwosc/edittitleservlet ajp13 JkMount /aiwosc/addaddendumservlet ajp13 JkMount /aiwosc/*.jsp ajp13 JkMount /aiwosc/addcategoryservlet ajp13 This is the Context entry for the app in server.xml: !-- Oscars OSC Context -- Context path=/aiwosc docBase=aiwosc debug=5 reloadable=true crossContext=true Logger className=org.apache.catalina.logger.FileLogger prefix=aiwosc_log. suffix=.txt timestamp=true/ Resource name=jdbc/oscars auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/oscars parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namedriverClassName/name valueoracle.jdbc.driver.OracleDriver/value /parameter parameter nameurl/name valuejdbc:oracle:thin:@gtsora2.gtsgraphics.com:1521:ACAD/value /parameter parameter nameusername/name valueIMPC_ADMIN/value /parameter parameter namepassword/name valuePIRANHA/value /parameter parameter namemaxActive/name value20/value /parameter parameter namemaxIdle/name value10/value /parameter parameter namemaxWait/name value-1/value /parameter /ResourceParams /Context And these are the mod_jk load/configuration entries from httpd.conf: IfModule !mod_jk.c
Re: Apache-Tomcat Servlet Mapping Issues
Hi, As you test, can you load a servlet through apache httpd? Such as http://www.xyz.com/testservlet You should make a simple servlet that just has the doGet method to test. -Steve O. System: Solaris SunOS 5.9 Apache: 2.0.52 Tomcat: 4.1.31 Mod JK: 1.2.6 The problem: Apache/mod_jk cannot resolve servlet URL mappings When Tomcat is running stand-alone, it can resolve servlet mappings without any problems; so that a page with this form definition: FORM name=login method=POST action=loginhandler correctly invokes the com.company.LoginHandler servlet (which suggests there's nothing syntactically wrong with the servlet and servlet-mapping entries in web.xml); When Tomcat stand-alone is turned off and Apache is turned on, that same page always throws a 404 error for site/loginhandler; these are the error messages in mod_jk.log: [Wed Jun 22 09:04:08 2005] [mod_jk.c (2313)]: mod_jk::jk_translate, check alias_dir: /usr/apache/tomcat/webapps [Wed Jun 22 09:04:08 2005] [mod_jk.c (2337)]: mod_jk::jk_translate, AutoAlias child_dir: loginhandler [Wed Jun 22 09:04:08 2005] [mod_jk.c (2363)]: mod_jk::jk_translate, AutoAlias OK for file: /usr/apache/tomcat/webapps/aiwosc/loginhandler [Wed Jun 22 09:04:08 2005] [jk_uri_worker_map.c (445)]: Into jk_uri_worker_map_t::map_uri_to_worker [Wed Jun 22 09:04:08 2005] [jk_uri_worker_map.c (459)]: Attempting to map URI '/aiwosc/loginhandler' [Wed Jun 22 09:04:08 2005] [jk_uri_worker_map.c (577)]: jk_uri_worker_map_t::map_uri_to_worker, done without a match What terribly simple configuration error have I made here? These are the web.xml entries for this servlet: servlet servlet-nameloginhandler/servlet-name servlet-classcom.company.aiwosc.LoginHandler/servlet-class /servlet servlet-mapping servlet-nameloginhandler/servlet-name url-pattern/loginhandler/url-pattern /servlet-mapping This is the workers.properties file: worker.list=ajp13 worker.ajp13.port=8009 worker.ajp13.host=server.org worker.ajp13.type=ajp13 This is the app section from mod_jk.conf: server.org:/aiwosc # Static files Alias /aiwosc /var/apache/tomcat/webapps/aiwosc Directory /var/apache/tomcat/webapps/aiwosc Options Indexes FollowSymLinks DirectoryIndex index.html /Directory # Deny direct access to WEB-INF and META-INF # Location /aiwosc/WEB-INF/* AllowOverride None deny from all /Location Location /aiwosc/META-INF/* AllowOverride None deny from all /Location JkMount /aiwosc/addtitleservlet ajp13 JkMount /aiwosc/submittitleservlet ajp13 JkMount /aiwosc/transfertitleservlet ajp13 JkMount /aiwosc/saveoscservlet ajp13 JkMount /aiwosc/reordercastservlet ajp13 JkMount /aiwosc/loginhandler ajp13 JkMount /aiwosc/editcategoryservlet ajp13 JkMount /aiwosc/edittitleservlet ajp13 JkMount /aiwosc/addaddendumservlet ajp13 JkMount /aiwosc/*.jsp ajp13 JkMount /aiwosc/addcategoryservlet ajp13 This is the Context entry for the app in server.xml: !-- Oscars OSC Context -- Context path=/aiwosc docBase=aiwosc debug=5 reloadable=true crossContext=true Logger className=org.apache.catalina.logger.FileLogger prefix=aiwosc_log. suffix=.txt timestamp=true/ Resource name=jdbc/oscars auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/oscars parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/va lue /parameter parameter namedriverClassName/name valueoracle.jdbc.driver.OracleDriver/value /parameter parameter nameurl/name valuejdbc:oracle:thin:@gtsora2.gtsgraphics.com:1521:ACA D/value /parameter parameter nameusername/name valueIMPC_ADMIN/value /parameter parameter namepassword/name valuePIRANHA/value /parameter parameter namemaxActive/name value20/value /parameter parameter namemaxIdle/name value10/value /parameter parameter namemaxWait/name value-1/value /parameter /ResourceParams /Context And these are the mod_jk load/configuration entries from httpd.conf: IfModule !mod_jk.c LoadModule jk_module modules/mod_jk.so /IfModule Include /usr/apache/tomcat/conf/auto/mod_jk.conf JkWorkersFile