Meaningless Drivel is fun!*
The moose likes Servlets and the fly likes Listener class problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Listener class problem" Watch "Listener class problem" New topic
Author

Listener class problem

vinoth subramaniam
Ranch Hand

Joined: Jul 05, 2008
Posts: 47
Hi all,

i implemented HttpSessionListener which is used to count the current users online by checking the session count. Then i configured the web.xml for the listener. But after the confguration i cant able to run any html or jsp in the server (Tomcat V 5.5 server). I am using ObjectWeb Lomboz Eclipse.

I dont know whats the reason. i am getting an error saying "The requested resource (/Myproj/form_cookie.html) is not available "

If i remove the listener description in the DD, everything working fine. So Can you help me out of this. What is the reason behind this problem.

And also i can run the jsp in the other projects. i guess that there is some error in the DD of this project. Please help me

This is my DD

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

<display-name>
Myproj
</display-name>

<context-param>
<param-name>commonMail</param-name>
<param-value>vinovs@indiatimes.com</param-value>
</context-param>

<context-param>
<param-name>breed</param-name>
<param-value>Great Dane</param-value>
</context-param>

<!-- Here i am facing the problem. Once i remove this description, its working fine. Any logical reason for this problem -->

<listener>
<listener-class>Active_Count</listener-class>
</listener>



<servlet>
<description>
</description>
<display-name>ListenerTester</display-name>
<servlet-name>ListenerTester</servlet-name>
<servlet-class>ListenerTester</servlet-class>
</servlet>


<servlet>
<description>
</description>
<display-name>
Srvlet_cookie</display-name>
<servlet-name>Srvlet_cookie</servlet-name>
<servlet-class>
Srvlet_cookie</servlet-class>
<init-param>
<description>
</description>
<param-name>mail</param-name>
<param-value>vinoth4.s@tcs.com</param-value>
</init-param>
</servlet>

<servlet-mapping>
<servlet-name>ListenerTester</servlet-name>
<url-pattern>/ListenTest.do</url-pattern>
</servlet-mapping>


<servlet-mapping>
<servlet-name>Srvlet_cookie</servlet-name>
<url-pattern>/Cookie_servlet.do</url-pattern>
</servlet-mapping>

<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>

</web-app>

The Error message

HTTP Status 404 - /Myproj/PageCounter.jsp

--------------------------------------------------------------------------------

type Status report

message /Myproj/PageCounter.jsp

description The requested resource (/Myproj/PageCounter.jsp) is not available.


--------------------------------------------------------------------------------

Apache Tomcat/5.5.25

Please clear my problem.
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

<listener>
<listener-class>Active_Count</listener-class>
</listener>


i think, you have to give fully qualified name for LitenerClass

example,
..........................................................
<listener>
<listener-class>package.Active_Count</listener-class>
</listener>
........................................................
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2380
    
    7

Yup the listener class must have a fully qualified path with package. Yet you don't get deployment errors?


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5
 
Don't get me started about those stupid light bulbs.
 
subject: Listener class problem