Java Servlet未运行

时间:2017-02-17 17:41:20

标签: java jsp servlets

我正在使用netbeans和Glassfish,但我的servlet似乎没有运行。我跟着本教程完全一样 https://www.youtube.com/watch?v=_zW27Y2boCo

但是当我尝试运行servlet时,它会给我一个错误消息,如

HTTP Status 404 - Not Found

type Status report

messageNot Found

descriptionThe requested resource is not available.

这是我的web.xml文件:

<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
     version="3.1">
    <servlet>
        <servlet-name>StudentServlet</servlet-name>
        <servlet-class>com.sushan.controller.StudentServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>StudentServlet</servlet-name>
        <url-pattern>/StudentServlet</url-pattern>
    </servlet-mapping>

    <welcome-file-list>
        <welcome-file>studentInfo.jsp</welcome-file>
    </welcome-file-list>

</web-app>

通常当我尝试单独运行servlet时,它应该打开,即使通过jsp执行它,它也会出现这样的错误

HTTP Status 500 - Internal Server Error

type Exception report

messageInternal Server Error

descriptionThe server encountered an internal error that prevented it from fulfilling this request.

exception

javax.ejb.EJBException: Transaction aborted
note The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 4.1 logs.

任何人都知道发生了什么事?

1 个答案:

答案 0 :(得分:-1)

HTTP状态500 表示服务器遇到意外情况,导致服务器无法完成请求。您可能在请求/响应方面有错误。检查您的代码,然后重试。