Info-System

GWT and Eclipse classpath Problem

E-mail Print PDF

 

Today I have spent a lot of time struggling with a strange problem, which reveal after an import of an existing (properly working project) to a new environment. It seemed that the conditions were the same:

  • Same sources
  • Same eclipse plugins
  • Same 3rd party libs
  • Etc.

but I encouterd following errors:

Compiling module com.infosystem.forms.Rules
   Validating newly compiled units
      Ignored 77 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.user.client.UserAgentAsserter'
      Rebinding com.google.gwt.user.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
   [ERROR] Errors in 'jar:file:/C:/eclipses/eclipse-forms-SVN/plugins/
com.google.gwt.eclipse.sdkbundle_2.4.0.v201201120043-rel-r36/gwt-2.4.0/gwt-user.jar
/com/google/gwt/event/shared/SimpleEventBus.java'
      [ERROR] Line 32:  Cannot cast from GwtEvent.Type<H> to Event.Type<H>
      [ERROR] Line 42:  Cannot cast from GwtEvent.Type<H> to Event.Type<H>
   [ERROR] Errors in 'jar:file:/C:/eclipses/eclipse-forms-SVN/plugins/
com.google.gwt.eclipse.sdkbundle_2.4.0.v201201120043-rel-r36/gwt-2.4.0/gwt-user.jar!
/com/google/gwt/event/shared/EventBus.java'
      [ERROR] Line 67:  Cannot cast from GwtEvent<capture#1-of ?> to Event<?>
      [ERROR] Line 75:  Cannot cast from GwtEvent<capture#3-of ?> to Event<?>
   Scanning for additional dependencies: jar:file:/C:/eclipses/eclipse-forms-SVN/
plugins/com.google.gwt.eclipse.sdkbundle_2.4.0.v201201120043-rel-r36/gwt-2.4.0
/gwt-user.jar!/com/google/gwt/user/client/ui/DisclosurePanel.java
      Computing all possible rebind results for 'com.google.gwt.user.client.ui.DisclosurePanel.DefaultImages'
         Rebinding com.google.gwt.user.client.ui.DisclosurePanel.DefaultImages
            Checking rule <generate-with class='com.extjs.gxt.ui.rebind.core.BeanModelGenerator'/>
               [ERROR] Errors in 'jar:file:/C:/eclipses/eclipse-forms-SVN/plugins/
com.google.gwt.eclipse.sdkbundle_2.4.0.v201201120043-rel-r36/gwt-2.4.0/gwt-user.jar!
/com/google/gwt/event/shared/UmbrellaException.java'
                  [ERROR] Line 24: 
No source code is available for type com.google.web.bindery.event.shared.UmbrellaException; 
did you forget to inherit a required module?
               [ERROR] Unable to find type 'com.google.gwt.user.client.ui.DisclosurePanel.DefaultImages'
                  [ERROR] Hint: Previous compiler errors may have made this type unavailable
                  [ERROR] Hint: Check the inheritance chain from your module; 
it may not be inheriting a required module or a module may not be adding its source path entries properly
                  [ERROR] Hint: Check that your module inherits 'com.google.gwt.user.User' either directly or indirectly
   [ERROR] Errors in 'jar:file:/C:/eclipses/eclipse-forms-SVN/plugins
/com.google.gwt.eclipse.sdkbundle_2.4.0.v201201120043-rel-r36/gwt-2.4.0/gwt-user.jar!
/com/google/gwt/user/client/ui/DisclosurePanel.java'
      [ERROR] Line 93:  
Failed to resolve 'com.google.gwt.user.client.ui.DisclosurePanel.DefaultImages' via deferred binding
   [ERROR] Cannot proceed due to previous errors
 

SOLUTION

It turned out that the order of libraries in the .classPath of the Eclipse project is important and should be as follows:

  1. Firstly the main gwt jars (gwt-user i gwt-dev),
  2. Secondly other GWT related jars such as SmartGwt or gxt (please rememeber that to use a specific gxt jar for made for certain version of GWT)
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
	<classpathentry kind="src" path="src"/>
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/

org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre6">
		<attributes>
			<attribute name="owner.project.facets" value="java"/>
		</attributes>
	</classpathentry>
	<classpathentry kind="con" 
path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.generic.runtimeTarget/JBoss v4.2">
		<attributes>
			<attribute name="owner.project.facets" value="jst.web"/>
		</attributes>
	</classpathentry>
	<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
	<classpathentry kind="lib"     path="ECLIPSE_GWT_PLUGIN_HOME/gwt-user.jar">
</classpathentry>
<classpathentry kind="lib" path="
ECLIPSE_GWT_PLUGIN_HOME/gwt-dev.jar">
</classpathentry>
<classpathentry kind="lib" path="war/WEB-INF/lib/gxt.jar"/> <classpathentry kind="lib" path="war/WEB-INF/lib/smartgwt.jar"/> <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/> <classpathentry kind="output" path="war/WEB-INF/classes"/> </classpath>

Extra sources: dobesland.wordpress.com/2007/07/29/tip-fix-classpath-order-for-eclipsegwt-for-happiness/

Add comment


Security code
Refresh

Joomlart