Get your CodeRanch badge!*
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


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Confusing tomcat error - can Watch "Confusing tomcat error - can New topic
Author

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

Chris Cassano
Greenhorn

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: 15662
    
  15

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
William Brogden
Author and all-around good cowpoke
Rancher

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

This listener appeared in Servlet 2.3

What is your version of Tomcat?

Java Resources at www.wbrogden.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Confusing tomcat error - can't find javax.servlet.http.HttpSessionAttributeListener
 
Similar Threads
Eclipse - The import javax.servlet.http.HttpServletRequest cannot be resolved
Tomcat deployement Problem SEVERE: Error listenerStart
java.lang.IllegalStateException: getWriter() has already been called for this response
Servlet Annotations
java.lang.NoClassDefFoundError: javax/el/ValueExpression