[ Team LiB ] Previous Section Next Section



I added an init method to my servlet; why can't I run it now?


If your servlet was working before and the only thing you changed was the init method, there's a pretty good chance your init method is throwing an exception. If the init method throws an exception, the servlet engine stops loading it and it won't run. Check your server's error logs to see whether any exceptions are there.


Why does my servlet act strangely when I have defined an init method?


If you override the init(ServletContext ctx) method rather than the simpler init() method, and you forget to call super.init(ctx), your servlet won't be properly initialized and might act strangely.


My JSP recompiled; why do I still see old data?


If your JSP depends on other classes that have changed, you must reload these classes. Most JSP engines must be restarted before they pick up changed classes.


I restarted my JSP engine; why didn't it pick up the changed classes?


Make sure that the class file the JSP engine is using has been changed. If you copy class files from one place to another, you might have an old copy of the class file somewhere that is closer to the front of the classpath than the class file you just regenerated. Your operating system probably has a utility to search for files with a particular name (Start->Search->"For Files or Folders... under Windows, or find in Unix). Also, if you left any .java files in the directory where your JSP is, the JSP engine might have compiled those files and put them in its own class file directory. Again, searching for class files should locate any such files.


Why isn't my listener working even though I added it to the deployment descriptor?


The listener element in the deployment descriptor is a subelement of the web-app element. Also, it must be placed prior to any servlet elements. Listeners will be invoked in the order they are declared.

    [ Team LiB ] Previous Section Next Section