• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet errors

 
Pradeep Appala
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Error allocating a servlet instance
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
java.lang.Thread.run(Thread.java:680)
root cause

java.lang.NoClassDefFoundError: HttpServlet
java.lang.ClassLoader.defineClass1(Native Method)
java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
java.lang.ClassLoader.defineClass(ClassLoader.java:616)
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2722)
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1124)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1612)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
java.lang.Thread.run(Thread.java:680)
root cause

java.lang.ClassNotFoundException: HttpServlet
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
java.lang.ClassLoader.defineClass1(Native Method)
java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
java.lang.ClassLoader.defineClass(ClassLoader.java:616)
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2722)
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1124)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1612)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
java.lang.Thread.run(Thread.java:680)


 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64173
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This isn't a Mac thing. The jar files are part of Tomcat -- you don't need anything Mac-specific from the Oracle site.

I have no idea how to configure Eclipse to use Tomcat successfully as I do not use it.
 
Pradeep Appala
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:This isn't a Mac thing. The jar files are part of Tomcat -- you don't need anything Mac-specific from the Oracle site.

I have no idea how to configure Eclipse to use Tomcat successfully as I do not use it.


Thank you for, at least, partially clearing my mind.

Do you know why the above error page is coming up?

Can you point me to a tutorial to successfully install Tomcat and Eclipse in Macs? Help!!!
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64173
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It means that the servlet jar isn't in the compilation classpath.

I'll move this to the IDEs forum for help with setting up Eclipse.
 
Pradeep Appala
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:It means that the servlet jar isn't in the compilation classpath.

I'll move this to the IDEs forum for help with setting up Eclipse.


Please go ahead and move my post. Hopefully, I will get my answers there.
 
Pradeep Appala
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anyone with an answer?

BTW, I just found that even the Tomcat in my Ubuntu VM is not able to serve the servlet related page. Is there anything I am doing wrong w.r.t. Tomcat installation. What do I need to change?

Please someone point me to the right direction.
 
Maneesh Godbole
Saloon Keeper
Posts: 10971
11
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would recommend using Tomcat from http://tomcat.apache.org/

On my Mac, I got Eclipse+Sysdeo Plugin+Tomcat and it works fine for me. I never had to tweak the firewall or anything
 
Pradeep Appala
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17616
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic