I started learning servlets and wanted to setup my environment in Mac OS X (10.6.7). I installed Eclipse (Eclipse IDE for Java EE Developers) from its site.
Then downloaded a pre-configured tomcat from www.coreservlets.com.
The website gives us an opportunity to test an app written by them to help us know everything went alright in terms of installing eclipse and tomat.
I initially had several problems like '8005 & 80 port "already in use"'. So I changed it to 8006 in server.xml of Tomcat. BTW, web.xml, content.xml and server.xml were pre-configured by the website people.
Now I could successfully start my Tomcat server using Eclipse. But when I deployed the app provided by the website in Tomcat, the browser shows me a web page with all the links. There are hyperlinks to some JSPs and pages served after servlet execution. JSPs run fine. Of course, all that a JSP shows is some text and current date & time. But the servlet based pages are not working. When I click on the link this is what I am getting on the browser.
Can someone please help? I desperately need to complete learning JSPs and Servlets soon, at least the basics.
BTW, Is all this because I am using a Mac. What is J2EE SDK, doesn't Tomcat have all the J2EE packages, or don't they come with Eclipse, or don't they come with Mac OS X by default ? I am thoroughly confused. I don't see a download option for J2EE SDK for Mac OS in the Oracle website.
type Exception report
description The server encountered an internal error () that prevented it from fulfilling this request.
javax.servlet.ServletException: Error allocating a servlet instance
I found out the problem on my Mac. The Eclipse IDE is not able to compile jar files provided by Tomcat (install_dir/lib/*.jar). For this, I followed a tutorial(click here) written by a guy, who was fortunately using the same combo(Mac+Eclipse+Tomcat). The type HTTPServletRequest couldn't be resolved to a type before I followed the tutorial.
I felt relieved. But only partially. But now the problem is running Tomcat in my Ubuntu Server residing in a VM in my Mac.
I need to install the whole OS(because I think I messed it up) and work on it again.
Anyway people having "javax.servlet.* can not be resolved" can look at the page I mentioned above have an answer.
Eclipse allows you to make symbolic definitions that refer to external locations. I find this convenient because I can do things like refer to the servlet and JSP api libraries in Tomcat in a way that still works if I port the project to another machine with a different Tomcat setup - just change the targets of the symbolic references.
An IDE is no substitute for an Intelligent Developer.