How to run Vaadin 7 applications in Karaf?

2019-05-23 12:22发布

I have been looking for days now, with lots of experiments, for an answer to this question. What do I need to do to be able to run applications, using version 7 of Vaadin Web framework, inside Karaf?

There are some information about it but none of the solutions I read worked. The only related question I found on SO (How to integrate Vaadin 7 with OSGi?) does not really have an valid answer, at least for my question. Every time I follow a solution found by googling I always get lots of missing dependencies and I found myself indefinitely searching and installing bundles in order to satisfy all the imports.

This cannot be so hard to achieve. Is there anyone that can give me some guidelines or indicate a good source with the answer to my question?

3条回答
Melony?
2楼-- · 2019-05-23 12:53

This is a working features.xml:

<?xml version="1.0" encoding="UTF-8"?>
<features xmlns="http://karaf.apache.org/xmlns/features/v1.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.0.0 http://karaf.apache.org/xmlns/features/v1.0.0"
    name="vaadin7-feature">

    <feature install="true" name="vaadin7-feature" version="1.0.0-SNAPSHOT">
        <feature>vaadin7-common</feature>
        <bundle>mvn:com.vaadin/vaadin-themes/7.3.0</bundle>
        <bundle>mvn:com.vaadin/vaadin-shared/7.3.0</bundle>
        <bundle>mvn:com.vaadin/vaadin-server/7.3.0</bundle>
        <bundle>mvn:com.vaadin/vaadin-client/7.3.0</bundle>
        <bundle>mvn:com.vaadin/vaadin-client-compiled/7.3.0</bundle>
        <bundle>mvn:com.vaadin/vaadin-push/7.3.0</bundle>
        <bundle>mvn:com.vaadin/vaadin-sass-compiler/0.9.2</bundle>
    </feature>

    <feature name="vaadin7-common" version="1.0.0-SNAPSHOT">
        <bundle>mvn:com.vaadin.external.google/android-json/0.0.20131108.vaadin1</bundle>
        <bundle>mvn:org.jbundle.util.osgi.wrapped/org.jbundle.util.osgi.wrapped.c3p0/0.9.1.2</bundle>
        <bundle>mvn:org.quartz-scheduler/quartz/2.2.1</bundle>
        <bundle>mvn:joda-time/joda-time/2.4</bundle>
        <bundle>wrap:mvn:org.springframework/spring-core/3.2.6.RELEASE$Bundle-SymbolicName=Spring-Framework&amp;Bundle-Version=3.2.6.RELEASE</bundle>
        <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.xpp3/1.1.4c_7</bundle>
        <bundle>mvn:com.google.guava/guava/16.0.1</bundle>
        <bundle>mvn:io.netty/netty/3.9.0.Final</bundle>
        <bundle>mvn:org.apache.commons/commons-lang3/3.3.2</bundle>

        <bundle>mvn:com.vaadin.external.flute/flute/1.3.0.gg2</bundle>
        <bundle>mvn:com.vaadin.external.streamhtmlparser/streamhtmlparser-jsilver/0.0.10.vaadin1</bundle>
        <bundle>mvn:com.vaadin.external.google/guava/16.0.1.vaadin1</bundle>

        <bundle>mvn:org.eclipse.jetty.orbit/javax.servlet/3.0.0.v201112011016</bundle>
        <bundle>wrap:mvn:org.w3c.css/sac/1.3$Bundle-SymbolicName=org-w3c-css-sac&amp;Bundle-Version=1.3</bundle>
        <bundle>mvn:org.jsoup/jsoup/1.6.3</bundle>
        <bundle>mvn:com.vaadin.external.slf4j/vaadin-slf4j-jdk14/1.6.1</bundle>
        <bundle>mvn:com.vaadin.external.atmosphere/atmosphere-runtime/2.1.2.vaadin3</bundle>
        <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.gwt-dev/2.4.0_1</bundle>
        <bundle>mvn:org.apache.commons/commons-jexl/2.1.1</bundle>
        <bundle>mvn:com.vaadin.external.json/json/0.0.20080701</bundle>
        <bundle>wrap:mvn:javax.validation/validation-api/1.0.0.GA$Bundle-SymbolicName=validation-api&amp;Bundle-Version=1.0.0.GA</bundle>
        <bundle>wrap:mvn:net.sourceforge.cssparser/cssparser/0.9.11$Bundle-SymbolicName=cssparser&amp;Bundle-Version=0.9.11</bundle>
    </feature>
