【问题标题】:"javax.servlet.ServletException: unkown device" in MGWT when generating Html5Manifest File生成 Html5 清单文件时,MGWT 中的“javax.servlet.ServletException:未知设备”
【发布时间】:2013-11-21 10:02:49
【问题描述】:

我使用 mgwt 和 GWTP。在this page 上写了如何生成 Html5Manifest 文件。

在开发模式下运行我的应用程序时出现以下错误:

[WARN] /testmobile.manifest
javax.servlet.ServletException: unkown device
    at com.googlecode.mgwt.linker.server.Html5ManifestServletBase.doGet(Html5ManifestServletBase.java:115)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:324)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
    at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:829)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:513)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
[ERROR] 500 - GET /testmobile.manifest (192.168.178.21) 3009 bytes

这是我的 gwt.xml 文件:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN"
  "http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd">
<module rename-to='testmobile'>
    <!-- Inherit the core Web Toolkit stuff.                        -->
    <inherits name="com.google.gwt.user.User"/>
    <inherits name='com.google.gwt.core.Core'/>
    <inherits name='com.google.gwt.inject.Inject' />
    <inherits name='com.google.gwt.resources.Resources' />

    <inherits name="com.googlecode.mgwt.MGWT"/>

    <!-- Other module inherits                                      -->
    <inherits name='com.gwtplatform.dispatch.Dispatch'/>
    <inherits name='com.gwtplatform.mvp.Mvp' />

    <inherits name="com.googlecode.mgwt.linker.Linker" />
    <add-linker name="permutationmaplinker" />

    <extend-configuration-property name="html5manifestlinker_files" value="./" />
    <extend-configuration-property name="html5manifestlinker_files" value="index.html" />
    <extend-configuration-property name="html5manifestlinker_files" value="index.css" />


  <!-- Specify the app entry point class.                         -->
  <entry-point class='test.mobile.client.Testgwtp'/>


    <inherits name="com.google.gwt.logging.Logging" />
    <set-property name="gwt.logging.logLevel" value="INFO" />
    <set-property name="gwt.logging.enabled" value="TRUE" />
    <set-property name="gwt.logging.popupHandler" value="DISABLED" />
    <set-property name="gwt.logging.developmentModeHandler" value="ENABLED" />  



    <set-configuration-property name="gin.ginjector.modules"
                                value="test.mobile.client.gin.ClientModule"/>

<set-property name="user.agent" value="safari" />

    <!-- Specify the paths for translatable code                    -->
    <source path='client'/>
    <source path='shared'/>

</module>

这是我的 web.xml 文件:

<!-- Default page to serve -->
<welcome-file-list>
    <welcome-file>index.html</welcome-file>
</welcome-file-list>

<!-- https://code.google.com/p/mgwt/wiki/HTML5Manifest -->
<servlet>
    <servlet-name>ManifestServlet</servlet-name>
    <servlet-class>com.googlecode.mgwt.linker.server.MGWTHtml5ManifestServlet</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>ManifestServlet</servlet-name>
    <url-pattern>/testmobile.manifest</url-pattern>
</servlet-mapping>

这是我的 index.html 文件:

<html manifest="/testmobile.manifest">
<head>
    <title>test</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">

      <link type="text/css" rel="stylesheet" href="index.css">
    <script type="text/javascript" language="javascript" src="testmobile/testmobile.nocache.js"></script>
</head>
<body>

    <!-- OPTIONAL: include this if you want history support -->
    <iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe>

</body>
</html>

如何防止出现此错误?

编辑:我在这里找到https://code.google.com/p/mgwt/issues/detail?id=294,当您更改默认排列时您必须更改排列但我不知道如何?

编辑:插入后

<add-linker name="xsiframe"/> 

对于我的 web.xml 文件,我有一个包含以下内容的 compilation-mappings.txt 文件:

3CF5F28779DC3102DF51566915301A19.cache.js
locale default
mobile.user.agent mobilesafari

4086115B0405F7965FF008436AFD8C97.cache.js
locale de
mobile.user.agent mobilesafari

69E3CCD13FF82D3DA3EBC7EDAE5A1588.cache.js
locale de
mobile.user.agent not_mobile

C35440AF74DD89E43810D85756CC4CEE.cache.js
locale default
mobile.user.agent not_mobile

Devmode:devmode.js

【问题讨论】:

  • 您的 gwt 输出 js 文件夹中是否有一个 compilation-mappings.txt 文件?如果有,您可以发布其内容吗?
  • @ManoloCarrascoMoñino 不,我没有这样的文件。需要的话可以发一下吗?
  • 我建议使用 xsiframe 链接器,通过该链接器您可以获得此文件,我们可以确定您的项目中有哪些排列和哪些属性
  • @ManoloCarrascoMoñino 你所说的“xsiframe 链接器”是什么意思,我该如何使用它?
  • 将此行添加到您的&lt;add-linker name="xsiframe"/&gt; 到您的.gwt.xml 总有一天这将成为默认链接器。当您使用该链接器进行编译时,您将在您的 js 文件夹中获得一个 compilation-mappings.txt,其中包含您的排列信息。

标签: java gwt servlets gwt-platform mgwt


【解决方案1】:

如果您将&lt;inherits name="com.googlecode.mgwt.MGWT" /&gt; 添加到您的 gwt.xml 文件中,它应该可以工作。

某些属性(我猜是 mgwt.osmobile.user.agent)可能不存在。它们对于决定必须提供哪个清单很有用。

【讨论】:

  • 我的 web.xml 文件中有这个依赖项。
【解决方案2】:

删除 html 文件中模块名前的“/”

&lt;html manifest="/testmobile.manifest"&gt;

应该是这样的

&lt;html manifest="testmobile.manifest"&gt;

【讨论】:

  • 这并不能解决问题。还有其他想法吗?
  • 你好,我也有同样的错误,你知道怎么解决吗?
猜你喜欢
  • 2015-12-10
  • 2018-03-01
  • 2021-12-16
  • 1970-01-01
  • 2022-06-27
  • 2015-04-09
  • 2014-06-23
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多