Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I can't get servlets working on tomcat.

Status
Not open for further replies.

d0127810

Programmer
Aug 5, 2005
3
GB
I can connect JSPs, with reference to classes, in packages on the WEB-INF/classes directory, but I'm having trouble actually running servlets on tomcat

This are the current JkMounts I have, in my apache server, tomcat seems to start ok, Are there any directives that I have missed?

<VirtualHost DocumentRoot /var/ServerName <Directory "/var/allow from all
Options +Indexes
</Directory>

#Java Web Engine Stuff
<IfModule mod_jk.c>
JkMount /*.jsp ajp13
JkMount /servlet/* ajp13
JkMount /*.do ajp13
<Location "/WEB-INF/">
AllowOverride None
deny from all
</Location>
</IfModule>
#end of java stuff

php_value include_path ".:/usr/local/lib/php"
php_flag safe_mode on
User intelogy
</VirtualHost>
 
Is this a Tomcat question or an Apache question ? Don't actually see anything you posted really relating to servlets/Tomcat here [there is nothing in Apache http conf files that relates to servlets specifically - only to URL matches].

--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
Yes it is a tomcat question, what information do you then require to get your servlets running?

Here is the server.xml descriptor associated with the domain.

<Host name=" <Context path="" docBase="/var/ debug="0"
reloadable="true"/>
</Host>

I was under the impression that when using the apache server, it would pass JSP / Servlet related pages to tomcat, thats why I provided you with the apache httpd.conf (I thought that it wasn't passing the servlets).
 
In webapp's web.xml, one usually maps a servlet like so :

Code:
<servlet>
   <servlet-name>TestServlet</servlet-name>
   <servlet-class>com.acme.TestServlet</servlet-class>
   <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
   <servlet-name>TestServlet</servlet-name>
   <url-pattern>/servlet/TestServlet</url-pattern>
</servlet-mapping>

You would then access it like :




--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
I have my servlet mapping as follows (anything else):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "<web-app>
<servlet>
<servlet-name>test</servlet-name>
<servlet-class>testwebserver.test</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>test</servlet-name>
<url-pattern>/test</url-pattern>
</servlet-mapping>
</web-app>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top