</features>

Let me know if it helps you.

查看更多
乱世女痞
3楼-- · 2019-05-23 13:05

This method will install Vaadin 7.6.8 to your Karaf 2.4.3.

  1. Save below file somewhere
  2. Open the Karaf shell
  3. features:addurl file:///path/to/your/features.xml
  4. features:install vaadin

This will install Vaadin as a feature to your Karaf installation.

features.xml

<?xml version="1.0" encoding="UTF-8"?>
<features xmlns="http://karaf.apache.org/xmlns/features/v1.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.0.0 http://karaf.apache.org/xmlns/features/v1.0.0"
    name="vaadin">

    <feature install="true" name="vaadin" version="7.6.8">
        <feature>vaadin-common</feature>
        <bundle>mvn:com.vaadin/vaadin-themes/7.6.8</bundle>
        <bundle>mvn:com.vaadin/vaadin-server/7.6.8</bundle>
        <bundle>mvn:com.vaadin/vaadin-sass-compiler/0.9.13</bundle>
        <bundle>mvn:com.vaadin/vaadin-shared/7.6.8</bundle>
        <bundle>mvn:com.vaadin/vaadin-push/7.6.8</bundle>
        <bundle>mvn:com.vaadin/vaadin-client/7.6.8</bundle>
        <bundle>mvn:com.vaadin/vaadin-client-compiled/7.6.8</bundle>
    </feature>

    <feature name="vaadin-common" version="7.6.8">
        <bundle>mvn:com.vaadin.external.flute/flute/1.3.0.gg2</bundle>
        <bundle>mvn:com.vaadin.external.streamhtmlparser/streamhtmlparser-jsilver/0.0.10.vaadin1</bundle>
        <bundle>mvn:com.vaadin.external.google/guava/16.0.1.vaadin1</bundle>
        <bundle>mvn:com.vaadin.external.atmosphere/atmosphere-runtime/2.2.7.vaadin1</bundle>
        <bundle>mvn:com.vaadin.external.flute/flute/1.3.0.gg2</bundle>

        <bundle>mvn:org.jsoup/jsoup/1.8.3</bundle>
        <bundle>mvn:javax.portlet/portlet-api/2.0</bundle>
        <bundle>mvn:com.vaadin.external.slf4j/vaadin-slf4j-jdk14/1.6.1</bundle>
        <bundle>wrap:mvn:javax.validation/validation-api/1.0.0.GA$BundleSymbolicName=javax-validation-api&amp;Bundle-Version=1.0.0.GA</bundle>
        <bundle>wrap:mvn:com.google.appengine/appengine-api-1.0-sdk/1.7.7$BundleSymbolicName=com-google-appengine-api-1.0-sdk&amp;Bundle-Version=1.7.7</bundle>
        <bundle>wrap:mvn:com.liferay.portal/portal-service/6.0.2$Bundle-SymbolicName=com-liferay-portal-service&amp;Bundle-Version=6.0.2</bundle>
        <bundle>wrap:mvn:org.w3c.css/sac/1.3$Bundle-SymbolicName=org-w3c-css-sac&amp;Bundle-Version=1.3</bundle>
        <bundle>wrap:mvn:com.yahoo.platform.yui/yuicompressor/2.4.8$Bundle-SymbolicName=com-yahoo-platform-yui-compressor&amp;Bundle-Version=2.4.8</bundle>
    </feature>

</features>
查看更多
SAY GOODBYE
4楼-- · 2019-05-23 13:07

The easiest option for me was simply to use karaf's war deployer. It allows to simply deploy war into karaf, without having to write XML or other osgi whatnot. I have described the steps here: http://mavi.logdown.com/posts/7813065-deploying-vaadin-app-on-karaf

查看更多
登录 后发表回答