Karaf 4.0.7 works on one virtual machine, but not on a different one

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Karaf 4.0.7 works on one virtual machine, but not on a different one

Steinar Bang
Platform: virtual private server
          amd64,
          debian 8 "jessie" (with jessie-backports)
          openjdk-8-jdk 8u121-b13-1~bpo8+1 (from jessie-backports)
            (the old VM has version 8u111-b14-2~bpo8+1)
          karaf-4.0.7

I am trying to move my application from my old VM, where it runs, and on
to a new VM where it won't start even though all of the important parts
I can think of, are the same (listed above, under platform).

The feature installation fails with an error message:
karaf@root()> feature:install ukelonn-db-postgresql
Error executing command: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=ukelonn-db-postgresql; type=karaf.feature; version="[1.0.0.SNAPSHOT,1.0.0.SNAPSHOT]"; filter:="(&(osgi.identity=ukelonn-db-postgresql)(type=karaf.feature)(version>=1.0.0.SNAPSHOT)(version<=1.0.0.SNAPSHOT))" [caused by: Unable to resolve ukelonn-db-postgresql/1.0.0.SNAPSHOT: missing requirement [ukelonn-db-postgresql/1.0.0.SNAPSHOT] osgi.identity; osgi.identity=no.priv.bang.ukelonn.postgresql.db; type=osgi.bundle; version="[1.0.0.SNAPSHOT,1.0.0.SNAPSHOT]"; resolution:=mandatory [caused by: Unable to resolve no.priv.bang.ukelonn.postgresql.db/1.0.0.SNAPSHOT: missing requirement [no.priv.bang.ukelonn.postgresql.db/1.0.0.SNAPSHOT] osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=1.8))"]]

Does anyone know what might be wrong?

I get no such error message on the old VM.  There the feature just
installs.  I get no such error on my desktop, also amd64 (Intel i5,
"skylake"), also running debian 8 with stuff from jessie-backports.

I have searched the karaf.log file but it doesn't say anything more than
the error message.

Is the difference in java version significant? (1.8_121 where it fails,
1.8_111 where it doesn fail)

On the new VM karaf complains about a missing JAVA_HOME:
root@cadalora:/home/karaf# systemctl status karaf
  karaf.service - Karaf - karaf
   Loaded: loaded (/lib/systemd/system/karaf.service; enabled)
   Active: active (running) since Thu 2017-03-16 21:27:16 GMT; 39min ago
  Process: 2948 ExecStop=/usr/local/karaf/bin/karaf stop (code=exited, status=0/SUCCESS)
 Main PID: 3125 (java)
   CGroup: /system.slice/karaf.service
           └─3125 /usr/bin/java -server -Xms128M -Xmx512M -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass -Dcom.sun.management.jmxremote -Djava.endorsed.dirs=/usr/lib/jvm...

Mar 16 21:27:16 cadalora.default.sbang.uk0.bigv.io systemd[1]: Starting Karaf - karaf...
Mar 16 21:27:16 cadalora.default.sbang.uk0.bigv.io systemd[1]: Started Karaf - karaf.
Mar 16 21:27:16 cadalora.default.sbang.uk0.bigv.io karaf[3125]: karaf: JAVA_HOME not set; results may vary


On the old VM there is no complaint about a missing JAVA_HOME.

The JAVA_HOME variable isn't set on either machine.

Is the missing JAVA_HOME message significant?


This is my application:
 https://github.com/steinarb/ukelonn/tree/using-vaadin
(ie. the "using-vaadin" branch).

This is what I've done, so far, on the new VM:
 1. Install openjdk-8-jdk with apt-get, from jessie-backports
      https://packages.debian.org/jessie-backports/openjdk-8-jdk
 2. Install maven 3.3.9 with apt-get, from jessie-backports
      https://packages.debian.org/jessie-backports/maven
 3. Install karaf 4.0.7 from a .deb package created by this script
      https://github.com/steinarb/karaf-deb-packaging
    This deb package creates user karaf, with group karaf and the home
    directory /home/karaf and no login shell
 4. I've cloned and built my project as user karaf with the following
    commands:
      /bin/su -s /bin/bash karaf
      cd
      mkdir git
      cd git
      git clone https://github.com/steinarb/ukelonn.git
      cd ukelonn
      git checkout using-vaadin
      mvn clean install
    After the commands, the /home/karaf/.m2/repository contains the
    bundles built by the project, as well as the dependencies
 5. I've logged into the karaf shell with ssh:
      ssh -p 8101 karaf@localhost
 6. I planned to do the following commands, but the first
    feature:install failed:
      feature:repo-add mvn:no.priv.bang.ukelonn/ukelonn.karaf/LATEST/xml/features
      feature:install ukelonn-db-postgresql
      feature:install ukelonn

