osgi

How to run an OSGi framework within usual java-code?

寵の児 提交于 2019-12-03 19:08:56
问题 Can anybody give me an example how to use the osgi framework classes? I haven't a clue how to use those classes ... BR, Markus 回答1: It dependes on which OSGi implementation you are using. I use Eclipse Equinox and start the framework from within a regular java class. The Eclipse jar (called org.eclipse.osgi_longversion.jar) has a class called org.eclipse.core.runtime.adaptor.EclipseStarter. This will boot your OSGi framework. Properties props = new Properties(); // add some properties to

Looking for a good dev environment for OSGi bundles [closed]

别说谁变了你拦得住时间么 提交于 2019-12-03 18:46:20
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I'm currently investigating in the field of dev environment for OSGi bundles. My goal is to find a way to develop, test and debug with ease the bundles I'll be coding. Besides, I have some "cultural" requirements. I want to be able to use java continuous integration servers (typically, Hudson) As a consequence

RMI ClassCastException in OSGi client accessing EJB from JavaEE server

送分小仙女□ 提交于 2019-12-03 18:16:13
问题 I have an OSGi application. Working with EJB context.lookup I had to set Thread context class loader as bundle class loader in order to be able to cast. Like this: Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); Entity entity=bean.getOne(); System.out.println(entity.getClass().getClassLoader()); output is org.apache.felix.framework.BundleWiringImpl@7468776f This code works. The problem that I can't cast if I have ArrayList Thread.currentThread()

Working with Maven, OSGi and Bndtools

坚强是说给别人听的谎言 提交于 2019-12-03 17:31:18
问题 Today I was asked whether it is a good idea to use Maven in our current OSGi application. We used Bndtools and its great since it makes development as easy as possible. Bndtools uses OBR to maintain other bundles and dependency resolution even during the application is running. Since Maven is widely spreading around and is so popular, mostly all try to use it in OSGi environments too. For me these are two different approaches. OSGi has a its own declaration of dependencies, the MANIFEST.MF

Creating a complete OSGi application with Felix & Maven

回眸只為那壹抹淺笑 提交于 2019-12-03 17:20:25
问题 I have a set of OSGi bundles being built using Maven and I was wondering if there is a Maven plugin available that allows me to do the following: Specify the set of bundles to include in a distribution and/or specify a single bundle and have the dependencies resolved. Build a complete distribution of the framework. What I mean is a single zip file containing all the bundles needed, plus the correct directory structure for felix so that the user can simply unzip the file and type "java -jar

Register ServletContainer programmatically in Osgi

﹥>﹥吖頭↗ 提交于 2019-12-03 16:48:11
I'm developing a JAX-RS application with OSGI where resources are loaded dynamically. For this, I need to register the ServletContainer programmatically, then I can call the method ServletContainer.reload (ResourceConfig). I'm running on OSGI environment with support for servlet 3.x, using PAX-WEB 3.0.2 and Jersey 2.4. The problem is when I want to access a resource that implements Server Sent Event, Jersey raises an error that does not support asynchrony because it runs in a Servlet 2.x. Here the exception: 2013-11-05 00:22:37,675 | WARN | qtp27902282-62 | ServletHandler | pse.jetty.servlet

ScriptEngineManager and ScriptEngine can not be loaded in Karaf OSGi (Nashorn not found)

青春壹個敷衍的年華 提交于 2019-12-03 16:37:38
I am trying to use ScriptEngineManager and ScriptEngine to execute some JavaScript code with Java. I use Java 8 I am executing this code under Karaf OSGi. The example I used works fine in a sample Java Class, but packing it in a bundle gives me this error ScriptEngineManager providers.next(): javax.script.ScriptEngineFactory: Provider jdk.nashorn.api.scripting.NashornScriptEngineFactory not found When I look to the headers of the bundle, I see that the bundle imports javax.script, the package of the called classes but it seems that (nashorn) the provider is not found. Thanks Go to file etc

How do I get the OSGi BundleContext for an Eclipse RCP application?

落爺英雄遲暮 提交于 2019-12-03 16:37:12
问题 I have just gotten started with an Eclipse RCP application, it is basically just one of the provided "hello world" samples. When the application boots up, I would like to look at my command-line parameters and start some services according to them. I can get the command-line parameters in IApplication.start : public Object start(IApplicationContext context) { String[] argv = (String[]) context.getArguments().get(IApplicationContext.APPLICATION_ARGS))); } But how do I get the BundleContext, so

Is separate OSGI bundles for api and implementation common practice?

六月ゝ 毕业季﹏ 提交于 2019-12-03 15:43:54
问题 I have a class with dependencies which I want to hot deploy without restarting the dependencies. The class has an interface but there's only one concrete implementation. Initially I created a single bundle with exported the interface and registered the implementation using activator and implementation classes which were not exported. However, if I update the bundle, bundles which use the registered service get restarted after the update when PackageAdmin#refreshPackages is called (this is

Glassfish as an OSGi Container

北慕城南 提交于 2019-12-03 15:43:45
问题 I'm evaluating OSGi containers and the subject came up of using Glassfish to contain my OSGi application components. My question is: Is Glassfish good for this? Does anybody have any experience using it in this way? Background: - The application is not a Java EE application, it's a Spring application. - I've been evaluating Felix + Tomcat. - I've never used Glassfish but it has some features that our operations people are interested in. Thanks! 回答1: GlassFish is IMO a serious candidate and I