The Requested Resource is Not available Error in Eclipse

Hi, I’m really new to Vaadin and while I have some programming experience, I haven’t done a lot of Java programming in a while so it’s like I’m learning from scratch again. I’m trying to follow this tutorial:
https://www.youtube.com/watch?v=yWrkinZkKjI
But even though I’m doing everything as close as I can to what they do, I keep getting “The Requested Resource Is not available 404.” I’m guessing it might be a mix of different things.

The differences I have:
Using Eclipse Java EE IDE Mars (instead of Eclipse Java EE IDE Luna )
Target Runtime is Tomcat 8 (instead of Tomcat 6)
Configuration is Vaadin 7 Java 1.8, servlet 3.1 (instead of Vaadin 7 Java 6 servlet 2.4… how do I get this??? I want it)

I’ve set Tomcat 8 as my Runtime server (from the Windows >Preferences>Server>Runtime Environment) I’ve installed the Vaadin plugin. I can create a Vaadin 6 and a Vaadin 7 project when I go to File>New.

package com.example.documentmanager;


import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.data.util.FilesystemContainer;
import com.vaadin.data.util.TextFileProperty;
import com.vaadin.server.VaadinRequest;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.ui.ComboBox;
import com.vaadin.ui.HorizontalSplitPanel;
import com.vaadin.ui.Label;
import com.vaadin.ui.UI;
import java.io.File;

@SuppressWarnings("serial")
public class DocumentmanagerUI extends UI {
    
    FilesystemContainer docs = new FilesystemContainer(new File("/tmp/docs"));
    ComboBox docList = new ComboBox("Documents", docs);    
    Label docView = new Label("",ContentMode.HTML);
    @Override
    protected void init(VaadinRequest request) {
        HorizontalSplitPanel split = new HorizontalSplitPanel();
        setContent(split);
        split.addComponent(docList);
        split.addComponent(docView);
        
        
        docList.addValueChangeListener(new ValueChangeListener() {

            public void valueChange(ValueChangeEvent event) {
                // TODO Auto-generated method stub
                docView.setPropertyDataSource(new TextFileProperty((File) event.getProperty()));
            }
        });
    }

}

And the Server log(?) from the Console[code]
Jan 08, 2016 10:39:17 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]
{Server/Service/Engine/Host/Context} Setting property ‘source’ to ‘org.eclipse.jst.jee.server:DocumentManager’ did not find a matching property.
Jan 08, 2016 10:39:17 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat/8.0.27
Jan 08, 2016 10:39:17 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Sep 28 2015 08:17:25 UTC
Jan 08, 2016 10:39:17 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number: 8.0.27.0
Jan 08, 2016 10:39:17 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Windows 7
Jan 08, 2016 10:39:17 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 6.1
Jan 08, 2016 10:39:17 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: amd64
Jan 08, 2016 10:39:17 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: C:\Program Files\Java\jre1.8.0_60
Jan 08, 2016 10:39:17 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 1.8.0_60-b27
Jan 08, 2016 10:39:17 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
Jan 08, 2016 10:39:17 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: C:\Users\trissf50\Documents\EclipseProj.metadata.plugins\org.eclipse.wst.server.core\tmp1
Jan 08, 2016 10:39:17 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: C:\Users\trissf50\Downloads\apache-tomcat-8.0.27
Jan 08, 2016 10:39:17 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=C:\Users\trissf50\Documents\EclipseProj.metadata.plugins\org.eclipse.wst.server.core\tmp1
Jan 08, 2016 10:39:17 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=C:\Users\trissf50\Downloads\apache-tomcat-8.0.27
Jan 08, 2016 10:39:17 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=C:\Users\trissf50\Documents\EclipseProj.metadata.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps
Jan 08, 2016 10:39:17 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=C:\Users\trissf50\Downloads\apache-tomcat-8.0.27\endorsed
Jan 08, 2016 10:39:17 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=Cp1252
Jan 08, 2016 10:39:17 AM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre1.8.0_60\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\ProgramData\Oracle\Java\javapath;C:\oracle\ora92\bin;C:\Program Files (x86)\Oracle\jre\1.3.1\bin;C:\Program Files (x86)\Oracle\jre\1.1.8\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\IBM\Client Access\Emulator;C:\Program Files (x86)\IBM\Client Access\Shared;C:\Program Files (x86)\IBM\Client Access;C:\Program Files (x86)\Common Files\Acronis\SnapAPI;C:\Program Files\Windows Imaging;C:\Program Files (x86)\FortisWeb;C:\Program Files (x86)\FortisWeb\Viewers;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn;C:\Program Files\Microsoft SQL Server\120\Tools\Binn;C:\Program Files\Microsoft SQL Server\120\DTS\Binn;.
Jan 08, 2016 10:39:17 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler [“http-nio-8080”]

