You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by imo <im...@gmail.com> on 2016/03/08 16:51:35 UTC

Felix+Bkuetooth: Missing requirement?

I am trying to develop a bundle with bluetooth support (listening + publish)
using netbeans (ubuntu)
I have created a Maven | OSGi bundle and then i added this to pom.xml:

<dependency>
    <groupId>net.sf.bluecove</groupId>
    <artifactId>bluecove</artifactId>
    <version>2.1.0</version>
</dependency>

<dependency>
        <groupId>net.sf.bluecove</groupId>
        <artifactId>bluecove-gpl</artifactId>
        <version>2.1.0</version>
</dependency>

to the dependencies element.

I also created a service to be registered and launched during bundle start
in order to be listening
bluetooth channel.
In the service I have just (for now) did this:


import javax.bluetooth.*;
import javax.microedition.io.*;


and

try
{
    LocalDevice localDevice = LocalDevice.getLocalDevice();
}
catch(Exception ex)
{
}

When i register and start the bundle (and service) I see this:

g! start 15
org.osgi.framework.BundleException: Unable to resolve com.mycompany.BTBundle
[15](R 15.0): missing requirement [com.mycompany.BTBundle [15](R 15.0)]
osgi.wiring.package; (osgi.wiring.package=com.ibm.oti.connection) Unresolved
requirements: [[com.mycompany.BTBundle [15](R 15.0)] osgi.wiring.package;
(osgi.wiring.package=com.ibm.oti.connection)]
g! 


If I comment the line:

LocalDevice localDevice = LocalDevice.getLocalDevice();

Everything works fine...

Any help, please?

Imo



--
View this message in context: http://apache-felix.18485.x6.nabble.com/Felix-Bkuetooth-Missing-requirement-tp5016686.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


RE: Felix+Bkuetooth: Missing requirement?

Posted by CLEMENT Jean-Philippe <je...@fr.thalesgroup.com>.
You have two solutions, either embed them in your bundle or transform them into bundles. You may start by embedding them.

Just have to put them in the jar file and change the Bundle-ClassPath, for instance Bundle-ClassPath: .,lib/net.sf.bluecove.bluecove.jar,net.sf.bluecove.bluecove-gpl.jar

I don't know how you may do that within NetBeans. I use Maven with the maven-bundle-plugin which makes things easy.

JP

-----Message d'origine-----
De : imo [mailto:imoveisnacionais@gmail.com] 
Envoyé : jeudi 10 mars 2016 14:26
À : users@felix.apache.org
Objet : RE: Felix+Bkuetooth: Missing requirement?

But blueCove jars are not bundles, arent they? Should I install or make tham available to be used in runtime?





--
View this message in context: http://apache-felix.18485.x6.nabble.com/Felix-Bluetooth-Missing-requirement-tp5016686p5016725.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


RE: Felix+Bkuetooth: Missing requirement?

Posted by imo <im...@gmail.com>.
But blueCove jars are not bundles, arent they? Should I install or make tham
available to be used in runtime?





--
View this message in context: http://apache-felix.18485.x6.nabble.com/Felix-Bluetooth-Missing-requirement-tp5016686p5016725.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


RE: Felix+Bkuetooth: Missing requirement?

Posted by CLEMENT Jean-Philippe <je...@fr.thalesgroup.com>.
Now it just means that you have to install both BlueCove bundles ;)

I would suggest you not to use "raw" Felix, but rather use Karaf which makes use of Felix and adds some nice features around it. Also it is very easy to package a full product with Karaf.

JP

-----Message d'origine-----
De : imo [mailto:imoveisnacionais@gmail.com] 
Envoyé : jeudi 10 mars 2016 11:07
À : users@felix.apache.org
Objet : RE: Felix+Bkuetooth: Missing requirement?

I have restart all the process but again without success I created a new bundle project from the ground up (netbeans, ubuntu)


File , new maven osgi bundle, name=Bundle1

Added some printlns to activator…

public class Activator implements BundleActivator {

    public void start(BundleContext context) throws Exception {
        System.out.println("Starting bundle");
    }

    public void stop(BundleContext context) throws Exception {
        System.out.println("Stopping bundle");
    }

}

and build...

Then, i openned gogo console:

sudo java -jar bin/felix.jar

and:

g! install
file:/home/user1/NetBeansProjects/bundle1/target/bundle1-1.0-SNAPSHOT.jar
Bundle ID: 30
g! start 30
Starting bundle
g! 

