【问题标题】:HTTP 500 Internal Server Error In App EngineApp Engine 中的 HTTP 500 内部服务器错误
【发布时间】:2013-12-04 02:01:36
【问题描述】:

此代码写入数据存储区

    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();
    }
     }
      }

当我部署应用程序时,它会显示 apppot 页面,但是当我点击我的项目时,它会在 App Engine 中给出 HTTP 500 Internal Server Error

【问题讨论】:

  • 我无法检测到错误。
  • 错误日志是怎么说的?
  • 内部错误在检索 KeyboardFocusManagerPeerProvider 的附加 javadoc [in KeyboardFocusManagerPeerProvider.class [in sun.awt [in C:\Program Files\Java\jre7\lib\rt.jar]]]]
  • 内部错误在检索代理 {key=Lsun/management/Agent;} [in Agent.class [in sun.management [in C:\Program Files\Java\jre7 的附加 javadoc 时超时\lib\rt.jar]]]

标签: java google-app-engine


【解决方案1】:

您正在使用 GAE 不支持的 AWT 的某些部分(没有窗口 UI 可言)。删除该库/包,或任何正在使用它的包。

顺便说一句,这个错误也应该出现在开发服务器上。在部署之前,您将节省大量在开发服务器上进行本地测试的时间。

【讨论】:

  • 我没有使用额外的包。
  • 为什么堆栈跟踪显示 AWT 正在加载?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2020-02-20
  • 2012-02-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多