• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

getServletContext() error

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

While compiling my application I am getting the error saying " can not resolve symbol getServletContext() in HttpSession.
I have set the classpath to servlet-api.jar and servlet.jar

Please help me in resolving the above problem.

Thanks & Regards
Damodar Reddy G
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is a getServletContext method in HttpSession.
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/http/HttpSession.html

If the compiler found HttpSession then it's probably not a classpath issue.
Check your spelling.

You didn't, by any chance, name one of your objects HttpSession, did you?
 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As it says in the API doc, this method appeared in Servlet API 2.3, which is covered on J2EE 1.3. Are you using an updated servlet-api.jar and servlet.jar (for example, from Tomcat 4.1 or 5.x or 6.x)? If you're developing using an IDE, look for the target J2EE, maybe it's configured by default to 1.2 or 1.1...
 
Damodara Reddy
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have tried with the updated version(servlet-api.jar) also, still I am getting the same error.
 
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
are you using IDE for this code development
 
reply
    Bookmark Topic Watch Topic
  • New Topic