• 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

Confusing tomcat error - can't find javax.servlet.http.HttpSessionAttributeListener

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I'm getting a fatal error when I start tomcat. Now I would think that servlet-api.jar is missing from the tomcat classpath but if I do -verbose:class I can clearly see tomcat using other classes from that jar so I know it's already included:


The exact error I'm getting is:


The file that gives this error has import javax.servlet.http.*; at the top so it appears that I've already imported the necessary classes. How can I fix this fatal error? Why does tomcat see javax.servlet.http.HttpServletRequest but not javax.servlet.http.HttpSessionAttributeListener?

Thank you
 
Saloon Keeper
Posts: 27807
196
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
If you're importing those classes into a JSP you can expect to be admonished by the Anti-JSP Logic League. It is a very bad idea to put complex logic in a View defintion, regardless of whether it is a JSP or something more exotic such as a JSF facelets template.

When you put logic in a JSP, not only do you violate the MVC architectural paradigm that is the de facto standard for well-designed webapps, but it can be a real to debug.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sounds like a version conflict.

This listener appeared in Servlet 2.3

What is your version of Tomcat?
 
reply
    Bookmark Topic Watch Topic
  • New Topic