Boris Brudnoy
Boris Brudnoy

Reputation: 2460

java.lang.NoClassDefFoundError: org/json/JSONException when attempting to use Source Maps

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?

Upvotes: 0

Views: 7485

Answers (2)

David Phan
David Phan

Reputation: 21

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>

Upvotes: 2

Thomas Broyer
Thomas Broyer

Reputation: 64541

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)

Upvotes: 0

Related Questions