It’s been a while since I’ve done Java and I’m trying to get back into this using the Vaadin framework. So, this may ultimately be a basic Java issue I’m having. But…
I’m trying to make the sample application work from chapter 2 of the Book of Vaadin. I just cut and pasted this into Eclipse. However, when running it I’m getting errors, which are:
Daemon Thread [“http-bio-8080”-exec-3]
(Suspended (The type new Button.ClickListener(){} must implement the inherited abstract method Button.ClickListener.buttonClick(Button.ClickEvent)))
Learning_vaadinApplication.() line: 18
NativeConstructorAccessorImpl.newInstance0(Constructor, Object) line: not available [native method]
Well, I still get a bunch of errors inside the button part of this code, so I commented it out for now. But Tomcat still fails to bring up the page, giving me a 404 error instead.
So, I’m looking at the Tomcat log and it says this:
Mar 28, 2011 10:57:01 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: .:/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java
Mar 28, 2011 10:57:01 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]
{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:Learning Vaadin' did not find a matching property.
Mar 28, 2011 10:57:01 AM org.apache.coyote.AbstractProtocolHandler init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Mar 28, 2011 10:57:01 AM org.apache.coyote.AbstractProtocolHandler init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Mar 28, 2011 10:57:01 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 539 ms
Mar 28, 2011 10:57:01 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Mar 28, 2011 10:57:01 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.11
Mar 28, 2011 10:57:02 AM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/Users/mike/Documents/Eclipse/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Learning Vaadin/WEB-INF/lib/gwt-dev.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Mar 28, 2011 10:57:02 AM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/Users/mike/Documents/Eclipse/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Learning Vaadin/WEB-INF/lib/gwt-user.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Mar 28, 2011 10:57:06 AM org.apache.coyote.AbstractProtocolHandler start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Mar 28, 2011 10:57:06 AM org.apache.coyote.AbstractProtocolHandler start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Mar 28, 2011 10:57:06 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 4122 ms
Wondering if not loading the GWT jar is a problem?
I guess another question is, why doesn’t this just work? I can understand if there are dependencies upon other components that I’ve not configured right (Eclipse, Tomcat, GWT, the JRE, or Vaadin itself), but assuming those are all in place, shouldn’t the sample apps just work?
Actually, I spoke too soon. I can get it working if all I do is display the label. As soon as I add the button stuff in, I get errors. This is true whether I use the stuff out of the Vaadin book, or from what Joris posted.
I get:
The method addListener(Button.ClickListener) in the type Button is not applicable for the arguments (new
ClickListener(){})
ClickListener cannot be resolved to a type
ClickEvent cannot be resolved to a type
Should I be importing anything besides com.vaadin.Application and com.vaadin.ui.*?