我试图在Google App Engine上运行应用程序(应用程序正在使用maven),因此我运行以下内容:
mvn appengine:update
返回:
...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 31.239 s
[INFO] Finished at: 2017-01-12T11:04:35-05:00
[INFO] Final Memory: 21M/422M
[INFO] ------------------------------------------------------------------------
然后
mvn appengine:devserver
返回
...
[INFO] INFO: The admin console is running at http://localhost:8080/_ah/admin
[INFO] Jan 12, 2017 11:06:05 AM com.google.appengine.tools.development.DevAppServerImpl doStart
[INFO] INFO: Dev App Server is now running
所以我认为构建正在更新,我也可以在线成功部署。
但我仍然在my_project.appspot.com上收到错误
和本地当我尝试运行相同的应用程序时(使用mvn appengine运行服务器:devserver或在eclipse上运行它同样尝试两者都是出于测试原因):
我猜测我的web.xml可能有错误,但我仔细检查并将其与HelloWorldServlet示例或Guest Book示例进行比较,它看起来几乎相同,这里是:
<?xml version="1.0" encoding="utf-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" version="2.5">
<servlet>
<servlet-name>AdWords</servlet-name>
<servlet-class>MyApp.adwords_axis.MainApp</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>AdWords</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>
此处还有我试图致电
的班级package myApp.adwords_axis;
import java.io.IOException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@SuppressWarnings("serial")
@WebServlet(name = "AdWords", value = "/")
public class MainApp extends HttpServlet{
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response)
{
response.setContentType("text/plain");
try {
response.getWriter().println("Test");
//run();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static void run() throws Exception {
AdReport ads = new AdReport();
GenderReport genderReport = new GenderReport();
CriteriaReport criteriaReport = new CriteriaReport();
ads.start();
genderReport.start();
criteriaReport.start();
}
//Add Audience before deploying beta.
}
app.yaml(当我做mvn appengine:update
时从未生成过),我从示例中删除并将其放在src / main / appengine下面,如下所示:
runtime: java
env: flex
handlers:
- url: /.*
script: this field is required, but ignored
secure: always # Require HTTPS
runtime_config: # Optional
jdk: openjdk7
server: jetty9
manual_scaling:
instances: 1
我错过了什么?
答案 0 :(得分:0)
好的,我通过dectuple检查我的web.xml解决了这个问题。我有一个错字并打破了整个应用程序。
我的包是以web.xml中的大写字母开头的,不应该这样。