Sunday, August 22, 2010

GWT error - Unable to find 'Sample.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source


How to solve the error in question?

The solution is in the err message itself, thanks to GWT.
Though the exact cause depends on your environment, following addresses common scenarios

a. If the module definition XML (i.e. 'Sample.gwt.xml' here) is in the same GWT module that you are compiling via GWT compiler (or running in development mode) then check if the desired xml has been put in package that's just before above your client package. Importantly the module definition should be in the source path so that it falls in the GWT module's classpath.
 i.e. if your client package is 
samples.gwt.client
then Sample.gwt.xml should go into 
samples.gwt

b. If the module definition XML is in a dependent module that you have inherited in your parent (or main) module definition Main.gwt.xml (say) then ensure that the logical name of inherited module definition XML mentioned in <inherit> tag is correct

i.e. you should have 
<inherits name='samples.gwt.Sample'/> 
in 
Main.gwt.xml

This logical name is irrespective of the alternate name, if any, that you have given to 'Sample.gwt.xml' like

<module rename-to='sample-alt-name'>

Also to ensure the trivial case, if you are using IDE check that dependent module exists in Project -> Build Path
and if you use Maven then the dependent module should have been mentioned in <dependency> tag of parent project. 
Hope this helps.





No comments:

Post a Comment