OK!

Now, I have just added BlueCove support:
In the pom.xml I added:

<dependency>
            <groupId>net.sf.bluecove</groupId>
            <artifactId>bluecove</artifactId>
            <version>2.1.0</version>
        </dependency>
        
        <dependency>
                <groupId>net.sf.bluecove</groupId>
                <artifactId>bluecove-gpl</artifactId>
                <version>2.1.0</version>
        </dependency>

then build and:

g! uninstall 30
Stopping bundle
g! install
file:/home/user1/NetBeansProjects/bundle1/target/bundle1-1.0-SNAPSHOT.jar
Bundle ID: 31
g! start 31
Starting bundle
g! 

OK!

Then, in the activator class (to turn this more simple) i added:

import javax.bluetooth.*;
import javax.microedition.io.*;

then build and:

g! uninstall 31
Stopping bundle
g! install
file:/home/user1/NetBeansProjects/bundle1/target/bundle1-1.0-SNAPSHOT.jar
Bundle ID: 32
g! start 32
Starting bundle
g! 

OK!


Then, in the activator, (just to make this simpler) next to println:

public void start(BundleContext context) throws Exception {
        System.out.println("Starting bundle");
        
        try
        {
            LocalDevice localDevice = LocalDevice.getLocalDevice();
        }
        catch(Exception ex)
        {
        }
          
    }

build and

g! uninstall 32
Stopping bundle
g! install
file:/home/user1/NetBeansProjects/bundle1/target/bundle1-1.0-SNAPSHOT.jar
Bundle ID: 33
g! start 33
org.osgi.framework.BundleException: Unable to resolve com.mycompany.bundle1 [33](R 33.0): missing requirement [com.mycompany.bundle1 [33](R 33.0)] osgi.wiring.package; (osgi.wiring.package=javax.bluetooth) Unresolved
requirements: [[com.mycompany.bundle1 [33](R 33.0)] osgi.wiring.package; (osgi.wiring.package=javax.bluetooth)]
g! 

Why?
In simple words, what does “Unresolved requirements: [[com.mycompany.bundle1 [33](R 33.0)] osgi.wiring.package; (osgi.wiring.package=javax.bluetooth)]”
means?

Thanks again




--
View this message in context: http://apache-felix.18485.x6.nabble.com/Felix-Bluetooth-Missing-requirement-tp5016686p5016721.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org

RE: Felix+Bkuetooth: Missing requirement?

Posted by imo <im...@gmail.com>.
I have restart all the process but again without success
I created a new bundle project from the ground up (netbeans, ubuntu)


File , new maven osgi bundle, name=Bundle1

Added some printlns to activator…

public class Activator implements BundleActivator {

    public void start(BundleContext context) throws Exception {
        System.out.println("Starting bundle");
    }

    public void stop(BundleContext context) throws Exception {
        System.out.println("Stopping bundle");
    }

}

and build...

Then, i openned gogo console:

sudo java -jar bin/felix.jar

and:

g! install
file:/home/user1/NetBeansProjects/bundle1/target/bundle1-1.0-SNAPSHOT.jar
Bundle ID: 30
g! start 30
Starting bundle
g! 

OK!

Now, I have just added BlueCove support:
In the pom.xml I added:

<dependency>
            <groupId>net.sf.bluecove</groupId>
            <artifactId>bluecove</artifactId>
            <version>2.1.0</version>
        </dependency>
        
        <dependency>
                <groupId>net.sf.bluecove</groupId>
                <artifactId>bluecove-gpl</artifactId>
                <version>2.1.0</version>
        </dependency>

then build and:

g! uninstall 30
Stopping bundle
g! install
file:/home/user1/NetBeansProjects/bundle1/target/bundle1-1.0-SNAPSHOT.jar
Bundle ID: 31
g! start 31
Starting bundle
g! 

OK!

Then, in the activator class (to turn this more simple) i added:

import javax.bluetooth.*;
import javax.microedition.io.*;

then build and:

g! uninstall 31
Stopping bundle
g! install
file:/home/user1/NetBeansProjects/bundle1/target/bundle1-1.0-SNAPSHOT.jar
Bundle ID: 32
g! start 32
Starting bundle
g! 

OK!


Then, in the activator, (just to make this simpler) next to println:

