Bndtools and Karaf

1,066 vistas
Ir al primer mensaje no leído

Alexey Romanov

no leída,
6 abr 2012, 2:35:56 p.m.6/4/12
para bndtool...@googlegroups.com
What would be the best way to use Bndtools for Apache Karaf development? E.g. can I create a run descriptor for Karaf?

Neil Bartlett

no leída,
6 abr 2012, 8:59:02 p.m.6/4/12
para bndtool...@googlegroups.com
I hope somebody else on the list can answer this for me, since I have no direct experience with Karaf. I am certainly open to including Karaf-specific enhancements in Bndtools if anybody wanted to contribute them.

Regards,
Neil

Per Kristian Söreide

no leída,
9 abr 2012, 6:09:13 a.m.9/4/12
para bndtool...@googlegroups.com
Hi everyone,

For the last question:

How about a "target description" where we can combine -runsystempackages, -runvm, -runbundles, -runproperties  etc? It would be great if one "target description" could extend another, so "my karaf on java 7" could extend "karaf 2.2.3". 

/PK

Christian Baranowski

no leída,
9 abr 2012, 1:24:09 p.m.9/4/12
para bndtool...@googlegroups.com
Hi everyone,

I think a good way to integrated Karaf into bndtools could be to create a Karaf specific project launcher. More details see the bnd documentation section "Overriding the plugins"  http://www.aqute.biz/Bnd/Projects

Don’t know if this is the best way to integrated Karaf into bnd / bndtools, Peter or Neil I think can say more about this when to use specific project launchers or not. 

I have created a simple prototype to show how to create a Karaf project launcher by copy and past the logic from the default bnd project launcher. The only thing which is really different to the bnd project launcher, is how to create the framework here the implementation from my prototype launcher:

private Framework createFramework() throws Exception {
String karafHomeFolder = parms.runProperties.get("karaf.home");
if (karafHomeFolder == null) {
error("Karaf home folder is not set, "
+ "please setup run property karaf.home "
+ "to your Karaf installation folder.");
return null;
}
System.setProperty("karaf.home", karafHomeFolder);
System.setProperty("karaf.base", karafHomeFolder);
System.setProperty("karaf.data", karafHomeFolder + "/data");
System.setProperty("karaf.history", karafHomeFolder
+ "/data/history.txt");
System.setProperty("karaf.instances", karafHomeFolder + "/instances");
System.setProperty("karaf.startLocalConsole", "true");
System.setProperty("karaf.startRemoteShell", "false");
System.setProperty("karaf.lock", "false");
Main main = new Main(new String[0]);
main.launch();
systemBundle = main.getFramework();
return systemBundle;
}

I’m not a Karaf specialist and I don’t know if this is the best way to embedded Karaf? 
The source of the prototype launcher can be found on github https://github.com/tux2323/bnd.karaf.

When you like to use the prototype Karaf project launcher, you must override the bnd project launcher, by adding the bundle with the karaf specific project launcher to the run path of the bnd configuration. This can be done by adding this header:

-runpath: bnd.karaf.launcher;version=1.0.0

For the prototype launcher the path to the karaf installation must be setup via the run property karaf.home:
-runproperties: karaf.home=/Users/developer/Downloads/apache-karaf-2.2.6

The project launcher is absolute not perfect it is only a prototype, for example at the moment you must define the runfw and so on.  But the integration via a karaf specific project launcher looks in my eyes like a good solution.

Regards
Christian


Christian Baranowski

no leída,
9 abr 2012, 1:29:37 p.m.9/4/12
para bndtool...@googlegroups.com

Hi,

addendum to my previous mail, a extension point to create a framework in the bnd launcher bundle would be great. Is there any other extension point then a project launcher? Then I must not copy and past the bnd launcher logic.

Regards
Christian

Christian Baranowski

no leída,
9 abr 2012, 4:32:58 p.m.9/4/12
para bndtool...@googlegroups.com
Hi,

after I've been thinking about my email again, I must say the project
launcher is not good solution, It is much easier, we could use a
bundle with a OSGi FrameworkFactory which created a factory to start a
embedded Karaf (the extension point in the bnd launcher, for which I
had asked in my last mail). The implementation of the framework
factory could be done like the createFactory method of the project
launcher prototype.

Sorry for the bad idea with the project launcher to integrated Karaf
in bnd / bndtools.

Regards
Christian

2012/4/9 Christian Baranowski <fvundr...@googlemail.com>:

Christian Baranowski

no leída,
9 abr 2012, 5:59:47 p.m.9/4/12
para bndtool...@googlegroups.com
Hi,

