Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Chris Cassano
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • 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
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18212
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • 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.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like a version conflict.

This listener appeared in Servlet 2.3

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