osgi

Why can't maven find an osgi bundle dependency?

匆匆过客 提交于 2019-11-28 10:53:01
I have declared a OSGi bundle as a dependency in my maven project. ( It just happens to be the felix container. ) <dependency> <groupId>org.apache.felix</groupId> <artifactId>org.apache.felix.framework</artifactId> <version>4.0.2</version> <type>bundle</type> <scope>compile</scope> </dependency> When I try to build, it says it can't find it. [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] Failed to resolve artifact. Missing: ---------- 1) org.apache.felix:org.apache.felix.framework:bundle:4.0.2 Try downloading the file manually from

Start an osgi bundle failed with Require-Bundle: org.eclipse.core.runtime; bundle-version=“0.0.0”

北战南征 提交于 2019-11-28 10:52:17
问题 I'm trying to install and load an external bundle to a simple equinox application. The targeted bundle is coming from a set of plugins for eclipse available here: http://sourceforge.net/projects/rodin-b-sharp/files/Core_Rodin_Platform/2.4/ ( rodin-2.4-dev.zip ). When I start equinox: $ java -jar org.eclipse.osgi_3.7.1.R37x_v20110808-1106.jar -console I can install it osgi> install file:///path_to/rodin-2.4-dev/org.eventb.core_2.4.0.r14093.jar Bundle id is 1 But I have an exception when I

Google Client API in OSGI

家住魔仙堡 提交于 2019-11-28 10:50:04
问题 I'm having trouble providing the dependencies needed for OAuth Client Library for Java within an OSGI application framework (AEM). https://developers.google.com/api-client-library/java/google-oauth-java-client/setup I don't want to manually convert each dependency to an OSGI bundle, BND. So I'm using maven-bundle-plugin to embed these into my bundle. My process so far has been to watch the error.log for messages about 'Unresolved constraint in bundle.' Then track down the missing package, add

How to start and use Apache Felix from code?

半腔热情 提交于 2019-11-28 10:23:56
I can't find information about starting and using Apache Felix from code. I want do things which I am able (or unable ;) ) to do with Apache Felix's Shell. For example, how do I start a module? Please help. So, after trying around a lot of time, here's a possible solution . We will have two projects: OsgiModuleA , which contains a module-to-be-started OsgiUsage , which will use the "Module A" Project OsgiModuleA File module/a/Activator.java package module.a; import org.osgi.framework.*; public class Activator implements BundleActivator, ServiceListener { @Override public void start

How can I share non-OSGi libraries between bundles in an OSGi container?

China☆狼群 提交于 2019-11-28 10:10:27
I came across this question when trying to share the Struts packages among multiple bundles inside an OSGi container. I wanted to avoid both duplicating dependencies inside the bundles and introducing a new dependency between them (by having one bundle export its internal dependencies for the other to share). It turns out the answer is very easy if you happen to use Maven, and if you aren't, you can still use the Maven solution to learn how to create the same result with some other mechanism. I found this approach useful multiple times during my project, so I'll post an example here. An

How to bootstrap weld-osgi version 2 in SE application

混江龙づ霸主 提交于 2019-11-28 09:58:05
问题 It's really not funny. There is no information in internet how to run weld-osgi second version (2.1.2.final) in se app. Instructions for ver 1 don't work. Let the developers be ashamed that they didn't provide necessary samples. I wrote them here. So, I have and OSGi activator and I want to get beans from it. In GF4 I used this: private BeanManager getBeanManager() throws NamingException { try{ InitialContext initialContext = new InitialContext(); return (BeanManager) initialContext.lookup(

osgi: Using ServiceFactories?

烈酒焚心 提交于 2019-11-28 09:24:23
I'm currently trying to get a simple bundle containing a Service Factory running. This is my factory class: public class SvcFactory implements ServiceFactory<ServiceB> { @Override public ServiceB getService(Bundle bundle, ServiceRegistration<ServiceB> registration) { return new ServiceBImpl(); } @Override public void ungetService(Bundle bundle, ServiceRegistration<ServiceB> registration, ServiceB service) { } } This is my service that should be created by the factory: public class ServiceBImpl implements ServiceB { private ServiceA svcA; public void setA(ServiceA a) { svcA = a; } } And finally

How to handle Import-Package entries which come from jars on the Bundle-Classpath?

你离开我真会死。 提交于 2019-11-28 08:49:20
问题 I have put a few jars on my Bundle-Classpath. The line below shows the entry in my pom.xml, which uses the Felix plugin to create the manigest.mf for the bundle. <Bundle-ClassPath>.,lib/com.springsource.org.h2-1.0.71.jar,lib/com.springsource.org.apache.lucene-2.3.2.jar,lib/com.springsource.org.apache.lucene.search-2.3.2.jar</Bundle-ClassPath> These jars have classes which import packages, but from what I can see, they all have a MANIFEST.MF, which has it's own (accurate) list of Import

How to find and stop all currently running threads?

折月煮酒 提交于 2019-11-28 06:56:31
I have an multiple-threaded java project and I want to add a method stop() to stop all the running threads. The problem is that this project is developed by someone else, and I am not familiar with how it implements multiple threads. What I know is that once the project get started, many threads are invoked and they run forever. Is there a way to find all running threads and stop them? I have searched a lot, and found how to get a list of running threads: Set<Thread> threadSet = Thread.getAllStackTraces().keySet(); What to do next to stop all the running threads? The reason why I want to stop

Camel, Spring, OSGI: Is there a way to specify the stop method?

一笑奈何 提交于 2019-11-28 06:04:49
问题 I'm running a Camel Spring OSGI application. The Camel context is initialized through Spring. When the bundle stops, I need to do some clean-up activities, like de-registering the message listener. How do I do that? Is there a method I can override? I understand that an OSGI bundle must provide the activator start and stop methods but my understanding also is that the Camel/Spring/OSGI framework overrides these methods. My beanx.xml: <beans> <camelContext id="camel" xmlns="http://camel.apache