pushed to github a demo bundle which provides a OSGi framework factory
to start Karaf in bndtools.
https://github.com/tux2323/bnd.karaf/tree/master/karaf.framework.factory

Redgards
Christian

2012/4/9 Christian Baranowski <Christian.M...@googlemail.com>:

Alexey Romanov

no leída,
12 abr 2012, 5:37:19 a.m.12/4/12
para bndtool...@googlegroups.com
It works better for me if I export org.osgi.framework.*,
org.osgi.service.*, and org.osgi.util.tracker, like other framework
bundles do.

Yours, Alexey Romanov

Christian Baranowski

no leída,
12 abr 2012, 4:19:07 p.m.12/4/12
para bndtool...@googlegroups.com
Hi Alexey,

okay I just add the org.osgi.framework and org.osgi.service ... packages in the karat framework factory demo bundle to the exported package list see https://github.com/tux2323/bnd.karaf/tree/master/karaf.framework.factory

Redgards
Christian

paulf

no leída,
25 sept 2012, 10:43:41 p.m.25/9/12
para bndtool...@googlegroups.com


On Friday, April 13, 2012 6:19:07 AM UTC+10, Christian Baranowski wrote:
Hi Alexey,

okay I just add the org.osgi.framework and org.osgi.service ... packages in the karat framework factory demo bundle to the exported package list see https://github.com/tux2323/bnd.karaf/tree/master/karaf.framework.factory

Redgards
Christian


Hi Christian,
I have imported your code from github into eclipse and tried to get it working.
Eclipse in my case reports that the src dir is missing from cnf and that test directories are missing from the other projects..easy to fix and i have done this.
But..I am then totally lost..
The code as imported from github has eclipse osgi set as the -runfw for the karaf.framework.factory project. Is this correct?
Also, the same project build reports 18 warnings related to split packages.
Would it be possible for you to expand on what is necessary to get this setup working?

Thanks
Paul Fraser

Michiel Vermandel

no leída,
28 nov 2012, 4:29:27 a.m.28/11/12
para bndtool...@googlegroups.com
Hi Christian,

I contacted you by mail earlier, but it might have been better if I did it here. So, here I go again:
Just as Paul, I managed to get the code compiling and I have now got 3 jars.
...\bnd.karaf-master\karaf.framework.factory\generated\karaf.framework.factory.jar
...\bnd.karaf-master\bnd.karaf.launcher\generated\bnd.karaf.launcher.jar
...\bnd.karaf-master\bnd.karaf.demo\generated\bnd.karaf.demo.jar

Can you please explain in short how to continue from that point?
Where should we put these jars?
How can/where we set the run configuration settings:
-runfw: karaf.framework.factory;version='1.0.0'
-runproperties: karaf.home=/Users/developer/Downloads/apache-karaf-2.2.6

Thanks,
Michiel Vermandel



Op woensdag 26 september 2012 04:43:41 UTC+2 schreef paulf het volgende:

Christian Baranowski

no leída,
28 nov 2012, 5:02:54 p.m.28/11/12
para bndtool...@googlegroups.com
Hi Michiel,

you should add the karaf.framework.factory.jar to a bnd repository. You can use for that the release feature of bndtools if you like to add the bundle to the release repository. The OSGi framework factory bundle for karaf is only a demo how a karaf integration could be implemented it is not a final integration.

