can't create new theme

I’m trying to define a custom theme, following the tutorial. I Add to WebContent these folders:

VAADIN
VAADIN\themes
VAADIN\themes\mytheme

In a new file called styles.css I write:

@import url(../reindeer/styles.css);

and i save this file in mytheme.

In my application, I call:

		setMainWindow(mainWindow);
		setTheme("mytheme");

when application starts, in the console I find:

Requested resource [VAADIN/themes/mytheme/styles.css]
 not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.
Requested resource [VAADIN/themes/mytheme/favicon.ico]
 not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.
Requested resource [VAADIN/themes/mytheme/favicon.ico]
 not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.

where am I wrong?
Thanks, Francesco

Did you unpack the themes from the vaadin JAR and also put them in the VAADIN/themes folder?

What you have is what I did and my theme works, but I also took the vaadin JAR and un-jarred it and copied the directories from VAADIN/themes/* into my VAADIN/themes folder. You may not need them all, but I suspect you need ‘base’ and ‘reindeer’ at the least.

Correct. “base” is an absolute must, and on top of that either “reindeer” or “runo”.

David, Jouni, thank you for your answers. I copied all themes under VAADIN/themes, but I got the same messages :frowning:

Requested resource [VAADIN/themes/mytheme/styles.css]
 not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.
Requested resource [VAADIN/themes/mytheme/favicon.ico]
 not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.
Requested resource [VAADIN/themes/mytheme/favicon.ico]
 not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.

It seems it doesn’t search VAADIN folder in the correct place. Where is written the root for the absolute path?
Francesco

I’m still in trouble, no solution found. I start from incubator SpringApplication, I need to insert a bitmap in a button and I’m stuck. Can anyone help me to find a solution?
Thank you, Francesco

No idea… Can you open your theme css directly via the browser using a link like:

http://yourhostname.com/YourWebAppName/VAADIN/themes/mytheme/styles.css

If not, your web server is not correctly configured.

I can see by the backslashes in your original posting’s path names that you are probably on Windows, so I’m less certainly about its needs with respect to case.

And I’ve not used SpringApplication to know what that means. I’d look in Firebug (or other browser debugger) to see the full path of requested resources.

Not sure what’s wrong there, but the application context is one source of such problems. If you don’t have [tt]
/*
[/tt] in your servlet mapping but something like [tt]
/myapp/*
[/tt], you also need to map [tt]
/VAADIN/*
[/tt].

For example:


  <servlet-mapping>
  	<servlet-name>Book of Vaadin Examples</servlet-name>
  	<url-pattern>/book/*</url-pattern>
  </servlet-mapping>

  <!-- This has to be done because the apps are under a sub-context. -->
  <servlet-mapping>
    <servlet-name>Book of Vaadin Examples</servlet-name>
    <url-pattern>/VAADIN/*</url-pattern>
  </servlet-mapping>

But I guess there are some other possibilities as well.

I solved moving VAADIN folder under \src\main\webapp instead of \WebContent. Now always works well, but do you expect side effects?
Thank you, Francesco

Marko, thanks a bunch for this post. I was just trying to drop the Chameleon theme into my app, but it could never be found. Putting the VAADIN/* servlet-mapping did the trick. I’ll buy you a Tequila if you ever visit Monterey, California, USA!

I have used native select on my page. But when I am selecting any value from the list, Communication Problem comes printing following lines on console:

INFO: Requested resource
[/VAADIN/UIDL/] not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.

Lines from web.xml :

myservlet
/VAADIN/*

And if i change from /VAADIN/* to /* the issue gets resolved.
But I don’t want my Vaadin page as home page.
Please suggest…

The servlet has to be mapped to /* to work properly. That doesn’t mean that you will get presented with the contents of your VAADIN folder when you go to your app.

If you want to serve static files in your app and as a result don’t want/can’t use /* you need to do some changes as explained by marko here:
https://vaadin.com/forum/#!/thread/344236/376324

I am still strugging with this error.
Communication Problem comes printing following lines on console:UIDL could not be read from server. Check servlets mappings. Error code: 404

One thing i missed to communicated was, above error is occuring when i use ‘Native Select’ or ‘Combo Box’. If I remove it then page looks fine.
my HelloWorld.java looks like:

[code]
package com.vaadin.one;

import com.vaadin.annotations.Title;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.server.VaadinRequest;
import com.vaadin.ui.AbstractSelect.Filtering;
import com.vaadin.ui.ComboBox;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.Table;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;

@Title(“Hello Window”)
public class HelloWorld extends UI {

 private static final long serialVersionUID = 511085335415683713L;

@Override
protected void init(VaadinRequest request) {
     
    VerticalLayout content = new VerticalLayout();
    content.setSizeFull(); 
    setContent(content); 
    content.addComponent(new Label("Select testIDs to Compare.."));
    HorizontalLayout hor = new HorizontalLayout();
    hor.setSizeFull(); 
    
    ComboBox select1 = new ComboBox("My ComboBox");
    select1.setInputPrompt("Select..");
    select1.setImmediate(true);
    select1.addItem("1000A");
    select1.addItem("1000B");
    select1.addItem("1000C");
    hor.addComponent(select1);

    content.addComponent(hor);
    content.setExpandRatio(hor, 1); // Expand to fill
            
    Table table = new Table("Difference Table");
    table.addContainerProperty("TEST 1", String.class, null);
    table.addContainerProperty("TEST 2", String.class, null);
    table.addContainerProperty("Year", Integer.class, null);

    table.addItem(new Object[] { "Nicolaus", "xxjhwj", new Integer(1473) },
            new Integer(1));
    table.setVisible(true);
    table.setVisibleColumns("TEST 1", "TEST 2", "Year");
    content.addComponent(table);
    content.setExpandRatio(table, 5); // Expand to fill
}

}
[/code]web.xml:

<servlet> <servlet-name>myservlet</servlet-name> <servlet-class>com.vaadin.server.VaadinServlet</servlet-class> <init-param> <param-name>UI</param-name> <param-value>com.vaadin.one.HelloWorld</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>myservlet</servlet-name> <url-pattern>/VAADIN/*</url-pattern> </servlet-mapping> I am accessing this via url: http://localhost/VaadinPOC/VAADIN
Please suggest.

Do you want to access the App using …VaadinPOC/VAADIN and not just VaadinPOC because this is caused by your (in my opinion weird) servlet mapping. In every app i made i just left the main servlet mapped to /* and from what i read this is totally fine until you have a multi-servlet application.

I am using a multi servlet application based on struts. I want to plug my VAADIN application with this existing application.
But if I give url pattern as /* mapped to vaadin servlet, my home page will point to Vaadin page losing my existing Vaadin Page.
Because of this I was calling Vaadin Page with url: http://localhost/VaadinPOC/VAADIN
Please let me know if still I am missing something.

Does it need to be /VAADIN/* because VAADIN is a reserved mapping for static resources. I just tested it and if you map the Vaadin App to anything else it works.
I tested it with /TheApp/*
→ Page was displayed properly and it didn’t cause any errors when clicking the combobox.

It worked fine.
Thanks a lot for help!!!

One more thing need to share. The application is working fine only if I give an addtional servlet mapping as /VAADIN/* or /* with my reuired mapping i.e. /TheApp/*
And if I won’t give this, then it throws error as:
“Failed to load the bootstrap javascript: ./VAADIN/vaadinBootstrap.js”
I am still not sure why additional servlet mapping is requied.
But my application is working properly with it.

 <servlet-mapping>
        <servlet-name>myservlet</servlet-name>
        <url-pattern>/VAADIN/*</url-pattern>
    </servlet-mapping> 
    <servlet-mapping>
        <servlet-name>myservlet</servlet-name>
        <url-pattern>/TheApp/*</url-pattern>
    </servlet-mapping> 

I’ve just faced the same problem. And I guess I’ve found a little bug in the maven vaadin plugin.
(My dev environment is: Jetty + IntelliJ IDEA + project-created-from-maven-archetype).
According to log files, maven vaadin-compile plugin completed successfully:

[INFO]
 Scanning for projects...
[INFO]
                                                                         
[INFO]
 ------------------------------------------------------------------------
[INFO]
 Building foo 0.1
[INFO]
 ------------------------------------------------------------------------
[INFO]
 
[INFO]
 >>> jetty-maven-plugin:9.2.3.v20140905:run (default-cli) > test-compile @ foo >>>
[INFO]
 
[INFO]
 --- vaadin-maven-plugin:7.6.2:update-theme (default) @ foo ---
[INFO]
 Updating theme VAADIN\themes\mytheme
[INFO]
 Widgetsets found from classpath:
[INFO]
     ru.my.pac.MyAppWidgetset in file://C/IdeaProjects/���/Foo/target/classes
[INFO]
     com.vaadin.DefaultWidgetSet in jar:file:C:/Applications/.m2/repository/com/vaadin/vaadin-client/7.6.2/vaadin-client-7.6.2.jar!/
[INFO]
 Addon styles found from classpath:
[INFO]
 
[INFO]
 Search took 18ms
[INFO]
 Theme "VAADIN\themes\mytheme" updated
[INFO]
 
[INFO]
 --- vaadin-maven-plugin:7.6.2:compile-theme (default) @ foo ---
[INFO]
 Updating theme VAADIN\themes\mytheme
[INFO]
 Theme "VAADIN\themes\mytheme" compiled
[INFO]
 
[INFO]
 --- maven-resources-plugin:2.6:resources (default-resources) @ foo ---
[INFO]
 Using 'UTF-8' encoding to copy filtered resources.
[INFO]
 Copying 7 resources
[INFO]
 
[INFO]
 --- maven-compiler-plugin:3.3:compile (default-compile) @ foo ---
[INFO]
 Nothing to compile - all classes are up to date
[INFO]
 
[INFO]
 --- vaadin-maven-plugin:7.6.2:update-widgetset (default) @ foo ---
[INFO]
 auto discovered modules [ru.my.pac.MyAppWidgetset]

[INFO]
 Updating widgetset ru.my.pac.MyAppWidgetset
[INFO]
 Adding resource directory to command classpath: C:\IdeaProjects\Кла\Foo\src\main\resources
[INFO]
 Widgetsets found from classpath:
[INFO]
     ru.my.pac.MyAppWidgetset in file://C/IdeaProjects/���/Foo/src/main/resources
[INFO]
     com.vaadin.DefaultWidgetSet in jar:file:C:/Applications/.m2/repository/com/vaadin/vaadin-client/7.6.2/vaadin-client-7.6.2.jar!/
[INFO]
 Addon styles found from classpath:
///bla-bla-bla
[INFO]
 Started Jetty Server

But every try to use custom theme I faced the same error:

INFO: Requested resource [/VAADIN/themes/mytheme/styles.css] not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder. Also, I was not able to open styles.css via browser, like this: http://localhost:8080/VAADIN/themes/mytheme/styles.css Finally, I’ve changed the location of my project, moving it from “Кла” folder to “fld” folder. Now everything works fine for me. And, yep, I know, it’s bad to use not Latin letters in system paths, but technically it looks like the plugin bug…