File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Tomcat 4.0.1 - Servlet not found

 
Francois Bourgault
Ranch Hand
Posts: 67
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I just installed tomcat 4.0.1 and copied all source code and classes under webapps\myServlets. In tomcat 3, I had everything under examples. Now I want to create my own subdirectory. I followed directives from the next link: http://www.javaranch.com/ubb/Forum7/HTML/005712.html
When I try to execute my servlet using : http://localhost:8080/myServlets/HelloServlet
I get http status 404 - page not found
In server.xml, I added:
<Context path="/myServlets" docBase="webapps/myServlets"
debug="0" privileged="true"/>
And in web.xml, I added:
<servlet>
<servlet-name>HelloServlet</servlet-name>
<servlet-class>HelloServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HelloServlet</servlet-name>
<url-pattern>/HelloServlet</url-pattern>
</servlet-mapping>
Main directory is: c:\apache\jakarta-tomcat
I have created "myServlets" directory in web-apps. My structure is:
jakarta-tomcat
---- webapps
---- admin
---- examples
---- myServlets
--------- images
-------- META-INF
-------- WEB-INF\HelloServlet.class
---- ROOT
Can someone tell me what I'm missing?
Thanks,
Francois.
 
Tony Alicea
Desperado
Sheriff
Posts: 3226
5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
-------- WEB-INF\classes\HelloServlet.class
 
Francois Bourgault
Ranch Hand
Posts: 67
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I forgot to mention that I created javabeans and copied the class file in myServlets\web-inf When I run jsp pages, I get the following error:
An error occurred at line: 19 in the jsp file: /list_guests.jsp
Generated servlet error:
C:\Apache\jakarta-tomcat\work\localhost\Src\list_0005fguests$jsp.java:91: Class org.apache.jsp.Guest_Bean not found.
formhandler = (Guest_Bean) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "Guest_Bean");

Is this also related to my previous posting?
Francois.
 
Francois Bourgault
Ranch Hand
Posts: 67
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tony,
My mistake. It is in: WEB-INF\classes\HelloServlet.class
Francois
 
Francois Bourgault
Ranch Hand
Posts: 67
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tony,
My mistake. It is in: WEB-INF\classes\HelloServlet.class
Francois
 
Francois Bourgault
Ranch Hand
Posts: 67
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I fixed the problem with servlets. Now I can execute a servlet. BUT I still can't create an instance of a bean in jsp page. It says:
An error occurred at line: 19 in the jsp file: /list_guests.jsp
Generated servlet error:
C:\Apache\jakarta-tomcat\work\localhost\Src\list_0005fguests$jsp.java:91: Class org.apache.jsp.Guest_Bean not found.
formhandler = (Guest_Bean) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "Guest_Bean");
What cause that? Any idea..
FYI: I can run jsp files without javabeans.
Also, the bean is registered in web.xml
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic