Can't find /VAADIN/themes/touchkit/styles.css

Platform:
Java 1.8
Apache Karaf 4.0.7
Pax web 4.0.3
Vaadin 7.7.4
TouchKit 4.1.0

I’m trying to use TouchKit in an OSGi webapp
https://github.com/steinarb/ukelonn/tree/using-vaadin

(NB! The TouchKit stuff hasn’t been pushed yet)
I get the error messages like the following in the log:

2017-01-02 22:11:40,615 | INFO  | tp1207313930-337 | VaadinServlet                    | 539 - com.vaadin.server - 7.7.4 | Requested resource 
[/VAADIN/themes/touchkit/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.

I’ve tried debugging into the TouchKitServlet, specifically to see what it does in this code:

    protected void service(HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {
        String pathInfo = request.getPathInfo();
        if (pathInfo != null) {
            if (pathInfo.startsWith("/VAADIN/themes/touchkit/styles.css")) {
                serveDummyFile(response, "max-age=1000000");
                return;
            } else if (pathInfo.startsWith("/PING")) {
                serveDummyFile(response, "no-store, no-cache, max-age=0, must-revalidate");
                return;
            }
        }
        super.service(request, response);
    }

There is a request with pathinfo “/themes/touchkit/styles.css” but no request with “/VAADIN/themes/touchkit/styles.css” so the serveDummyFile() method is never called.

What I’ve done that hasn’t been committed and pushed yet, is:

  1. Added the touchkit-agpl jar automatically changed into an OSGi bundle to the karaf runtime by adding the following to the feature file: <bundle start-level="80">wrap:mvn:com.vaadin.addon/vaadin-touchkit-agpl/${vaadin.touchkit.version}</bundle>
  2. Imported the following packages into the webapp OSGi bundle com.vaadin.addon.touchkit.server, com.vaadin.addon.touchkit.settings, com.vaadin.addon.touchkit.annotations,
  3. Switched the servlet mappings from the com.vaadin.server.VaadinServlet to com.vaadin.addon.touchkit.server.TouchKitServlet in the web.xml file of the webapp bundle
  4. Added @Theme(“touchkit”) to the UI classes

Does anyone have an idea what I might be missing?

Thanks!

  • Steinar

If I just want to use the vanilla touchkit theme with the vanilla touchkit widget set, do I still have to:

  1. Create a new servlet class deriving from TouchKitServlet?
  2. Create a new widgetset based on the touchkitwidgetset?
  3. Create a new theme loader?
  4. Create a new VAADIN/themes/touchkit/styles.css?
  5. All of the above?

I am now running TouchKit successfully from karaf (ie. as an OSGi bundle), and to answer the questions above:

  1. No I did not have to subclass TouchKitServlet, but I did have to import
    all
    of the packages exported by touchkit-turned-into-a-bundle-on-the-fly-by-karaf, not just the packages referenced directly, see the configuration for maven-bundle-plugin here:
    https://github.com/steinarb/ukelonn/blob/using-vaadin/ukelonn.bundle/pom.xml
  2. No I’m using the TouchkitWidgetSet but to get everything to load right I had to import all the TocuKit packages as decribed in “1.” above, and I also had to provide all of TouchKit’s OSGi dependencies in the karaf feature file (downgrade vaadin to the version touchkit was built against, ie. 7.6.1 (I previously used 7.7.4), flute, streamhtmlparser, guava and gwt-user):
    https://github.com/steinarb/ukelonn/blob/using-vaadin/ukelonn.bundle/src/main/feature/feature.xml
  3. No, but again things started working once I had fixed the runtime dependencies (see above)
  4. I don’t know if it was necessary, but I created this one:
    https://github.com/steinarb/ukelonn/blob/using-vaadin/ukelonn.bundle/src/main/webapp/VAADIN/themes/touchkit/styles.css