I attached also a ZIP with a demo bndtools project which contains a karaf.framework.factory.jar bundle in the libs folder, the bundle is direct referenced as file in the bnd.bnd configuration, so the OSGi framework bundle must not be deployed in bundle repository. This demo works with Karaf version 2.2.6 (http://karaf.apache.org/index/community/download/archives.html#Karaf2.2.6) and Bndtools 2.0.0.alpha and I hope it should also work with older Bndtools versions.

Would be very interested if the demo works on your machine.

Thanks,
Christian


2012/11/28 Michiel Vermandel <mver...@gmail.com>
bndtools.karaf.demo.zip

Michiel Vermandel

no leída,
29 nov 2012, 1:15:57 a.m.29/11/12
para bndtool...@googlegroups.com,christian.m...@googlemail.com
Hi Christian,

Thanks for your response and effort to create the project.
I will test it today or tomorrow (already a lot to do today, though very tempting).
Of course I will report back how it went.

Thanks again,

Michiel

Michiel Vermandel

no leída,
29 nov 2012, 9:07:26 a.m.29/11/12
para bndtool...@googlegroups.com,christian.m...@googlemail.com
Hi all,

I briefly tested the supplies demo from Christian and these are my findings:
* I first tested it with my current Karaf 2.3.0 installation and it does not work. I get loads of  java.lang.NoSuchMethodError: org.osgi.framework.Bundle.adapt(Ljava/lang/Class;)Ljava/lang/Object;
* I then installed a fresh Karaf 2.2.6 and all went great.
One question though... I get:

Start Karaf Demo
        __ __                  ____     
       / //_/____ __________ _/ __/     
      / ,<  / __ `/ ___/ __ `/ /_       
     / /| |/ /_/ / /  / /_/ / __/       
    /_/ |_|\__,_/_/   \__,_/_/        

  Apache Karaf (2.2.6)

Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '<ctrl-d>' or 'osgi:shutdown' to shutdown Karaf.

karaf@root> Stop Karaf Demo

and then the framework terminates.

Is that intended/expected?
I had in mind to get a running environment like when choosing one of the two defined frameworks.
Any ideas, considerations?

Thanks,

Michiel

Filippo Rossoni

no leída,
20 ago 2013, 9:46:12 p.m.20/8/13
para bndtool...@googlegroups.com
aggiornato per karaf 3.0.0.RC1 https://github.com/filippor/bnd.karaf

init factory
Aug 21, 2013 3:45:23 AM org.apache.karaf.main.Main launch
INFO: Installing and starting initial bundles
Aug 21, 2013 3:45:23 AM org.apache.karaf.main.Main launch
INFO: All initial bundles installed and set to start
return org.apache.felix.framework [0]
Aug 21, 2013 3:45:23 AM org.apache.karaf.main.lock.SimpleFileLock lock
INFO: Trying to lock /home/frossoni/app/apache-karaf-3.0.0.RC1/lock
Aug 21, 2013 3:45:23 AM org.apache.karaf.main.lock.SimpleFileLock lock
INFO: Lock acquired
Aug 21, 2013 3:45:23 AM org.apache.karaf.main.Main$KarafLockCallback lockAquired
INFO: Lock acquired. Setting startlevel to 100
        __ __                  ____      
       / //_/____ __________ _/ __/      
      / ,<  / __ `/ ___/ __ `/ /_        
     / /| |/ /_/ / /  / /_/ / __/        
    /_/ |_|\__,_/_/   \__,_/_/         

  Apache Karaf (3.0.0.RC1)

Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown Karaf.

karaf@root()> 

flang...@gmail.com

no leída,
9 may 2014, 12:09:26 p.m.9/5/14
para bndtool...@googlegroups.com
Dear Filipo, dear all

thanks for posting this.

1. Would someone be able to provide some simple step by step instructions on how to install the plugin. Short notes would be sufficient
2. What is the experience using this? How mature is this?

Thanks a lot in advance
Frank

Tamar Amir Maroshi

no leída,
4 oct 2014, 11:01:09 a.m.4/10/14
para bndtool...@googlegroups.com
I am sorry to report that https://github.com/filippor/bnd.karaf is not working.
It fails build the cnf project with the following ant run error:
Description    Resource    Path    Location    Type
Cannot find E:\eclipse\workspaces\karaf\cnf\build-template.xml imported from E:\eclipse\workspaces\karaf\cnf\build.xml    build.xml    /cnf    line 4    Ant Buildfile Problem


There is no build-template.xml in the git repository.
Hope you can fix this soon. I am trying to use https://raw.githubusercontent.com/tux2323/bnd.karaf/master/cnf/build.xml as build.xml
Then Failed to ant build karaf.framework.factory with build.xml
Got the following errors:

Buildfile: E:\eclipse\workspaces\karaf\karaf.framework.factory\build.xml
init:
     [echo] Enter project karaf.framework.factory
dependencies:
   [subant] No sub-builds to iterate on
compile:
    [javac] Compiling 1 source file to E:\eclipse\workspaces\karaf\karaf.framework.factory\bin
    [javac] E:\eclipse\workspaces\karaf\karaf.framework.factory\src\karaf\framework\launch\KarafFrameworkFactory.java
    [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.5
    [javac] E:\eclipse\workspaces\karaf\karaf.framework.factory\src\karaf\framework\launch\KarafFrameworkFactory.java:35: error: try-with-resources is not supported in -source 1.5
    [javac]       try (URLClassLoader cl = new URLClassLoader(urls,new ClassLoader() {
    [javac]           ^
    [javac]   (use -source 7 or higher to enable try-with-resources)
    [javac] 1 error
    [javac] 1 warning

BUILD FAILED

Yet the project karaf.framework.factory
Compile with no error.
Please advise

Thanks
Responder a todos
Responder al autor
Reenviar
0 mensajes nuevos