动态Web项目HTTP错误:503

时间:2017-10-01 07:16:40

标签: java mysql eclipse servlets

我正在使用动态Web模块3.0,jdk 1.7在eclipse中创建一个带有mysql数据库连接的动态Web项目 这是我的项目结构 Project structure

web.xml for it

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
  <display-name>Project</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
  <servlet>
  <servlet-name>AdminLogin</servlet-name>
  <servlet-class>com.servlets.AdminLogin</servlet-class>
  </servlet>
  <servlet>
  <servlet-name>AddBook</servlet-name>
  <servlet-class>com.servlets.AddBook</servlet-class>
  </servlet>
  <servlet>
  <servlet-name>AddBookForm</servlet-name>
  <servlet-class>com.servlets.AddBookForm</servlet-class>
  </servlet>
  <servlet>
  <servlet-name>AddLibrarian</servlet-name>
  <servlet-class>com.servlets.AddLibrarian</servlet-class>
  </servlet>
  <servlet>
  <servlet-name>AddLibrarianForm</servlet-name>
  <servlet-class>com.servlets.AddLibrarianForm</servlet-class>
  </servlet>
  <servlet>
  <servlet-name>DeleteBook</servlet-name>
  <servlet-class>com.servlets.DeleteBook</servlet-class>
  </servlet>
  <servlet>
  <servlet-name>DeleteLibrarian</servlet-name>
  <servlet-class>com.servlets.DeleteLibrarian</servlet-class>
  </servlet>
  <servlet>
  <servlet-name>EditLibrarian</servlet-name>
  <servlet-class>com.servlets.EditLibrarian</servlet-class>
  </servlet>
  <servlet>
  <servlet-name>IssueBook</servlet-name>
  <servlet-class>com.servlets.IssueBook</servlet-class>
  </servlet>
  <servlet>
  <servlet-name>IssueBookForm</servlet-name>
  <servlet-class>com.servlets.IssueBookForm</servlet-class>
  </servlet>
  <servlet>
  <servlet-name>LibrarianLogin</servlet-name>
  <servlet-class>com.servlets.LibrarianLogin</servlet-class>
  </servlet>
  <servlet>
  <servlet-name>LogoutAdmin</servlet-name>
  <servlet-class>com.servlets.LogoutAdmin</servlet-class>
  </servlet>
  <servlet>
  <servlet-name>LogoutLibrarian</servlet-name>
  <servlet-class>com.servlets.LogoutLibrarian</servlet-class>
  </servlet>
  <servlet>
  <servlet-name>ReturnBook</servlet-name>
  <servlet-class>com.servlets.ReturnBook</servlet-class>
  </servlet>
  <servlet>
  <servlet-name>ViewBook</servlet-name>
  <servlet-class>com.servlets.ViewBook</servlet-class>
  </servlet>
  <servlet>
  <servlet-name>ViewIssuedBook</servlet-name>
  <servlet-class>com.servlets.ViewIssuedBook</servlet-class>
  </servlet>
  <servlet>
  <servlet-name>ViewLibrarian</servlet-name>
  <servlet-class>com.servlets.ViewLibrarian</servlet-class>
  </servlet>
  <servlet-mapping>
  <servlet-name>AdminLogin</servlet-name>
  <url-pattern>/AdminLogin</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
  <servlet-name>AddBook</servlet-name>
  <url-pattern>/AddBook</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
  <servlet-name>AddBookForm</servlet-name>
  <url-pattern>/AddBookForm</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
  <servlet-name>AddLibrarian</servlet-name>
  <url-pattern>/AddLibrarian</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
  <servlet-name>AddLibrarianForm</servlet-name>
  <url-pattern>/AddLibrarianForm</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
  <servlet-name>DeleteBook</servlet-name>
  <url-pattern>/DeleteBook</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
  <servlet-name>DeleteLibrarian</servlet-name>
  <url-pattern>/DeleteLibrarian</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
  <servlet-name>EditLibrarian</servlet-name>
  <url-pattern>/EditLibrarian</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
  <servlet-name>EditLibrarianForm</servlet-name>
  <url-pattern>/EditLibrarianForm</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
  <servlet-name>IssueBook</servlet-name>
  <url-pattern>/IssueBook</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
  <servlet-name>IssueBookForm</servlet-name>
  <url-pattern>/IssueBookForm</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
  <servlet-name>LibrarianLogin</servlet-name>
  <url-pattern>/LibrarianLogin</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
  <servlet-name>LogoutAdmin</servlet-name>
  <url-pattern>/LogoutAdmin</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
  <servlet-name>LogoutLibrarian</servlet-name>
  <url-pattern>/LogoutLibrarian</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
  <servlet-name>ReturnBook</servlet-name>
  <url-pattern>/ReturnBook</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
  <servlet-name>ReturnBookForm</servlet-name>
  <url-pattern>/ReturnBookForm</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
  <servlet-name>ViewBook</servlet-name>
  <url-pattern>/ViewBook</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
  <servlet-name>ViewIssuedBook</servlet-name>
  <url-pattern>/ViewIssuedBook</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
  <servlet-name>ViewLibrarian</servlet-name>
  <url-pattern>/ViewLibrarian</url-pattern>
  </servlet-mapping>
</web-app>

我只在java resources / lib中包含了mysql-connector.jar。

当我运行它时显示

HTTP ERROR: 503

Problem accessing /Project/AdminLogin. Reason: 
    Service Unavailable


Powered by Jetty:// 

但是当我使用web.xml作为

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
  <display-name>Project</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
  <servlet>
  <servlet-name>AdminLogin</servlet-name>
  <servlet-class>com.servlets.AdminLogin</servlet-class>
  </servlet>
  <servlet-mapping>
  <servlet-name>AdminLogin</servlet-name>
  <url-pattern>/AdminLogin</url-pattern>
  </servlet-mapping>
</web-app>

它会打开AdminLogin页面,但在此之后,当我打开其他servlet时,它会显示错误

HTTP ERROR 404

Problem accessing /Project/AddLibrarianForm. Reason: 
    Not Found

问题是由我的web.xml文件引起的吗?

0 个答案:

没有答案