public void start(BundleContext context) throws Exception {
        System.out.println("Starting bundle");
        
        try
        {
            LocalDevice localDevice = LocalDevice.getLocalDevice();
        }
        catch(Exception ex)
        {
        }
          
    }

build and

g! uninstall 32
Stopping bundle
g! install
file:/home/user1/NetBeansProjects/bundle1/target/bundle1-1.0-SNAPSHOT.jar
Bundle ID: 33
g! start 33
org.osgi.framework.BundleException: Unable to resolve com.mycompany.bundle1
[33](R 33.0): missing requirement [com.mycompany.bundle1 [33](R 33.0)]
osgi.wiring.package; (osgi.wiring.package=javax.bluetooth) Unresolved
requirements: [[com.mycompany.bundle1 [33](R 33.0)] osgi.wiring.package;
(osgi.wiring.package=javax.bluetooth)]
g! 

Why?
In simple words, what does “Unresolved requirements: [[com.mycompany.bundle1
[33](R 33.0)] osgi.wiring.package; (osgi.wiring.package=javax.bluetooth)]”
means?

Thanks again




--
View this message in context: http://apache-felix.18485.x6.nabble.com/Felix-Bluetooth-Missing-requirement-tp5016686p5016721.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


RE: Felix+Bkuetooth: Missing requirement?

Posted by CLEMENT Jean-Philippe <je...@fr.thalesgroup.com>.
Ah ok, if you have everything in the same bundle then you should not have any import package for the com.mycompany one.

So you have to remove it - you may also check within the MANIFEST.MF that it is not present.

JP

-----Message d'origine-----
De : imo [mailto:imoveisnacionais@gmail.com] 
Envoyé : mercredi 9 mars 2016 16:46
À : users@felix.apache.org
Objet : RE: Felix+Bkuetooth: Missing requirement?

Well, as i am starting the project, the bundle project has just one package with one bundle class, service interface and service implementation all in the same package com.mycompany.BTBundle;

It seems that the package needs to export the package for its own consumption (during service instantiation)?

Anyway, I have right clicked netbeans dependencies (where there is already the bluecove, bluecove-gpl and osgi core) and added the dependency for the artifact representing the app bundle. Now the BT bundle is also listed in the dependencies node and the project compiles without errors.

However, after uninstall, install and start I see the same error:

org.osgi.framework.BundleException: Unable to resolve com.mycompany.BTBundle [21](R 21.0): missing requirement [com.mycompany.BTBundle [21](R 21.0)] osgi.wiring.package; (osgi.wiring.package=com.ibm.oti.connection) Unresolved
requirements: [[com.mycompany.BTBundle [21](R 21.0)] osgi.wiring.package; (osgi.wiring.package=com.ibm.oti.connection)]





--
View this message in context: http://apache-felix.18485.x6.nabble.com/Felix-Bluetooth-Missing-requirement-tp5016686p5016701.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


RE: Felix+Bkuetooth: Missing requirement?

Posted by imo <im...@gmail.com>.
Well, as i am starting the project, the bundle project has just one package
with one bundle class, service interface and service implementation all in
the same package com.mycompany.BTBundle;

It seems that the package needs to export the package for its own
consumption (during service instantiation)?

Anyway, I have right clicked netbeans dependencies (where there is already
the bluecove, bluecove-gpl and osgi core) and added the dependency for the
artifact representing the app bundle. Now the BT bundle is also listed in
the dependencies node and the project compiles without errors.

However, after uninstall, install and start I see the same error:

org.osgi.framework.BundleException: Unable to resolve com.mycompany.BTBundle
[21](R 21.0): missing requirement [com.mycompany.BTBundle [21](R 21.0)]
osgi.wiring.package; (osgi.wiring.package=com.ibm.oti.connection) Unresolved
requirements: [[com.mycompany.BTBundle [21](R 21.0)] osgi.wiring.package;
(osgi.wiring.package=com.ibm.oti.connection)]





--
View this message in context: http://apache-felix.18485.x6.nabble.com/Felix-Bluetooth-Missing-requirement-tp5016686p5016701.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


RE: Felix+Bkuetooth: Missing requirement?

Posted by CLEMENT Jean-Philippe <je...@fr.thalesgroup.com>.
You need two things, the package to be exported from the bundle which contains the BTBundle class, and the package to be imported from the bundle which show you this issue.

I advise you to check what has been put in these two bundles. Check both MANAFEST.MF files (also pay attention to the versions if specified).

JP