Jan 08, 2016 10:39:18 AM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Jan 08, 2016 10:39:18 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler [“ajp-nio-8009”]

Jan 08, 2016 10:39:18 AM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Jan 08, 2016 10:39:18 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 773 ms
Jan 08, 2016 10:39:18 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jan 08, 2016 10:39:18 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.0.27
Jan 08, 2016 10:39:18 AM org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG]
took [275]
milliseconds.
Jan 08, 2016 10:39:20 AM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Jan 08, 2016 10:39:20 AM org.apache.catalina.core.ApplicationContext log
INFO: Initializing AtmosphereFramework
Jan 08, 2016 10:39:20 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler [“http-nio-8080”]

Jan 08, 2016 10:39:20 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler [“ajp-nio-8009”]

Jan 08, 2016 10:39:20 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 2737 ms
[/code]


Please explain it to me like I’m 5?

Do you have the VaadinServlet defined anywhere? If not, try adding e.g.

[code]
@WebServlet(value = “/*”, asyncSupported = true)
@VaadinServletConfiguration(productionMode = false, ui = DocumentmanagerUI.class)
public static class Servlet extends VaadinServlet {

}

[/code]Inside your UI class

Ok I added it here:

package com.example.documentmanager;


import com.vaadin.annotations.VaadinServletConfiguration;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.data.util.FilesystemContainer;
import com.vaadin.data.util.TextFileProperty;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinServlet;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.ui.ComboBox;
import com.vaadin.ui.HorizontalSplitPanel;
import com.vaadin.ui.Label;
import com.vaadin.ui.UI;
import java.io.File;

import javax.servlet.annotation.WebServlet;

@SuppressWarnings("serial")
public class DocumentmanagerUI extends UI {
    
    FilesystemContainer docs = new FilesystemContainer(new File("/tmp/docs"));
    ComboBox docList = new ComboBox("Documents", docs);    
    Label docView = new Label("",ContentMode.HTML);
    
       @WebServlet(value = "/*", asyncSupported = true)
        @VaadinServletConfiguration(productionMode = false, ui = DocumentmanagerUI.class)
        public static class Servlet extends VaadinServlet {

        }
    
    
    @Override
    protected void init(VaadinRequest request) {
        HorizontalSplitPanel split = new HorizontalSplitPanel();
        setContent(split);
        split.addComponent(docList);
        split.addComponent(docView);
        
        
        docList.addValueChangeListener(new ValueChangeListener() {

            public void valueChange(ValueChangeEvent event) {
                // TODO Auto-generated method stub
                docView.setPropertyDataSource(new TextFileProperty((File) event.getProperty()));
            }
        });
    }

}

Did I put it in the right place?

Ok after removing the project from the server, cleaning the server, and then running it on the server, I got something that looks similar to the video, thank you so much!

But I’m kind of confused at how in the video they didn’t have the servlet defined in their UI, but their webpage loaded fine. But thank you! I’ll keep working through the tutorial and maybe one day I’ll understand too.

Hi, Great that you got it working!

Just for the record, you can see the Servlet added in the video at minute 1:42. It’s added using the
web.xml
which is an alternative to what you did with the
@WebServlet
annotation.

Happy coding!