404 and 500 Error on Tomcat 4.1 under Apache 2.0.52
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Monday, December 27, 2004 10:38 AM

Ok, before I begin I want to paint the picture of what we're working with here. - I have a Win 2K box Running Apache 2.0.52 and Tomcat 4.1. - I compiled the current (and last) version of JK2 (2.0.4) to use as a connector between Apache and Tomcat - I have a number of virtual hosts that I've used for this server. I'm having issues getting JSPs and Servlet Applications to run on my box. This is a development box, so I'm not too concerned with timing. It's just erking me that I can't get it set up. I've got all the components of Tomcat and Apache set up as best as I can following the documentation and the documents I've found scouring the web. I have run into a problem howe   More>>

Ok, before I begin I want to paint the picture of what we're working with here.



- I have a Win 2K box Running Apache 2.0.52 and Tomcat 4.1.

- I compiled the current (and last) version of JK2 (2.0.4) to use as a connector between Apache and Tomcat

- I have a number of virtual hosts that I've used for this server.



I'm having issues getting JSPs and Servlet Applications to run on my box. This is a development box, so I'm not too concerned with timing. It's just erking me that I can't get it set up.



I've got all the components of Tomcat and Apache set up as best as I can following the documentation and the documents I've found scouring the web. I have run into a problem however, that no one seems to have come across. At least not with my configuration.



I can get JSP's to run in the root level pages for each of my virtual hosts. index.jsp, test.jsp, etc all work as expected. When I try running a jsp page in a sub-directory or try running a servlet application from an extracted WAR, or even one with the proper directory structure and files set up, I get a 500 error. The Apache log files (error and access) for the virtual hosts are useless. The error file is empty and the access file says a 500 error is tossed. The Tomcat logs are just as useless. No one seems to mention the errors, or give me any clue as to what the errors are, or where they are coming from.



Here's what my directory strucure looks like

			
Base (c:www)
... (These are other virtual directories)
-> Root for test.asif.com (c:wwwasif)
-> html/ (docroot)
-> lib/
-> javaApps/ (Application Root)
-> Blah/
-> WEB-INF/
-> web.xml
-> index.jsp
-> classes/
-> Blah.class
-> K2M/
-> bin/
-> Root for foobar.asif.com (c:wwwfoobar)
...



(Blah, of course, was expanded from a WAR by Tomcat)



