0

我在 Firefox 上运行并在 Windows 7 上使用 Play!1.2.7、GWT2.6 构建的 Web 应用程序出现问题。我使用 Eclipse Kepler 作为 IDE。

首先,在生产模式下,应用程序可以工作。问题是让它在开发模式下工作,从而启用调试配置。Firefox 的最新版本不支持启用开发模式的插件 GWT,因此,我们使用“超级开发模式”插件代替。

如果我做对了,我们必须先启动应用程序,然后是超级开发模式插件。

首先,要启动应用程序,在命令行中,在应用程序的根目录下,我们执行

            play start

然后,为了启动开发模式,在 Eclipse 中,我们为 java 应用程序配置运行配置:

            Project: MyWebApp
            Main class: com.google.gwt.dev.codeserver.CodeServer
            Program arguments: -src app/ App -workDir C:\Users\user\workspace\MyWebApp\
            classpath, user entries:
            gwt-dev-2.6.0.jar - \MyWebApp\lib
            gwt-user-2.6.0.jar - \MyWebApp\lib
            gwt-codeserver-2.6.0.jar - \MyWebApp\lib
            app - - \MyWebApp\
            src - C:\play-1.2.7\modules\gwt2-1.8\
            play-1.2.7 - C:\

当我运行此 java 应用程序时,出现以下错误:

            workDir: C:\Users\user\workspace\MyWebApp
            deleting: C:\Users\user\workspace\MyWebApp\App\compile-1
            binding: user.agent=safari
            binding: compiler.useSourceMaps=true
            binding: locale=en
            Compiling module App
               Validating units:
                  Ignored 81 units with compilation errors in first pass.
            Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
               Computing all possible rebind results for 'com.google.gwt.useragent.client.UserAgentAsserter'
                  Rebinding com.google.gwt.useragent.client.UserAgentAsserter
                     Checking rule <generate-with class='com.google.gwt.editor.rebind.SimpleBeanEditorDriverGenerator'/>
                        [WARN] Detected warnings related to 'com.google.gwt.editor.client.SimpleBeanEditorDriver'.   Are validation-api-<version>.jar and validation-api-<version>-sources.jar on the classpath?
                        Specify -logLevel DEBUG to see all errors.
                        [WARN] Unknown type 'com.google.gwt.editor.client.SimpleBeanEditorDriver' specified in deferred binding rule
               Compiling 1 permutation
                  Compiling permutation 0...
                  Source Maps Enabled
               Compile of permutations succeeded
            Linking into C:\Users\user\workspace\MyWebApp\App\compile-1\war\myModule; Writing extras to C:\Users\user\workspace\MyWebApp\App\compile-1\extras\myModule
               Invoking Linker Export CompilationResult symbol maps
                  [ERROR] Failed to link
            com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
                at com.google.gwt.core.ext.linker.impl.StandardLinkerContext.invokeLinkForOnePermutation(StandardLinkerContext.java:376)
                at com.google.gwt.dev.Link.finishPermutation(Link.java:480)
                at com.google.gwt.dev.Link.doSimulatedShardingLink(Link.java:442)
                at com.google.gwt.dev.Link.link(Link.java:175)
                at com.google.gwt.dev.Compiler.run(Compiler.java:200)
                at com.google.gwt.dev.codeserver.Recompiler.compile(Recompiler.java:115)
                at com.google.gwt.dev.codeserver.ModuleState.<init>(ModuleState.java:58)
                at com.google.gwt.dev.codeserver.CodeServer.makeModules(CodeServer.java:120)
                at com.google.gwt.dev.codeserver.CodeServer.start(CodeServer.java:95)
                at com.google.gwt.dev.codeserver.CodeServer.main(CodeServer.java:71)
                at com.google.gwt.dev.codeserver.CodeServer.main(CodeServer.java:49)
            java.lang.NoClassDefFoundError: org/json/JSONException
                at com.google.gwt.thirdparty.debugging.sourcemap.SourceMapGeneratorV3.mergeMapSection(SourceMapGeneratorV3.java:243)
                at com.google.gwt.core.linker.SymbolMapsLinker.link(SymbolMapsLinker.java:308)
                at com.google.gwt.core.ext.linker.impl.StandardLinkerContext.invokeLinkForOnePermutation(StandardLinkerContext.java:373)
                at com.google.gwt.dev.Link.finishPermutation(Link.java:480)
                at com.google.gwt.dev.Link.doSimulatedShardingLink(Link.java:442)
                at com.google.gwt.dev.Link.link(Link.java:175)
                at com.google.gwt.dev.Compiler.run(Compiler.java:200)
                at com.google.gwt.dev.codeserver.Recompiler.compile(Recompiler.java:115)
                at com.google.gwt.dev.codeserver.ModuleState.<init>(ModuleState.java:58)
                at com.google.gwt.dev.codeserver.CodeServer.makeModules(CodeServer.java:120)
                at com.google.gwt.dev.codeserver.CodeServer.start(CodeServer.java:95)
                at com.google.gwt.dev.codeserver.CodeServer.main(CodeServer.java:71)
                at com.google.gwt.dev.codeserver.CodeServer.main(CodeServer.java:49)
            Caused by: java.lang.ClassNotFoundException: org.json.JSONException
                at java.net.URLClassLoader$1.run(Unknown Source)
                at java.net.URLClassLoader$1.run(Unknown Source)
                at java.security.AccessController.doPrivileged(Native Method)
                at java.net.URLClassLoader.findClass(Unknown Source)
                at java.lang.ClassLoader.loadClass(Unknown Source)
                at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
                at java.lang.ClassLoader.loadClass(Unknown Source)
                ... 13 more

你有什么想法来解决这个问题吗?非常感谢!

问候,

4

1 回答 1

0

我将最新的 JSON 库添加到我的类路径中,它解决了问题。对于 Maven 用户,将以下内容添加到您的 pom.xml 将防止该错误。

<dependency>
    <groupId>org.json</groupId>
    <artifactId>json</artifactId>
    <version>20140107</version>
    <scope>provided</scope>
</dependency>

请注意,我不确定哪个版本最适合使用。我使用的是 GWT 2.6.1

PS:这类似于另一个问题/回复:https ://stackoverflow.com/a/16989851/358006

于 2014-05-27T00:49:33.053 回答