我是开发Google App Engine的初学者,因此我尝试遵循基本的Java教程。目前,我已按照“{Guestbook”应用程序的step 3 of Building and testing the app执行了所有步骤。
我在终端中执行mvn appengine:devserver
,但当我在浏览器中转到localhost:8080
时,会看到以下消息。
HTTP ERROR: 503
Problem accessing /. Reason:
SERVICE_UNAVAILABLE
在我启动服务器的终端中,由于此错误,我看不到任何输出。任何人都可以提供任何洞察这个问题?
修改 - localhost:8080/guestbook
也会产生同样的HTTP 503错误
这是我的web.xml文件(从GAE教程页面复制):
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE web-app PUBLIC
"-//Oracle Corporation//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app xmlns="http://java.sun.com/xml/ns/javaee" version="2.5">
<servlet>
<servlet-name>guestbook</servlet-name>
<servlet-class>com.google.appengine.demos.guestbook.GuestbookServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>guestbook</servlet-name>
<url-pattern>/guestbook</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>guestbook.jsp</welcome-file>
</welcome-file-list>
</web-app>
这是他们提供的guestbook.jsp(如果这有帮助):
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="com.google.appengine.api.users.User" %>
<%@ page import="com.google.appengine.api.users.UserService" %>
<%@ page import="com.google.appengine.api.users.UserServiceFactory" %>
<%@ page import="java.util.List" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<html>
<head>
<link type="text/css" rel="stylesheet" href="/stylesheets/main.css"/>
</head>
<body>
<%
String guestbookName = request.getParameter("guestbookName");
if (guestbookName == null) {
guestbookName = "default";
}
pageContext.setAttribute("guestbookName", guestbookName);
UserService userService = UserServiceFactory.getUserService();
User user = userService.getCurrentUser();
if (user != null) {
pageContext.setAttribute("user", user);
%>
<p>Hello, ${fn:escapeXml(user.nickname)}! (You can
<a href="<%= userService.createLogoutURL(request.getRequestURI()) %>">sign out</a>.)</p>
<%
} else {
%>
<p>Hello!
<a href="<%= userService.createLoginURL(request.getRequestURI()) %>">Sign in</a>
to include your name with greetings you post.</p>
<%
}
%>
<form action="/guestbook.jsp" method="get">
<div><input type="text" name="guestbookName" value="${fn:escapeXml(guestbookName)}"/></div>
<div><input type="submit" value="Switch Guestbook"/></div>
</form>
</body>
</html>