Here are snippets from my conf files.
(I'll use my simple test application to help illustrate)



server.xml

--------------

			

appBase="C:/www/asif/javaApps"
unpackWARs="true" autoDeploy="true">




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




--------------



jk2.properties

(It's all commented out)

---------------

			
## THIS FILE MAY BE OVERRIDEN AT RUNTIME. MAKE SURE TOMCAT IS STOPED
## WHEN YOU EDIT THE FILE.

## COMMENTS WILL BE _LOST_

## DOCUMENTATION OF THE FORMAT IN JkMain javadoc.

# Set the desired handler list
# handler.list=apr,request,channelJni
#
# Override the default port for the socketChannel
# channelSocket.port=8019
# Default:
# channelUnix.file=${jkHome}/work/jk2.socket
# Just to check if the the config is working
# shm.file=${jkHome}/work/jk2.shm

# In order to enable jni use any channelJni directive
# channelJni.disabled = 0
# And one of the following directives:

# apr.jniModeSo=/opt/apache2/modules/mod_jk2.so

# If set to inprocess the mod_jk2 will Register natives itself
# This will enable the starting of the Tomcat from mod_jk2
#serverRoot=C:/Apache/Apache2
#apr.NativeSo=/Apache/Apache2/lib/libjkjni.dll

-----------------



workers2.properties

-----------------

			
# Doesn't work without this (I don't know why)
[shm]
file=/Development/Apache/Apache2/logs/shm.file
size=1048576

# Example socket channel, override port and host.
[channel.socket:localhost]
port=8009
host=127.0.0.1

# define the workers
[ajp13:localhost]
channel=channel.socket:localhost:8009

[ajp13:asif.detroitk12.org]
channel=channel.socket:localhost:8009

[ajp13:test.asif.com]
channel=channel.socket:localhost:8009

[ajp13:foobar.asif.com]
channel=channel.socket:localhost:8009


------------------



httpd.conf

------------------

			
# *** Tomcat stuff for JK2 ***
LoadModule jk2_module modules/mod_jk2.so

JkUriSet worker ajp13:localhost:8009

# *** End Tomcat stuff for JK2 ***


ServerName test.asif.com
DocumentRoot /www/asif/html
ErrorLog /www/asif/logs/asif_error
CustomLog /www/asif/logs/asif_access common
ScriptAlias /cgi-bin/ /www/asif/cgi-bin/

Options +Includes +ExecCGI +Indexes +FollowSymLinks


JkUriSet worker ajp13:test.asif.com:8009


JkUriSet worker ajp13:test.asif.com:8009




------------------



web.xml for the test application

------------------

			
<?xml version="1.0" ?>



Blah
Blah


Blah
/servlet/*




------------------



Now I added the whole servlet-mapping tag to see if actually stating what a user should type in would make a difference...My stdout.log did this when I started Tomcat:

------------------

			
Bootstrap: Create Catalina server
Bootstrap: Starting service
Starting service Tomcat-Apache
Apache Tomcat/4.1.31
Dec 27, 2004 12:28:05 PM org.apache.jk.common.ChannelSocket init
INFO: JK2: ajp13 listening on /0.0.0.0:8009
Dec 27, 2004 12:28:05 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=31/344 config=C:DevelopmentApacheTomcat 4.1confjk2.properties
Bootstrap: Service started
Dec 27, 2004 12:29:15 PM org.apache.jk.common.ChannelSocket processConnection
INFO: connection timeout reached
Dec 27, 2004 12:58:04 PM org.apache.commons.digester.Digester endElement
SEVERE: End event threw exception
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:252)
at org.apache.commons.digester.CallMethodRule.end(CallMethodRule.java:505)
at org.apache.commons.digester.Rule.end(Rule.java:276)
at org.apache.commons.digester.Digester.endElement(Digester.java:1058)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.endNamespaceScope(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.commons.digester.Digester.parse(Digester.java:1548)
at org.apache.catalina.startup.ContextConfig.applicationConfig(ContextConfig.java:220)
at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:579)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:181)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3523)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:774)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:760)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:548)
at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:260)
at org.apache.catalina.core.StandardHost.install(StandardHost.java:741)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:445)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:353)
at org.apache.catalina.startup.HostConfig.run(HostConfig.java:804)
at java.lang.Thread.run(Thread.java:534)
Caused by: java.lang.IllegalArgumentException: Invalid Blah in servlet mapping
at org.apache.catalina.core.StandardContext.addServletMapping(StandardContext.java:1633)
... 34 more
Dec 27, 2004 12:58:20 PM org.apache.commons.digester.Digester endElement
SEVERE: End event threw exception
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:252)
at org.apache.commons.digester.CallMethodRule.end(CallMethodRule.java:505)
at org.apache.commons.digester.Rule.end(Rule.java:276)
at org.apache.commons.digester.Digester.endElement(Digester.java:1058)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.endNamespaceScope(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.commons.digester.Digester.parse(Digester.java:1548)
at org.apache.catalina.startup.ContextConfig.applicationConfig(ContextConfig.java:220)
at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:579)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:181)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3523)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:774)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:760)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:548)
at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:260)
at org.apache.catalina.core.StandardHost.install(StandardHost.java:741)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:512)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:354)
at org.apache.catalina.startup.HostConfig.run(HostConfig.java:804)
at java.lang.Thread.run(Thread.java:534)
Caused by: java.lang.IllegalArgumentException: Invalid Blah in servlet mapping
at org.apache.catalina.core.StandardContext.addServletMapping(StandardContext.java:1633)
... 34 more


------------------



Removing the servlet-maping tag doesn't show the stack-trace, and says everytyhing starts fine... but we still have a problem running things in other directories.



If I take out the value for docRoot in the context for this host, in the server.xml, then I get 500 errors all around.



Can anyone give me a slap in the face so that I can go in the proper direction to get these to work?



I don't want to have to edit the server.xml file every time I want to add a new application. It'd also be nice not to have to restart the server every time a new application is added.



Pleeease



Thank you,

- Asif Chowdhury -
   <<Less
About | Sitemap | Contact