-----Message d'origine-----
De : imo [mailto:imoveisnacionais@gmail.com] 
Envoyé : mercredi 9 mars 2016 10:40
À : users@felix.apache.org
Objet : RE: Felix+Bkuetooth: Missing requirement?

Thanks JP...

I have done this since i read your replay:

In netbeans: RClick project | properties | Export packages | and checked com.mycompany.BTBundle  (Explicit selected packages)

Then:

g! uninstall 19
g! install file:/home/ ...  ..  /BTBundle-1.0-SNAPSHOT.jar Bundle ID: 20 g! start 20

org.osgi.framework.BundleException: Unable to resolve com.mycompany.BTBundle [20](R 20.0): missing requirement [com.mycompany.BTBundle [20](R 20.0)] osgi.wiring.package; (osgi.wiring.package=com.ibm.oti.connection) Unresolved
requirements: [[com.mycompany.BTBundle [20](R 20.0)] osgi.wiring.package; (osgi.wiring.package=com.ibm.oti.connection)]
g! 

Any further help? 

Thank you



--
View this message in context: http://apache-felix.18485.x6.nabble.com/Felix-Bluetooth-Missing-requirement-tp5016686p5016688.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


RE: Felix+Bkuetooth: Missing requirement?

Posted by imo <im...@gmail.com>.
Thanks JP...

I have done this since i read your replay:

In netbeans: RClick project | properties | Export packages | and checked
com.mycompany.BTBundle  (Explicit selected packages)

Then:

g! uninstall 19
g! install file:/home/ ...  ..  /BTBundle-1.0-SNAPSHOT.jar
Bundle ID: 20
g! start 20

org.osgi.framework.BundleException: Unable to resolve com.mycompany.BTBundle
[20](R 20.0): missing requirement [com.mycompany.BTBundle [20](R 20.0)]
osgi.wiring.package; (osgi.wiring.package=com.ibm.oti.connection) Unresolved
requirements: [[com.mycompany.BTBundle [20](R 20.0)] osgi.wiring.package;
(osgi.wiring.package=com.ibm.oti.connection)]
g! 

Any further help? 

Thank you



--
View this message in context: http://apache-felix.18485.x6.nabble.com/Felix-Bluetooth-Missing-requirement-tp5016686p5016688.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


RE: Felix+Bkuetooth: Missing requirement?

Posted by CLEMENT Jean-Philippe <je...@fr.thalesgroup.com>.
Hi,

It just says "com.mycompany.BTBundle" has to be found somewhere, so the related bundle should export the com.mycompany package.

JP

-----Message d'origine-----
De : imo [mailto:imoveisnacionais@gmail.com] 
Envoyé : mardi 8 mars 2016 16:52
À : users@felix.apache.org
Objet : Felix+Bkuetooth: Missing requirement?

I am trying to develop a bundle with bluetooth support (listening + publish) using netbeans (ubuntu) I have created a Maven | OSGi bundle and then i added this to pom.xml:

<dependency>
    <groupId>net.sf.bluecove</groupId>
    <artifactId>bluecove</artifactId>
    <version>2.1.0</version>
</dependency>

<dependency>
        <groupId>net.sf.bluecove</groupId>
        <artifactId>bluecove-gpl</artifactId>
        <version>2.1.0</version>
</dependency>

to the dependencies element.

I also created a service to be registered and launched during bundle start in order to be listening bluetooth channel.
In the service I have just (for now) did this:


import javax.bluetooth.*;
import javax.microedition.io.*;


and

try
{
    LocalDevice localDevice = LocalDevice.getLocalDevice(); } catch(Exception ex) { }

When i register and start the bundle (and service) I see this:

g! start 15
org.osgi.framework.BundleException: Unable to resolve com.mycompany.BTBundle [15](R 15.0): missing requirement [com.mycompany.BTBundle [15](R 15.0)] osgi.wiring.package; (osgi.wiring.package=com.ibm.oti.connection) Unresolved
requirements: [[com.mycompany.BTBundle [15](R 15.0)] osgi.wiring.package; (osgi.wiring.package=com.ibm.oti.connection)]
g! 


If I comment the line:

LocalDevice localDevice = LocalDevice.getLocalDevice();

Everything works fine...

Any help, please?

Imo



--
View this message in context: http://apache-felix.18485.x6.nabble.com/Felix-Bkuetooth-Missing-requirement-tp5016686.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org