GWT/ Eclipse: ClassNotFoundException com/google/gwt/dev/Compiler
Asked Answered
K

8

6

i recently updated from GWT 2.0.4 to 2.1.0. Since then I cannot compile my GWT application anymore. When I click on the GWT compile button of the GWT eclipse plugin I get the following error:

java.lang.NoClassDefFoundError: com/google/gwt/dev/Compiler
Caused by: java.lang.ClassNotFoundException: com.google.gwt.dev.Compiler
 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:307)
 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Exception in thread "main"

Also I can't create a new GWT project in Eclipse. In the new New Web Application Project Dialog one can choose to use GWT and/or Google App Engine. When check "Use GWT" a error dialog raises up which says: "Creation of element failed. Reason: Invocation of com.google.gwt.user.tools.WebAppCreator failed. See the error log for more details."

In the log file (<workspace>/.metadata/.log) I can see the message:

!ENTRY org.eclipse.jdt.ui 4 10001 2010-11-02 08:34:50.085
!MESSAGE Internal Error
!STACK 1
Java Model Exception: Core Exception [code 0] Invocation of com.google.gwt.user.tools.WebAppCreator failed. See the error log for more details.
 at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:50)
 at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:728)
 at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975)
 at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:4777)
 at org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:106)
 at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Caused by: org.eclipse.core.runtime.CoreException: Invocation of com.google.gwt.user.tools.WebAppCreator failed. See the error log for more details.
 at com.google.gwt.eclipse.core.runtime.tools.WebAppProjectCreatorRunner.createProject(WebAppProjectCreatorRunner.java:53)
 at com.google.gdt.eclipse.suite.wizards.WebAppProjectCreator.createGWTProject(WebAppProjectCreator.java:532)
 at com.google.gdt.eclipse.suite.wizards.WebAppProjectCreator.create(WebAppProjectCreator.java:294)
 at com.google.gdt.eclipse.suite.wizards.NewWebAppProjectWizard.finishPage(NewWebAppProjectWizard.java:147)
 at org.eclipse.jdt.internal.ui.wizards.NewElementWizard$2.run(NewElementWizard.java:117)
 at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:39)
 at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:728)
 at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975)
 at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:4777)
 at org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:106)
 at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
!SUBENTRY 1 com.google.gwt.eclipse.core 4 0 2010-11-02 08:34:50.085
!MESSAGE Invocation of com.google.gwt.user.tools.WebAppCreator failed. See the error log for more details.

gwt-dev.jar, gwt-user.jar and many other google-jars are in the classpath...

Does anyone have an idea how to solve this issue? I also set up a new fresh Eclipse installation, installed the new GWT plugin, and chose a new workspace directory, but this still gives me the errors...

Additional information:

  • Windows XP,
  • Eclipse for Java EE 3.6 Helios,
  • J2EE / Java 1.6.0_22-b04
  • Google Plugin for Eclipse 3.6 1.4.0.v201010280102,
  • Google App Engine Java SDK 1.3.8 1.3.8.v201010161055
  • Google Web Toolkit SDK 2.1.0 2.1.0.v201010280102
Kevel answered 2/11, 2010 at 8:2 Comment(0)
M
4

I had the same problem not being able to create a new GWT-project in Eclipse. Removing the Classpath variable from my windows environment variables (appearently interfering with the settings in Eclipse) solved the problem for me.

Marital answered 11/11, 2010 at 15:8 Comment(1)
Thank you! That did the trick! Unfortunatly I run into another problem: [ERROR] Unable to find 'GWTModule/gwt/xml.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source? Looks like somtehing got messed up when I was playing around with different GWT versions.Kevel
P
1

In my case the jar (gwt-dev-2.1.0.jar) downloaded from the google maven repo was corrupt! I replace the jar in my repo with a one containing the classes and mvn gwt:run worked!

hope this helps.

Papp answered 9/11, 2010 at 0:38 Comment(2)
I don't use maven. I installed the gwt plungin direclty from the gwt update site... i tried to reinstall the plugin, replace the plugin gwt-sdk with one downloaded from the google page but all didn't help. :(Kevel
I experienced the exact same issue. My JAR contained HTML. Redownloading fixed this. At some point someone must've messed something up with the repository we are/were using.Apollo
S
1

I was facing a similar issue where I was getting constantly java.lang.NoClassDefFoundError: com/google/gwt/dev/Compiler. While searching around I realized that the gwt version was missing a file from inside the gwt-dev folder inside the gwt installation directory.

Actually, I am using maven and gwt 2.5.0 for my project, and I discovered that inside .m2\repository\com\google\gwt\gwt-dev\2.5.0 folder should exist four files in order for gwt compiler to work. Those are

  • gwt-dev-2.5.0.jar <-sometimes this is corrupted
  • gwt-dev-2.5.0.jar.sha1 <- this one was missing
  • gwt-dev-2.5.0.pom
  • gwt-dev-2.5.0.pom.sha1
Strobe answered 18/1, 2013 at 16:11 Comment(0)
T
0

Go to your Project Properties / Build Path there move the "GWT library" to the top of the BuildPath.

Now try to recompile again.

Tritium answered 2/11, 2010 at 8:20 Comment(2)
Unfortunately that didn't help. My classpath order now is: GWT SDK, jdk, glassfish libs, a lot of other jars, my project directory But I still get the NoClassDefFoundError and I can't create a new GWT project. I will now try to set up a completely new environment in a VM...Kevel
The upgrade to 2.1 is a bit painful. I had problems in my 2 computers. Moving the GWT in the buildpath helped in both systems, but in one I also needed to clear all the cached files. In my OSX I even needed to restart completely the computer (for some weird reason)Tritium
L
0

I just, remove and include again gwt-dev.jar and start to work.

Lentha answered 17/7, 2013 at 21:46 Comment(0)
L
0

I fix that problem doing this:

  • remove GWT lib from your project
  • update gwt plugins for eclipse
  • put the lib back in your project
  • Done
Lacedaemonian answered 24/7, 2013 at 12:46 Comment(0)
F
0

I had the same problem, some java program had been installed declaring a "ClassPath" environment variable, and invalidating the gwt plugin for ANY version of eclipse, from 3.6 (helios) to 4.2 (juno). Note that environment variables are case-insensitive in Windows OSs. Solution: eliminate the system/user variable declaration and declare the variable in a/the launch script for the concerned program.

Fustian answered 30/5, 2014 at 13:54 Comment(0)
D
0

My understanding is:

When GWT compiles a project, it needs the tool "com.google.gwt.dev.Compiler" (which has a "main" entry point); however, GWT does not use Eclipse project's "build path" setting to find the tool, instead, it looks at OS's "classpath" system variable.

So, I think the solution is to add "D:\Java\GWT\gwt-2.6.1\*;" (my case as example) into "classpath" and restart Eclipse. It works well for me since.

Danilodanio answered 6/11, 2014 at 12:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.