Troubles with basic setup in Eclipse

dear community,

After upgrading from 6.3.1 to 6.3.2, I’m having troubles, most probably not related to the new version, but only to my ability to brake things.

1, after I upgraded vaadin library in eclipse preferences (I downloaded 6.3.2 jar through eclipse), I’m no longer able to build even simple example. I followed this dummy tutorial - http://vaadin.com/eclipse and I ended up with:

javax.servlet.ServletException: Failed to load application class: com.example.testproject.TestprojectApplication
	at com.vaadin.terminal.gwt.server.ApplicationServlet.init(ApplicationServlet.java:71)
	at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173)
	at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:809)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
	at java.lang.Thread.run(Thread.java:619)

2, I have my existing project, that was working before. I was cleaning up libraries in this one (separating them to dedicated projects, because I share them with other projects), so maybe I screwed something up… now I don’t know what. I’m new in vaadin, especially in custom widgets, so I’m giving this error my blank stare:

Compiling widgetset sk.wkobjekt.wko.server.view.widgetset.Sk_wkobjekt_wko_serverWidgetset
Updating GWT module description file...
May 14, 2010 11:46:42 PM com.vaadin.terminal.gwt.widgetsetutils.ClassPathExplorer getAvailableWidgetSets
INFO: Widgetsets found from classpath:
	com.vaadin.terminal.gwt.DefaultWidgetSet in jar:file:Q:/code/workspace/sk.wkobjekt.wko.server/WebContent/WEB-INF/lib/vaadin-6.3.2.jar!/
	sk.wkobjekt.wko.server.view.widgetset.Sk_wkobjekt_wko_serverWidgetset in file://Q/code/workspace/sk.wkobjekt.wko.server/src

Done.
Starting GWT compiler
java.lang.ClassNotFoundException: com.google.gwt.dev.GWTCompiler
	at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:303)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:316)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:169)
	at com.vaadin.tools.WidgetsetCompiler$1.run(WidgetsetCompiler.java:76)
	at java.lang.Thread.run(Thread.java:619)
Widgetset compilation finished
Widgetset compilation completed

I don’t have any custom widgets in my code and the fact that this “skript” found widgets to compile in vaadin-6.3.2.jar is really strange, I have no idea what’s happening. When I don’t compile anything and try to run it, browser itself will throw an error dialog at me, saying:
Failed to load widgetset
/wko/VAADIN/widgetsets/sk.wk…nocache.js?D3GD32…

and this is in the stdout:

Requested resource [VAADIN/widgetsets/sk.wkobjekt.wko.server.view.widgetset.Sk_wkobjekt_wko_serverWidgetset/sk.wkobjekt.wko.server.view.widgetset.Sk_wkobjekt_wko_serverWidgetset.nocache.js]
 not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.

When I try to compile the “widgets” with a toolbar button, it will create a .gwt.xml file in my src folder that is almost empty… see:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.7.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/1.7.0/distro-source/core/src/gwt-module.dtd">
<module>
	<inherits name="com.vaadin.terminal.gwt.DefaultWidgetSet" />
</module>

any idea how to fix this?

very well, a nice sleep, some exercise, I came back to my PC and see what I’ve found in my web.xml:

		<init-param>
			<description>
			Application widgetset</description>
			<param-name>widgetset</param-name>
			<param-value>sk.wkobjekt.wko.server.view.widgetset.Sk_wkobjekt_wko_serverWidgetset</param-value>
		</init-param>

how did this show up here, I have no idea, so I removed it and vaadin is no longer questioning me about widgetset compilation. So that sorted out my second question. However the first question remains to be answered… could anybody try it on eclipse with newest vaadin library and ecilpse plugin? just create a new vaadin project with everything at default and see if “javax.servlet.ServletException: Failed to load application class:” exception is thrown on your machine too…

Most likely this is a classpath problem. If it is related to the Vaadin related classpath entries, try to change the Vaadin version with the Eclipse plugin to e.g. 6.2.0, apply the changes and then change back to 6.3.2. Then check the rest of your classpath.

When you ask the Eclipse plugin to compile a widgetset, it will create you one if none exists. It is by default created in the directory where your Application class is (preferring a short package name if there are multiple possible locations). To create a widgetset in a specific location, one can first create an empty MyWidgetset.gwt.xml and then let the compiler complete it.

When the widgetset is created, the related entry is automatically added to web.xml. The new widgetset - assuming you have no JARs with custom widgets in your project - should look like the one you are seeing. Effectively, it tells to include all the standard widgets (from DefaultWidgetSet in the Vaadin JAR) as well as any widgets in your own widget directory (by default “client” under the location of the widgetset.gwt.xml file).

Why the widgetset compilation fails when you do try to execute it seems to be because you don’t have gwt-dev.jar (and gwt-user.jar) on your classpath.

Are you using the latest version of the Eclipse plugin? Some older versions were unnecessarily aggressively creating widgetsets when making code changes. However, it can also happen that the Eclipse plugin cannot determine if you have removed widgets when removing JARs from the project and propose you to recompile the widgetset. If you answer yes, a new widgetset may be created.

As you wrote in your later post, you can simply remove the widgetset file (.gwt.xml) and references to it from your web.xml (and portlet configuration files if using a portlet) if you don’t expect to use any external add-on widgets or write your own client side widgets.

1, I double checked everything and realized, that when I create a new (empty) Vaadin project, it fails with the error I stated at the beginning. In project properties, in “Vaadin” section, I found strange thing - “Use Vaadin” field is unchecked! After checking this field, it compiles as usual. I’m using latest stable Eclipse JEE stack with latest Vaadin plugin to this date.
vaadin plugin - Vaadin Eclipse Integration 1.2.1.201003300626
eclipse 3.5.2

2, actually, I did have a gwt-dev.jar and gwt-user.jar on my classpath. Even when I tried to type the path to the class com.google.gwt.dev.GWTCompiler, eclipse appeared to import the right package from the classpath. I don’t expect myself to write my own custom widgets, so I don’t need it now, but your explanation of this topic was very helpful Henri, thank you for that!