osgi

Split packages in plain java

落花浮王杯 提交于 2019-12-06 01:59:02
问题 OSGi has a problem with split packages, i.e. same package but hosted in multiple bundles. Are there any edge cases that split packages might pose problems in plain java (without OSGi) ? Just curious. 回答1: For OSGi packages in different bundles are different, regardless of their name, because each bundle uses its own class loader. It is not a problem but a feature, to ensure encapsulation of bundles. So in plain Java this is normally not a problem, until you start using some framework that

Printing OSGI bundle classpath?

拈花ヽ惹草 提交于 2019-12-06 01:57:13
问题 In a normal java application its possible to print the content of the classpath with: String ss = System.getProperty("java.class.path"); System.out.println(ss); But how do I print the classpath of an OSGI bundle created using the eclipse PDE wizard? In the activator its possible to get the current bundle like: public void start(BundleContext context) throws Exception { super.start(context); plugin = this; Bundle b = context.getBundle(); // java doc: This bundle's class loader is not used to

Transaction rollback in OSGi

走远了吗. 提交于 2019-12-06 01:55:17
I have an OSGi bundle in which I declare a service and inject into it a transaction with blueprint: <bean id="MyServiceImpl" class="com.test.impl.MyServiceImpl"> <jpa:context property="em" unitname="mypu" /> <tx:transaction method="*" value="Required" /> </bean> <service id="MyService" ref="MyServiceImpl" interface="com.test.api.MyService" /> In this service I have two methods each one of which is writing data in the database, something like the following: public void createParent() throws MyException { Parent parent = new Parent(); ... // Set parent fields em.persist(parent); createChild(); /

Dynamically load additional jar files using Web Start / JNLP

可紊 提交于 2019-12-06 01:52:18
问题 The Web Start Developers Guide states All application resources must be retrieved from the JAR files specified in the resources section of the JNLP file, or retrieved explicitly using an HTTP request to the Web server. Storing resources in JAR files is recommended, since they will be cached on the local machine by Java Web Start. Now, I have some resources I want to dynamically load after my application has been started (for example OSGi bundles). I can do this using plain HTTP, but I would

Unresolved constraint in bundle, missing requirement osgi.wiring.package

对着背影说爱祢 提交于 2019-12-06 01:37:01
问题 I am having a project using OSGi-(felix), SpringDM, hibernate, maven. when I installed bundle, it is ok, the output when I run bundle id is: LastModified 1384619994484 Headers [Manifest-Version=1.0, Bundle-Vendor=NguyenVinhLinh, Bnd-LastModified=1384619954778, Tool=Bnd-2.1.0.20130426-122213, Bundle-Name=DrugManager, Built-By=nguyenvinhlinh, Import-Package=org.hibernate,org.hibernate.classic,org.hibernate.criterion,org.springframework.beans.factory;version="[2.5,3)",org.springframework.core.io

Log4j2 api cannot find Log4j2 core in OSGi environment

梦想与她 提交于 2019-12-05 23:37:27
问题 I'm trying to use log4j2 OSGi bundles, but it seems log4j2 api cannot find log4j2 core in an OSGi environment. I'm continuously getting the following exception : ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console I found the same exception discussed in few places but still I could not figure out this issue. Isuspect I'm getting this issue because log4j2 api cannot find the log4j-provider

OSGi: passing parameters to a specific bundle

北城余情 提交于 2019-12-05 21:34:16
I have a custom jar with a custom Main class, which starts the OSGi Framework and installs/starts the bundles. This main jar also includes a properties file. Goal: I have a bundle A which should pick up the properties of this properties file of the main jar somehow. My first attempt was to define a component in bundle A (using Apache Felix SCR/ Declarative Services) and retrieve the properties in its activate-method. This works so far that I'm getting the default value specified in the @Property-annotation. But how can I now pass the properties of the properties file to this component? Passing

How to integrate Vaadin 7 with OSGi?

巧了我就是萌 提交于 2019-12-05 21:20:35
I want to integrate vaadin 7 with osgi but there is no longer any AbstractApplicationServlet class. I've followed the integration using the vaadin bridge by Neil Bartlett https://github.com/njbartlett/VaadinOSGi . I've tried using the VaadinServlet somehow but with no luck. I've also searched for other solutions but found none. Do you have any suggestions? Thanks Vaadin 7 has a lot of design changes that are not visible for default use cases, but especially for OSGi integration you have to do some extra work. To get you started you should try to understand the initialization process concerning

How Apache Karaf sorts bundles to install and start?

£可爱£侵袭症+ 提交于 2019-12-05 18:21:38
I have defined four bundles: bundle 1 : export package x version 1 bundle 2 : import package x ver [1,2] and export package y;y uses x bundle 3 : export package x version 2 bundle 4 : import package y and also import package x version 2 Using apache felix (distribuable binary), I found that I should manually impose to not resolve (or start) the bundle 1 and then bundle 2 before starting the bundle 3 (otherwise a uses constraint problem appears because bundle 2 will use package x version 1 and in bundle 4 will appear package x version 1 and version 2 --> uses constraint violation). Thanks to

Existing implementations of OSGi Configuration Admin Service?

筅森魡賤 提交于 2019-12-05 15:54:55
问题 We are considering to use Configuration Admin Service as a primary API for configuring components in our OSGi-based application. It would be nice if we could reuse some existing implementation so I'm trying to investigate and evaluate the most popular ones. I know there is: Apache Felix Config Admin (org.apache.felix.cm) Equinox Config Admin (org.eclipse.equinox.cm) Are there any other implementations to be considered? Also I was not able to find any good documentation for these