web.xml中的jsp-file在tomcat中不起作用

时间:2012-08-22 21:10:15

标签: tomcat

我有一个示例web.xml,如下所示

<servlet>
    <servlet-name>Authorize</servlet-name>
    <jsp-file>/WEB-INF/jsp/facebook/authorize.jsp</jsp-file>
</servlet>

<servlet>
    <servlet-name>postAuthorize</servlet-name>
    <jsp-file>/WEB-INF/jsp/facebook/post_authorize.jsp</jsp-file>
</servlet>

<servlet>
    <servlet-name>referrerLink</servlet-name>
    <jsp-file>/WEB-INF/jsp/facebook/refer.jsp</jsp-file>
</servlet>

<servlet>
    <servlet-name>checkin</servlet-name>
    <jsp-file>/WEB-INF/jsp/facebook/checkin.jsp</jsp-file>
</servlet>

如果我访问/checkins/facebook/refer(签到是我的上下文路径),我将获得以下堆栈跟踪。

javax.servlet.ServletException: No servlet class has been specified for servlet referrerLink
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
java.lang.Thread.run(Thread.java:662)

我有jsp目录和WEB-INF。

1 个答案:

答案 0 :(得分:2)

如果属性metadata-complete="true"出现在web.xml的顶级元素中,请尝试将其删除。