【问题标题】:Java Servlet not runningJava Servlet 未运行
【发布时间】:2017-02-17 17:41:20
【问题描述】:

我正在使用 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.

有人知道怎么回事吗?

【问题讨论】:

  • 给你 404 的 url 是什么?
  • 的确切部分"note 异常的完整堆栈跟踪及其根本原因可在 GlassFish Server Open Source Edition 4.1 日志中找到。" 你不明白吗?
  • @BalusC 我找不到它告诉我要道歉的日志:/
  • javax.ejb.EJBException - 显然您的 EJB 方法有问题。

标签: java jsp servlets


【解决方案1】:

HTTP 状态 500 表示服务器遇到了意外情况,阻止了它完成请求。您可能对请求/响应有误。请检查您的代码,然后重试。

【讨论】:

    猜你喜欢
    • 2012-09-17
    • 2011-05-16
    • 2013-08-20
    • 2013-07-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-02-25
    • 2012-10-22
    相关资源
    最近更新 更多