osgi

Looking for basic example of using Apache Felix in dynamic loading of Jar file and instancing a class at runtime in Java

亡梦爱人 提交于 2019-12-09 13:09:41
问题 I tried implementing my own class loader based on some examples. However, I think it is not working as expected ( unable to reload Jar file etc. I see few references of recommending using OSGI or Apache Felix for handling Jar file loading. Is there any examples of loading Jar, instancing a class from the Jar? More details on what I am trying to accomplish..I have a Java command line application that essentially continuously runs. I want it to be able to reference JAR files dynamically at

How to OSGIfy a library

笑着哭i 提交于 2019-12-09 11:24:39
问题 I'm working on a project, it's integration project, we are using Apache Camel and Apache Karaf. In the project, I need to use the Jira REST Java client library. So I've read quite a lot of various articles and threads about how to wrap non-OSGI library to OSGI bundle, but I'm really not sure if I got it right. So, I've created a POM file with a dependency to the needed library. Made a package and tried to deploy it to Karaf, of course, Karaf complained for missing packages. So, I've found

Best way to convert existing java projects to osgi bundles

亡梦爱人 提交于 2019-12-09 09:47:50
问题 We have lot of components out of which we want to modularize only a few to start with. Wondering what is the best way (in the context of my build environment) to create bundles out of all these components? My environment: Java 6, Maven 2.2.1, Hudson Technologies: Spring 3.0.5, WebSphere 7, Hibernate 3.2.x and most of apache commons. Requirements Modularize only few components. Rest of the components can export all of the packages. When imported into eclipse, I should be able to see the

How to choose in runtime among several OSGi services in an intelligent way?

橙三吉。 提交于 2019-12-09 06:05:41
问题 I've in mind an intelligent system which can choose among available OSGi services dynamically. That is, choose an implementation or another depending of some runtime parameter. For example, notify to a running algorithm that change an operator after several iterations, or depending of load balancing in a system or whatever. while(stopCriterion){ operator.doSomething(); //There exist many operator implementations } My first approach is to use DS to expose the services and bind services with 0.

Equinox java.lang.NoClassDefFoundError

不想你离开。 提交于 2019-12-08 19:59:17
I am running a very simple osgi bundle whose activator looks like this public void start(BundleContext bundleContext) throws Exception { JAXBContext con = JAXBContext.newInstance(Activator.class); } This always throws exception org.osgi.framework.BundleException: Exception in com.test.bundle.Activator.start() of bundle com.test.bundle. at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:734) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:683) at org.eclipse.osgi.framework.internal.core.BundleHost

Apache Felix File Install example

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-08 16:40:49
问题 Is there any example of how to configure/install Apache Felix File install? In official website, it has been mentioned you need to configure properties etc. But no way they have mentioned where you need to put those configuration properties, how to set it up etc. I have downloaded org.apache.felix.fileinstall-3.2.6.jar file and I have felix framework installed. Now I am not getting where should I put those configuration properties so that file install will read that. Can anyone guide me on

Are there any Java-compilers that leverage an OSGi-environment instead of using the classpath?

孤人 提交于 2019-12-08 11:46:22
问题 Are there any ways to make javac use an existing OSGi-environment for the resolution of build-time dependencies instead of setting the classpath explicitely? I know I could write an OSGi-component that uses the Compiler-API of the JDK, but I think there should be a more straightforward solution. Alternatively, if no such extension is available for javac , does ejc allow such a thing (usable from the command line; I'd be willing to accept an Equinox-only solution with ejc )? 回答1: ant task to

jdo/OSGi: error building JDO PersistenceManagerFactory after bundle update

帅比萌擦擦* 提交于 2019-12-08 11:06:09
问题 I'm using JDO with datanucleus-mongodb 3.2.3 and spring 3.0.7 on top of karaf 2.2.10. On a fresh OSGi bundle install I'm able to persist on mongodb without issues, but after a bundle reinstall, I get the following error while building a new JDO PersistenceManagerFactory: ERROR: Bundle [my_bundle] [242] Unable to get module class path. (java.lang.IllegalStateException: zip file closed) Where the ID (242) refers to the first assigned ID to the bundle (in other words, the ID of the old bundle).

OSGI bundle requires jdbc driver when using service interface from other bundle

点点圈 提交于 2019-12-08 10:35:56
问题 I have 3 simple bundles WebService, DataService and DataSource deployed in Fuse ESB, each built using the maven bundle plugin with blueprint for wiring beans and registering services. The datasource bundle contains connection details and registers the Oracle jdbc datasource via JNDI. The DataService uses OpenJPA and has a DAO, domain entities and a service interface implementation with one method which queries the database for a domain entity and returns a string. The service interface is

Apache Felix not able to access Postgres JDBC

落爺英雄遲暮 提交于 2019-12-08 09:47:55
问题 I downloaded Postgresql-9.2-1003.jdbc3.jar and put it in felix\bundle directory. My program accesses Postgres table EMP and prints it. I am trying to do it in Felix OSGi server. There are two parts of my program: Part-1 program which simply connects to Postgres JDBC driver and opens the database: package com.myprogram.myemp; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; import org.postgresql.Driver; public class