0

The long awaited Super Dev Mode came and I attempted to use it. After building GWT trunk I created a test app and compiled it successfully. I then added this to the module XML file with the intent to enable Source Maps for Chrome:

<!-- Allows debugging without DevMode  -->
<set-property name="compiler.useSourceMaps" value="true">
   <when-property-is name="user.agent" value="safari" />
</set-property>

I then tried to compile the application. The output was the following:

Compiling module com.hsi.gwt.test.sdm.Hello_sdm
   Compiling 6 permutations
      Compiling permutation 0...
      Compiling permutation 1...
      Compiling permutation 2...
      Compiling permutation 3...
      Compiling permutation 4...
      Compiling permutation 5...
      Source Maps Enabled
   Compile of permutations succeeded
Linking into /Users/bbrudnoy/Workspaces/indigo-hsi/hello-sdm/war/hello_sdm
   Invoking Linker Export CompilationResult symbol maps
      [ERROR] Failed to link
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:299)
    at com.google.gwt.core.ext.linker.impl.StandardLinkerContext.invokeLinkForOnePermutation(StandardLinkerContext.java:372)
    at com.google.gwt.dev.Link.finishPermutation(Link.java:491)
    at com.google.gwt.dev.Link.doSimulatedShardingLink(Link.java:453)
    at com.google.gwt.dev.Link.link(Link.java:200)
    at com.google.gwt.dev.Compiler.run(Compiler.java:262)
    at com.google.gwt.dev.Compiler.run(Compiler.java:198)
    at com.google.gwt.dev.Compiler$1.run(Compiler.java:170)
    at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:88)
    at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:82)
    at com.google.gwt.dev.Compiler.main(Compiler.java:177)
Caused by: java.lang.ClassNotFoundException: org.json.JSONException
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    ... 12 more

What am I missing?

Boris Brudnoy
  • 2,405
  • 18
  • 28

2 Answers2

2

If you use Maven then add the following to your pom.xml file. It should help you overcome that problem.

<dependency>
    <groupId>org.json</groupId>
    <artifactId>json</artifactId>
    <version>20090211</version>
</dependency>
David Phan
  • 21
  • 2
0

EDIT: this is fixed in GWT 2.5

This is a known issue: http://code.google.com/p/google-web-toolkit/issues/detail?id=7397

As a quick workaround, you can add the gwt-servlet-deps.jar to the classpath.

BTW, Super Dev Mode will automatically generate source maps, you don't need to enable them in your module (but for now you have to enable Super Dev Mode and use the xsiframe linker)

Thomas Broyer
  • 64,353
  • 7
  • 91
  • 164
  • I think answering with "you can add the gwt-servlet-deps.jar to the classpath" is quite inappropriate here. What can "the the gwt-servlet-deps.jar" be? There are no "the jarfiles", I can make my own and it would probably not help. Also I cannot find one that comes with GWT, so which one do you mean? – Steven Roose Jan 04 '13 at 10:47
  • I mean the gwt-servlet-deps.jar file that comes in the SDK bundle you can download from https://code.google.com/p/google-web-toolkit/downloads/list or https://developers.google.com/web-toolkit/download or install as an Eclipse plugin (in that case, the JAR is somewhere within your Eclipse install folder, next to the gwt-user.jar and gwt-dev.jar). But well, this issue is fixed in GWT 2.5. – Thomas Broyer Jan 04 '13 at 10:53
  • It seems not to be. I have 2.5 and I have no gwt-servlet-deps.jar. The weird thing is, org.json is included in gwt-dev.jar so I have no idea why he can't find the class. – Steven Roose Jan 04 '13 at 16:11
  • I can't really tell for the Eclipse plugin but the gwt-2.5.0.zip definitely contains a gwt-servlet-deps.jar file (as is the case since GWT 2.2). But again, and as you noted, gwt-dev.jar now contains org.json in 2.5 so the error _should_ no longer appear (and I'm afraid I have no idea either why it happens in your case). – Thomas Broyer Jan 04 '13 at 16:21
  • I checked the SDK folder and it contains a lot more JARs than are included in my Eclipse project, although I just included the pre-configured GWT SDK. I get only 4: gwt-user, gwt-dev and 2 validation-api-1.0.0-xxx jars. Guess I'll make a new question – Steven Roose Jan 04 '13 at 16:26
  • FYI: everything in gwt-servlet-deps.jar should already be in gwt-dev.jar or gwt-user.jar. gwt-servlet-deps.jar, as its name implies, is intended to be deployed alongside gwt-servlet.jar in your war's WEB-INF/lib and contains gwt-servlet.jar dependencies. The proposed workaround here (in GWT 2.4) is to add gwt-servlet-deps.jar to your build path because gwt-dev.jar mistakenly didn't contain org.json. – Thomas Broyer Jan 04 '13 at 16:39