File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Error Instantiating Web App - Listener Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Error Instantiating Web App - Listener" Watch "Error Instantiating Web App - Listener" New topic

Error Instantiating Web App - Listener

Arshad Azeem

Joined: Aug 21, 2005
Posts: 13

When i deploy my web app and try to run the home page (I am using OC4J 10.1.2, Servlet v2.3 Spec), i am getting the following error:

Error instantiating web-application
Listener class 'com.testa.testb.MyAppSessionBindingListener' was dit not implement 'javax.servlet.ServletContextListener', 'javax.servlet.ServletContextAttributeListener', 'javax.servlet.http.HttpSessionListener' or 'javax.servlet.http.HttpSessionAttributeListener'

Here is my web.xml entry:

I am Implementing the HttpSessionBindingListener interface in MyAppSessionBindingListener.

Do you guys have any idea why this might be happening?

Thanks in advance for any responses.

Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
This interface is to be implemented by the class which you're going to get/set as a session attribute.
Also see the Javadoc: javax.servlet.http.HttpSessionBindingListener.

If you want an attribute-independent listener (you apparently want), you rather need HttpSessionAttributeListener.
Also see the Javadoc: javax.servlet.http.HttpSessionAttributeListener.
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
The error message is quite to the point: it lists the listeners that get defined in the DD, and HttpSessionBindingListener is NOT one of those. More detail can be found in
Arshad Azeem

Joined: Aug 21, 2005
Posts: 13
Thanks, I took out the SessionBindingListener from the DD. That link helped.
Arshad Azeem

Joined: Aug 21, 2005
Posts: 13
but the only question i have is that the servlet v2.3 spec didn't talk about it explicitly. Here is what i saw in the spec. There is nothing specific about HttpSessionBinding and HttpSessionActivation listeners.

SRV.10.3.2 Deployment Declarations
Listener classes are declared in the web application deployment descriptor using the
listener element. They are listed by class name in the order in which they are to be
SRV.10.3.3 Listener Registration
The web container creates an instance of each listener class and registers it for event
notifications prior to the processing of the first request by the application. The web
container registers the listener instances according to the interfaces they implement
and the order in which they appear in the deployment descriptor. During web
application execution listeners are invoked in the order of their registration.
I agree. Here's the link:
subject: Error Instantiating Web App - Listener
It's not a secret anymore!