Eclipse Plugin: Can't Even Get Example Working

I installed the Vaadin plugin on Eclipse and created a brand new Vaadin Project.

I get this exception:

javax.servlet.ServletException: Failed to load application class: com.example.testvaadin.TestvaadinApp
	com.vaadin.terminal.gwt.server.ApplicationServlet.init(ApplicationServlet.java:71)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:108)

The critical parts of my web.xml look like this:

<context-param>
  	<description>Vaadin production mode</description>
  	<param-name>productionMode</param-name>
  	<param-value>false</param-value>
  </context-param>
  <servlet>
  	<servlet-name>TestvaadinApp</servlet-name>
  	<servlet-class>com.vaadin.terminal.gwt.server.ApplicationServlet</servlet-class>
  	<init-param>
  		<description>
  		Vaadin application class to start</description>
  		<param-name>application</param-name>
  		<param-value>com.example.testvaadin.TestvaadinApp</param-value>
  	</init-param>
  </servlet>
  <servlet-mapping>
  	<servlet-name>TestvaadinApp</servlet-name>
  	<url-pattern>/*</url-pattern>
  </servlet-mapping>

The test app looks like this:

package com.example.testvaadin;

import com.vaadin.Application;
import com.vaadin.ui.Label;
import com.vaadin.ui.Window;

public class TestvaadinApp extends Application
{
	@Override
	public void init()
	{
		Window mainWindow = new Window( "TestvaadinApp" );
		Label label = new Label( "Hello Vaadin user" );
		mainWindow.addComponent( label );
		setMainWindow( mainWindow );
	}

}

I’m having Eclipse deploy directly into the Tomcat7’s “webapps” directory which looks like this:

TestVaadin/
TestVaadin/META-INF
TestVaadin/META-INF/MANIFEST.MF
TestVaadin/WEB-INF
TestVaadin/WEB-INF/web.xml
TestVaadin/WEB-INF/lib
TestVaadin/WEB-INF/classes
TestVaadin/WEB-INF/classes/com
TestVaadin/WEB-INF/classes/com/example
TestVaadin/WEB-INF/classes/com/example/testvaadin
TestVaadin/WEB-INF/classes/com/example/testvaadin/TestvaadinApp.class

I have the “vaadin-6.5.5.jar” file in Tomcat’s “lib” directory.

What am I missing? Thanks in advance!

Libraries in Tomcat’s lib directory are loaded with a classloader that does not see the classes to be loaded with servlet classloaders, even though servlet classloaders do see classes loaded with the library classloader.

Either deploy the Vaadin JAR with the servlet or write your own subclass of AbstractApplicationServlet that does not use reflection (it is very easy) and use it instead of ApplicationServlet. Also some other uses of the reflection APIs from Vaadin classes to the application could cause problems.

Henri, thank you for your response! The info on how Tomcat loads classes actually answers a bunch of
other
questions I had in the back of my head and is useful to know. :smiley:

Moving the JAR did the trick! Thanks so much!