运行 GWT 的“MobileWebApp”示例时出现“HTTP 错误:500 无领域”

2024-04-27

我正在尝试运行 GWT 2.4 示例应用程序“MobileWebApp”。当我尝试通过 Eclipse 在开发模式下运行应用程序时,出现 500“No Realm”错误。

我知道这是一个身份验证问题。

我不熟悉 Google App Engine 或 Jetty,但通过查看 web.xml,我可以看到有一个 servlet 过滤器,它使用 appengine UserService 大概将用户重定向到 Google 进行身份验证。

我在用着:

  • Eclipse 3.7(Indigo SR1)
  • Eclipse 2.4 的 Google 插件
  • m2eclipse

我在下面包含了 web.xml 的摘录。我不确定还有哪些其他信息有助于诊断此问题。

  <security-constraint>
    <display-name>
      Redirect to the login page if needed before showing
      the host html page.
    </display-name>
    <web-resource-collection>
      <web-resource-name>Login required</web-resource-name>
      <url-pattern>/MobileWebApp.html</url-pattern>
    </web-resource-collection>
    <auth-constraint>
      <role-name>*</role-name>
    </auth-constraint>
  </security-constraint>

  <filter>
    <filter-name>GaeAuthFilter</filter-name>
    <!--
      This filter demonstrates making GAE authentication
      services visible to a RequestFactory client.
    -->
    <filter-class>com.google.gwt.sample.gaerequest.server.GaeAuthFilter</filter-class>
  </filter>
  <filter-mapping>
    <filter-name>GaeAuthFilter</filter-name>
    <url-pattern>/gwtRequest/*</url-pattern>
  </filter-mapping>

以下是 Eclipse 控制台中的输出:

[WARN] Request /MobileWebApp.html failed - no realm
[ERROR] 500 - GET /MobileWebApp.html?gwt.codesvr=127.0.0.1:9997 (127.0.0.1) 1401 bytes
   Request headers
      Host: 127.0.0.1:8888
      User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1
      Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
      Accept-Language: en-us,en;q=0.5
      Accept-Encoding: gzip, deflate
      Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
      Connection: keep-alive
   Response headers
      Content-Type: text/html; charset=iso-8859-1
      Content-Length: 1401

非常感谢您提供任何有用的建议!

2011 年 11 月 11 日编辑:我添加了 Jetty 标签,因为它似乎与此问题相关。


如果您的第一个请求失败,仅获取 /MobileWebApp.html 页面,那么它可能不是身份验证问题。您是否为该项目启用了 GAE(不仅是 GWT)?这可能是一个问题。

我在某处读到,在 Eclipse 中调试应用程序有两种方法,一种是 run as/webapp,但忘记了另一种是哪种(我不使用 Eclipse)。其中一个有效,另一个无效。

如果这不起作用,您可以尝试更换内置码头:

  • 添加 GWT 参数:-server com.google.appengine.tools.development.gwt.AppEngineLauncher
  • 虚拟机参数:-javaagent:/path_to/appengine-agent.jar

最后一个选项是使用 -noserver,但是您将无法调试服务器端代码,只能调试客户端 GWT 内容:首先使用 mvn jetty:run 启动 jetty,然后使用 -noserver GWT 参数在 Eclipse 中进行调试。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

运行 GWT 的“MobileWebApp”示例时出现“HTTP 错误:500 无领域” 的相关文章

随机推荐