[英]HTTP 500 Internal Server Error In App Engine
此代码写入数据存储区
package pack.exp;
@SuppressWarnings("serial")
public class WriteServlet extends HttpServlet
{
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws...
{
Entity ent= new Entity("Employee", "E");
ent.setProperty("FirstName", "Agent");
ent.setProperty("LastName", "47");
DatastoreService ds= DatastoreServiceFactory.getDatastoreService();
ds.put(ent);
resp.setContentType("text/plain");
resp.getWriter().println("File Saved");
}
}
这是从数据存储中读取
package pack.exp;
@SuppressWarnings("serial")
public class ReadServlet extends HttpServlet
{
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws
{
super.doGet(req, resp);
DatastoreService ds= DatastoreServiceFactory.getDatastoreService();
Key k= KeyFactory.createKey("Employee", "E");
try
{
Entity ent= ds.get(k);
String fN= (String) ent.getProperty("FirstName");
String lN= (String) ent.getProperty("LastName");
resp.setContentType("text/plain");
resp.getWriter().println("Reading From the Database " + fN );
}
catch (EntityNotFoundException e)
{
e.printStackTrace();
}
}
}
当我部署应用程序时,它会显示appspot页面,但是当我单击项目时,它会在App Engine中显示HTTP 500 Internal Server Error
您正在使用GAE上不支持的AWT的某些部分(没有窗口式UI可以说)。 删除该库/软件包,或正在使用的任何软件包。
顺便说一句,这个错误也应该出现在开发服务器上。 在部署之前,您将节省大量时间在开发服务器上进行本地测试。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.