0

Hey guys i believe it is a simple issue but i cant find anything:

How is it possible to specify the run levels for my bundles using the maven-pax-plugin?

(I call mvn pax:provision from the command line)

Thank you!

hueck
  • 193
  • 3
  • 15

1 Answers1

3

it's a part of pax-runner provision settings

e.g

mvn:com.acme/foo/1.0.0@5

Dmytro Pishchukhin
  • 2,369
  • 1
  • 14
  • 19
  • Hello Dmytro, unfourtenatly the homepage of the pax team is down and i cant get it to work... I have tried mvn pax:provision bundle@6 but nothing happend. Can you please provide me an concrete example? – hueck Dec 11 '12 at 14:42
  • 1. what did you expect from run level 6? 2. what is default framework run level? – Dmytro Pishchukhin Dec 11 '12 at 16:16
  • The situation is as follow: I am using different bundles which register a Service via DS. In another Bundle i have something like services = Activator.getContext().getAllServiceReferences(foo, null); And i am getting a null Pointer exception. As far as i understand thats becaus all Bundles have the same start level. Because the pax:plugin specifies level 1 for OSGI and 5 for all other Bundles i came up with 6 – hueck Dec 12 '12 at 09:58
  • is Activator.getContext() static? Are you sure that you use this code after BundleActivator.start() and you assigned BundleContext correctly to this static field? – Dmytro Pishchukhin Dec 12 '12 at 13:50
  • Yeah my Activator looks like following: private static BundleContext context; public static BundleContext getContext() { return context; }@Override public void start(BundleContext bundleContext) throws Exception { Activator.context = bundleContext; In another class i am using something like this: services = Activator.getContext().getAllServiceReferences(name, null); – hueck Dec 12 '12 at 14:01
  • Is another class a part of the bundle? Try to refactor your code to avoid static references of BundleContext - it's an OSGi bad-smell. – Dmytro Pishchukhin Dec 13 '12 at 08:50
  • Ok, thank you for this. I've got this one from an Eclipse Plugin... But that still left me with my problem: Maybe Start Levels are the wrong approach. What i want: I have an Interface and multiple Implementations registered via DS with some Properties, each in an own Bundle (one for the interace and lets say 5 different implentating). I then want to look up all Services registered via that interface and then match the one exact one via the properties file. But my Bundles all have the default Start Level 5 und so i always get an NPE in my "LookUp" Bundle. – hueck Dec 13 '12 at 11:09
  • In this case, you can use DS to handle references of all registered services: by class name and target filter. DS engine will provide you all references if you describe them correctly. – Dmytro Pishchukhin Dec 13 '12 at 12:19
  • Ok i will give it a try. Thank you very much for pointing into the right direction – hueck Dec 14 '12 at 14:22
  • @DmytroPishchukhin How do I specify this setting when using the pax-provision plugin (and not pax-runner directly) – Midhat Jan 21 '13 at 09:51
  • Found it. It goes as a param in the pax-plugin configuration like this: `mvn:org.apache.cxf.dosgi/cxf-dosgi-ri-singlebundle-distribution/1.3.1@start:10` – Midhat Jan 21 '13 at 13:02