• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Servlet errors

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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)



 
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Saloon Keeper
Posts: 28316
207
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Everybody's invited. Except this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic