I use JBuilder Foundation to edit and compile my servlets. Jbuilder creates a package for each project and places all of the classes for that project in the package. Do I have to include tha package path under my classes dir with Tomcat. In other words: // Top few lines from my Servlet package servlets; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.util.*; // Entry from my web.xml file <servlet> <servlet-name> TestServlet </servlet-name> <servlet-class> TestServlet </servlet-class> </servlet>
<servlet-mapping> <servlet-name> TestServlet </servlet-name> <url-pattern> /TestServlet </url-pattern> </servlet-mapping> // Context as defined in my server.xml file <Context path="/hallanet" docBase="webapps/hallanet" crossContext="false" debug="0" reloadable="true" > </Context> Directory Structure under webapps in tomcat: D:\ApacheGroup\Tomcat\jakarta-tomcat-3.2.1\webapps\hallanet\Web-inf\classes How do I corrlate these files, packages and paths so that MY servlets will run. NOTE: The Tomcat examples; servlets and JSP's work just fine. Art
Arthur Smith<br />SCJP2 - SCWCD
Roopa Bagur
Ranch Hand
Joined: Nov 03, 2000
Posts: 267
posted
0
Whatever you have done loos fine to me. What message are you getting when you run your servlet?
Originally posted by Art Smith: I use JBuilder Foundation to edit and compile my servlets. Jbuilder creates a package for each project and places all of the classes for that project in the package. Do I have to include tha package path under my classes dir with Tomcat. In other words: // Top few lines from my Servlet package servlets; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.util.*; // Entry from my web.xml file <servlet> <servlet-name> TestServlet </servlet-name> <servlet-class> TestServlet </servlet-class> </servlet>
<servlet-mapping> <servlet-name> TestServlet </servlet-name> <url-pattern> /TestServlet </url-pattern> </servlet-mapping> // Context as defined in my server.xml file <Context path="/hallanet" docBase="webapps/hallanet" crossContext="false" debug="0" reloadable="true" > </Context> Directory Structure under webapps in tomcat: D:\ApacheGroup\Tomcat\jakarta-tomcat-3.2.1\webapps\hallanet\Web-inf\classes How do I corrlate these files, packages and paths so that MY servlets will run. NOTE: The Tomcat examples; servlets and JSP's work just fine. Art
Scott Stirling
Greenhorn
Joined: Mar 05, 2001
Posts: 24
posted
0
Yes, you have to include the package under the WEB-INF\classes dir. You also have to define the servlet using its fully qualified class name, so TestServlet should be: <servlet> <servlet-name>TestServlet</servlet-name> <servlet-class>servlets.TestServlet</servlet-class> </servlet>
Scott Stirling<BR>Author of <A HREF="http://www.amazon.com/exec/obidos/ASIN/067231939X/ref=ase_electricporkchop/107-2476442-4883722" TARGET=_blank rel="nofollow">Java Server Pages Application Development</A>
Madhav Lakkapragada
Ranch Hand
Joined: Jun 03, 2000
Posts: 5040
posted
0
D:\ApacheGroup\Tomcat\jakarta-tomcat-3.2.1\webapps\hallanet\Web-inf\classes I would use either the web.xml or the server.xml not both. I prefer the older way of server.xml, personally. Also, to understand this better, pl. refer to this article where they walk you thru such an example. Do I have to include tha package path under my classes dir with Tomcat Yes you do have to. So your dir structure should be: webapps/hallanet/WEB-INF/classes/servlets/TestServlet.class regds. - satya
Scott - You win the prize. That was it! This single line of code: servlets.TestServlet Solved my problems. THANKS A LOT! Art
Originally posted by Scott Stirling: Yes, you have to include the package under the WEB-INF\classes dir. You also have to define the servlet using its fully qualified class name, so TestServlet should be: <servlet> <servlet-name>TestServlet</servlet-name> <servlet-class>servlets.TestServlet</servlet-class> </servlet>