The feature file added by repo-add, looks like this:
File Edit Options Buffers Tools XML Text Help
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<features xmlns="http://karaf.apache.org/xmlns/features/v1.4.0" name="ukelonn.karaf">
    <feature name="ukelonn-api" description="Ukelonn webapp OSGi service definitions OSGi bundle" version="1.0.0.SNAPSHOT">
        <bundle start-level="80">mvn:no.priv.bang.ukelonn/ukelonn.api/1.0.0-SNAPSHOT</bundle>
    </feature>
    <feature name="ukelonn-db-derby-test" description="Ukelonn webapp derby test database OSGi bundle" version="1.0.0.SNAPSHOT">
        <feature prerequisite="false" dependency="false">pax-jdbc</feature>
        <feature prerequisite="false" dependency="false">pax-jdbc-derby</feature>
        <feature version="1.0.0.SNAPSHOT" prerequisite="false" dependency="false">ukelonn-api</feature>
        <bundle start-level="80">mvn:no.priv.bang.ukelonn/ukelonn.bundle.test.db/1.0.0-SNAPSHOT</bundle>
    </feature>
    <feature name="ukelonn-db-postgresql" description="Ukelonn webapp PostgreSQL database connection OSGi bundle" version="1.0.0.SNAPSHOT">
        <feature prerequisite="false" dependency="false">transaction-api</feature>
        <feature prerequisite="false" dependency="false">pax-jdbc</feature>
        <feature version="1.0.0.SNAPSHOT" prerequisite="false" dependency="false">ukelonn-api</feature>
        <bundle start-level="80">mvn:no.priv.bang.ukelonn/ukelonn.bundle.postgresql.db/1.0.0-SNAPSHOT</bundle>
        <bundle start-level="80">mvn:org.postgresql/postgresql/9.4.1211.jre7</bundle>
    </feature>
    <feature name="ukelonn" description="Ukelonn webapp OSGi bundle" version="1.0.0.SNAPSHOT">
        <feature prerequisite="false" dependency="false">pax-war</feature>
        <feature prerequisite="false" dependency="false">ukelonn-api</feature>
        <bundle start-level="80">mvn:org.apache.shiro/shiro-core/1.3.1</bundle>
        <bundle start-level="80">mvn:org.apache.shiro/shiro-web/1.3.1</bundle>
        <bundle start-level="80">mvn:commons-beanutils/commons-beanutils/1.8.3</bundle>
        <bundle start-level="80">mvn:commons-collections/commons-collections/3.2.2</bundle>
        <bundle start-level="80">mvn:org.jsoup/jsoup/1.8.3</bundle>
        <bundle start-level="80">mvn:com.vaadin/vaadin-shared/7.6.1</bundle>
        <bundle start-level="80">mvn:com.vaadin/vaadin-server/7.6.1</bundle>
        <bundle start-level="80">mvn:com.vaadin/vaadin-themes/7.6.1</bundle>
        <bundle start-level="80">mvn:com.vaadin/vaadin-client-compiled/7.6.1</bundle>
        <bundle start-level="80">mvn:com.vaadin.external.flute/flute/1.3.0.gg2</bundle>
        <bundle start-level="80">mvn:com.vaadin.external.streamhtmlparser/streamhtmlparser-jsilver/0.0.10.vaadin1</bundle>
        <bundle start-level="80">mvn:com.vaadin.external.google/guava/16.0.1.vaadin1</bundle>
        <bundle start-level="80">wrap:mvn:com.vaadin.external.gwt/gwt-user/2.7.0.vaadin4</bundle>
        <bundle start-level="80">wrap:mvn:com.vaadin.addon/vaadin-touchkit-agpl/4.1.0</bundle>
        <bundle start-level="80">mvn:no.priv.bang.ukelonn/ukelonn.bundle/1.0.0-SNAPSHOT/war</bundle>
    </feature>
    <feature name="ukelonn.karaf" description="Do not install this feature, it will install two conflicing database connections" version="1.0.0.SNAPSHOT">
        <feature version="1.0.0.SNAPSHOT" prerequisite="false" dependency="false">ukelonn-api</feature>
        <feature version="1.0.0.SNAPSHOT" prerequisite="false" dependency="false">ukelonn-db-derby-test</feature>
        <feature version="1.0.0.SNAPSHOT" prerequisite="false" dependency="false">ukelonn-db-postgresql</feature>
        <feature version="1.0.0.SNAPSHOT" prerequisite="false" dependency="false">ukelonn</feature>
    </feature>
</features>


Reply | Threaded
Open this post in threaded view
|

Re: Karaf 4.0.7 works on one virtual machine, but not on a different one

