This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have a listener class that implemets servletContextListener. The contextInitialized method sets an attribute and the listener is configured properly in my web.xml file. My doubt is... if i use a System.out.println statement in the java source will the output appear on the web container's console ? Here are the files
When i try to get the attribute i get a null value so i thought may be the listener is not running as yet. I cannot find the String Initializing Context... anywhere on my console. Does this mean the Listener is not running at all ? Why is it not detecting when my context is initialized ? Any ideas ?
Its directly under the web-app tag like it should be. I have verified that i can get the context param from a servlet by printing it out on the console, from another servlet. However it seems to me that the context listener is not running when my app context is loaded. i wonder why
Joined: Mar 02, 2005
while adding the entry in listener class add the class name along with package structure
The listener is in my classes directory directly under WEB-INF. That is where my servlet is too. The container is able to detect the servlet but not my listener I think i ll change the container's vendor and see what happens.
Hey i solved it. I ran it under tomcat and it worked. I forgot to give the listener class the access modifier public and i guess the weblogic server failed very quietly. Thanks for the help ! I also put my listener in a package.