I am having trouble getting started with my own Servlets on my own Tomcat installation. I can get the Tomcat Welcome Page, the Tomcat Manager page and the examples that come with the Tomcat distribution, but if I try do some simple examples from any of the books, for instance Head First Servlets & JSP, I get resource not found.
Some specifics. I have Tomcat 5.5 Here is my implementation of the very first example in Head First. I deployed this without using a .war This is the structure under webapps ch1/ WEB-INF/ web.xml classes/ Ch1Servlet.class
At least in JBoss you have to include the extension .WAR to the directory you want to use as an exploded web-app. Don't know if it's the same in Tomcat standalone, but JBoss uses Tomcat... So try it. Rename ch1 dir to ch1.WAR
You don't need the .war extension with tomcat. For what I see your servlet is in the default package.. If it's not, you have to write the fully qualified name of the servlet class in the web.xml. Pablo.
2B || !2B
Joined: Dec 17, 2004
Thanks for the replies. I did try ch1.war, but to no avail. The ch1 directory is automatically generated when I drop the ch1.war into my webapps directory, so I think it is correct for Tomcat. You are also right that my Servlet is in the default package. I did that just to help make sure I wasn't mis-entering the qualified name. Still no luck.
P.S. Please use UBB code tags when posting code. Read this for more info.
Joined: Dec 17, 2004
Thanks for the replies. Now I understand the code tag and will use that in the future. I figured out the problems (by looking through the logs !) Tomcat logs hadn't been saying anything about my ch1 deployment and everything else that I expected to work was working, so I didn't read the entire log. It turns out that another app that I had tried to deploy didn't work, and it was still in webapps. Apparaently, everytime Tomcat would be started, it would load the other applications (from the Tomcat distribution), but when it got to my problem app, it had an exception because of missing class files. As a consequence, it "skipped inmstalling application listeners because of previous error(s)" I guess that meant it wouldn't pay attention to the ch1 deployment. I successfully deployed ch1 on my Glassfish, and on my public ISP, so I knew it worked. When I removed the other incorrect application from webvapps and Tomcat was able to start without exception, then ch1 worked fine.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com