[英]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.