JSP Servlet Mapping
shelleyb Aug 5, 2011 1:46 PMWhen mapping a servlet to a jsp-file rather than a servlet-class on JBoss AS 7, the servlet is marked as unavailable due to the following exception: "javax.servlet.ServletException: No servlet class has been specified for servlet jsp."
12:29:36,992 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/jsp-test]] (MSC service thread 1-10) Servlet /jsp-test threw load() exception: javax.servlet.ServletException: No servlet class has been specified for servlet jsp at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1149) [jbossweb-7.0.0.CR4.jar:7.0.0.Final] at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1102) [jbossweb-7.0.0.CR4.jar:7.0.0.Final] at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3631) [jbossweb-7.0.0.CR4.jar:7.0.0.Final] at org.apache.catalina.core.StandardContext.start(StandardContext.java:3844) [jbossweb-7.0.0.CR4.jar:7.0.0.Final] at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:70) [jboss-as-web-7.0.0.Final.jar:7.0.0.Final] at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1765) at org.jboss.msc.service.ServiceControllerImpl$ClearTCCLTask.run(ServiceControllerImpl.java:2291) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_26] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_26] at java.lang.Thread.run(Thread.java:662) [:1.6.0_26]
The servlet mapping is as follows in my 2.5 web deployment descriptor:
<servlet> <servlet-name>jsp</servlet-name> <jsp-file>/jsp.jspx</jsp-file> </servlet> <servlet-mapping> <servlet-name>jsp</servlet-name> <url-pattern>/jsp</url-pattern> </servlet-mapping>
The servlet specification allows servlets to be mapped to either a servlet-class or jsp-file, so the web.xml itself is valid. I'm wondering why the exception seems to indicate that a servlet class must be specified. Also note that this code deploys and runs correctly on Tomcat 7 and WAS 7. Is there something else that I need to configure to allow this servlet to load?