File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes Confusing tomcat error - can't find javax.servlet.http.HttpSessionAttributeListener Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Confusing tomcat error - can Watch "Confusing tomcat error - can New topic

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

Chris Cassano

Joined: Jun 20, 2012
Posts: 2
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

Joined: Jun 25, 2001
Posts: 17421

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.

An IDE is no substitute for an Intelligent Developer.
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13037
Sounds like a version conflict.

This listener appeared in Servlet 2.3

What is your version of Tomcat?
I agree. Here's the link:
subject: Confusing tomcat error - can't find javax.servlet.http.HttpSessionAttributeListener
jQuery in Action, 3rd edition