web.xml validation error : servlet not a subclass of javax.servlet.servlet
i have a web module, whose web.xml defines some servlets.
THe servlet implementation classes are defined in another module, which the web module depends on.
module A (java nature)
- defines some servlet classes
- depends on the Web Container (Websphere) J2EE libraries
module B (web nature)
- defines a web.xml whose servlets are defined in A
- depends on A
- depends on the Web Container (Websphere) J2EE libraries
Those servlet declarations are flagged by IDEA, as
Error:Error:line (88)'com.hsbc.hbfr.cso.presentation.common.util.configuration.InitializationServlet' is not a subclass of 'javax.servlet.Servlet'
Error:Error:line (72)'com.hsbc.hbfr.cso.presentation.common.util.refdata.RefDataServlet' is not a subclass of 'javax.servlet.Servlet'
After verification, those classes extend java.servlet.http.HttpServlet, which is a subclass of Servlet.
Any clue ?
Please sign in to leave a comment.
Remove any duplication of Servlet class in your classpath
I have double checked and there is only one occurence of the Servlet/HttpServlet classes in my libraries (as shown by the attached screenshot)
Attachment(s):
servlet.jpg
So far I could not reproduce it. Could you attach your ipr/iml files?
I jsut found that if I switch my project JDK from the WAS 6.0 provided one to IDEA's one, the problem goes away, and comes back if i switch back to WAS 6.0.
Strange thing though, is the WAS 6.0 jdk i've configureed does not include any J2EE classes (it's configured to include only WAS_HOME/java/jre/lib jar files.
My modules both use this WAS 6.0 jdk and WAS 6.1 JEE server libraries. Those 2 do not overlap.
I've also tried replacing the WAS j2ee library with the one bundled in IDEA, and I witness the same problem (works with IDEA jdk, but not with WAS 6 JDK.).
I'm not able to reproduce the problem in a new project though