Steinar Bang
>>>>> Steinar Bang <[hidden email]>:
> The feature installation fails with an error message:
> karaf@root()> feature:install ukelonn-db-postgresql
> Error executing command: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=ukelonn-db-postgresql; type=karaf.feature; version="[1.0.0.SNAPSHOT,1.0.0.SNAPSHOT]"; filter:="(&(osgi.identity=ukelonn-db-postgresql)(type=karaf.feature)(version>=1.0.0.SNAPSHOT)(version<=1.0.0.SNAPSHOT))" [caused by: Unable to resolve ukelonn-db-postgresql/1.0.0.SNAPSHOT: missing requirement [ukelonn-db-postgresql/1.0.0.SNAPSHOT] osgi.identity; osgi.identity=no.priv.bang.ukelonn.postgresql.db; type=osgi.bundle; version="[1.0.0.SNAPSHOT,1.0.0.SNAPSHOT]"; resolution:=mandatory [caused by: Unable to resolve no.priv.bang.ukelonn.postgresql.db/1.0.0.SNAPSHOT: missing requirement [no.priv.bang.ukelonn.postgresql.db/1.0.0.SNAPSHOT] osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=1.8))"]]

Searching the error message gives me
 https://issues.apache.org/jira/browse/KARAF-3520
and
 https://issues.apache.org/jira/browse/KARAF-4730

KARAF-3520 is a case where a feature installs from the console, but when
using the feature service (whatever that is...?).

Is ssh'ing in to karaf the same as starting karaf from the command line,
and using the console that opens when karaf is startet?

Or is ssh'ing in to karaf the same as using the mentioned feature
service...?

KARAF-4730 is a case where a feature worked on karaf 4.0.5, but not on 4.0.6.

In my case I have karaf 4.0.7 both on the old VM (where it works) and on
the new VM (where it doesn't work).

Reply | Threaded
Open this post in threaded view
|

Re: Karaf 4.0.7 works on one virtual machine, but not on a different one

Steinar Bang
>>>>> Steinar Bang <[hidden email]>:

>> The feature installation fails with an error message:
>> karaf@root()> feature:install ukelonn-db-postgresql
>> Error executing command: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=ukelonn-db-postgresql; type=karaf.feature; version="[1.0.0.SNAPSHOT,1.0.0.SNAPSHOT]"; filter:="(&(osgi.identity=ukelonn-db-postgresql)(type=karaf.feature)(version>=1.0.0.SNAPSHOT)(version<=1.0.0.SNAPSHOT))" [caused by: Unable to resolve ukelonn-db-postgresql/1.0.0.SNAPSHOT: missing requirement [ukelonn-db-postgresql/1.0.0.SNAPSHOT] osgi.identity; osgi.identity=no.priv.bang.ukelonn.postgresql.db; type=osgi.bundle; version="[1.0.0.SNAPSHOT,1.0.0.SNAPSHOT]"; resolution:=mandatory [caused by: Unable to resolve no.priv.bang.ukelonn.postgresql.db/1.0.0.SNAPSHOT: missing requirement [no.priv.bang.ukelonn.postgresql.db/1.0.0.SNAPSHOT] osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=1.8))"]]

This message
 http://karaf.922171.n3.nabble.com/Karaf-4-0-5-cannot-resolve-some-OSGi-services-tp4046546p4046608.html
suggests setting
 serviceRequirements=disable
in org.apache.karaf.features.cfg

I tried setting
 serviceRequirements=disable
in /etc/karaf/org.apache.karaf.features.cfg

Reply | Threaded
Open this post in threaded view
|

Re: Karaf 4.0.7 works on one virtual machine, but not on a different one

Steinar Bang
>>>>> Steinar Bang <[hidden email]>:

>>> The feature installation fails with an error message:
>>> karaf@root()> feature:install ukelonn-db-postgresql
>>> Error executing command: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=ukelonn-db-postgresql; type=karaf.feature; version="[1.0.0.SNAPSHOT,1.0.0.SNAPSHOT]"; filter:="(&(osgi.identity=ukelonn-db-postgresql)(type=karaf.feature)(version>=1.0.0.SNAPSHOT)(version<=1.0.0.SNAPSHOT))" [caused by: Unable to resolve ukelonn-db-postgresql/1.0.0.SNAPSHOT: missing requirement [ukelonn-db-postgresql/1.0.0.SNAPSHOT] osgi.identity; osgi.identity=no.priv.bang.ukelonn.postgresql.db; type=osgi.bundle; version="[1.0.0.SNAPSHOT,1.0.0.SNAPSHOT]"; resolution:=mandatory [caused by: Unable to resolve no.priv.bang.ukelonn.postgresql.db/1.0.0.SNAPSHOT: missing requirement [no.priv.bang.ukelonn.postgresql.db/1.0.0.SNAPSHOT] osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=1.8))"]]

I figured it out: for some reason openjdk-7-jre had been installed, and
"java -version", said:
 root@cadalora:/home/karaf# java -version
 java version "1.7.0_121"
 OpenJDK Runtime Environment (IcedTea 2.6.8) (7u121-2.6.8-2~deb8u1)
 OpenJDK 64-Bit Server VM (build 24.121-b00, mixed mode)

I removed jre-7:
 apt-get remove openjdk-7-jre:amd64 openjdk-7-jre-headless:amd64

I stopped and started the karaf service, to make it run with java 8:
 systemctl stop karaf
 systemctl start karaf

I then logged in to the console with:
 ssh -p 8101 karaf@localhost
and this time my features installed without a hitch.