我是OSGi的新手,开始使用felix.我目前非常精通捆绑包,服务等概念.我有一个要求,我可以将Felix嵌入到Tomcat中,我尝试使用Google搜索,但无法找到符合我目的的相关解决方案.
我真正需要的是..直到现在我曾经将我的网络应用程序包部署到嵌入式http jetty服务/ PAX网站..安装在Felix内部,但现在我想将Felix放入Apache Tomcat /任何其他应用程序服务器,这样每当我的tomcat启动我需要启动并运行我的felix实例,同时应该能够通过felix部署/安装/启动我的捆绑包.
任何形式的帮助将不胜感激.
根据这篇文章,IDEA使用Osmorc来运行OSGi框架.反过来,它使用Pax Runner来启动不同的框架实现.
IDEA 11中的工具链只能运行Apache Felix 3.0.2,但我必须运行4.0.2版本.可能吗?IDEA还有其他OSGi框架发射器吗?
我有一个片段包,我创建它来访问第二方jar的一些添加功能.我的片段应该注册一个服务来公开这个新功能.它似乎不起作用.在深入了解故障排除之前,我想知道是否允许这样做?也就是说,Felix SCR的捆绑监视器会查看还是忽略片段?
我用Apache Felix和Glassfish工作了几个月.我可以创建简单的Web应用程序.现在我必须基于OSGI架构创建Java守护进程.是否有任何有关示例代码的优秀教程可以帮助学习Apache Felix for Java桌面应用程序.我还想问一下这些包是如何打包的?Web应用程序是jar文件.
当您在gogo shell中输入命令时,它首先在默认范围内查找该命令的匹配项.如何配置此默认范围?
例如,如果您使用gogo启动Felix框架,它会使用felix范围作为默认值.但是如果启动equinox 3.8.1(现在使用felix shell作为默认值),它会将equinox范围用作默认值.
主要的烦恼是,当我输入:
g! help
Run Code Online (Sandbox Code Playgroud)
我得到了结果equinox:help,而不是felix:help,所以我想将felix范围作为默认值.
是否有OSGi框架属性来配置它?
我正在尝试启动我的一个捆绑包,但是一旦启动它,我就会得到以下异常.我不确定问题是什么.
org.osgi.framework.BundleException: Unresolved constraint in bundle GoldeneyeModellingFramework [1]: Unable to resolve 1.0: missing requirement [1.0] osgi.wiring.package; (&(osgi.wiring.package=com.host.domain.sharedpersonalize.storageservice)(version>=1.0.0)(!(version>=2.0.0)))
at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3974)
at org.apache.felix.framework.Felix.startBundle(Felix.java:2037)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:955)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:942)
at com.host.personalize.bullseye.InitializeOSGiFramework.installAndStartBundle(InitializeOSGiFramework.java:217)
at com.host.personalize.bullseye.InitializeOSGiFramework.getBundlesInformation(InitializeOSGiFramework.java:167)
at com.host.personalize.bullseye.InitializeOSGiFramework$1.run(InitializeOSGiFramework.java:92)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:452)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:328)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:161)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:109)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:192)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:216)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:897)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:919)
at java.lang.Thread.run(Thread.java:736)
Run Code Online (Sandbox Code Playgroud)
让我告诉你我是怎么做的 - 我已经按照本教程推出了一个OSGi框架,它工作正常,但是一旦我开始捆绑,GoldeneyeModellingFramework-
for (Bundle bundle : installedBundles) {
bundle.start();
}
Run Code Online (Sandbox Code Playgroud)
而且,我在我的主项目中使用下面的依赖项,它启动了一个OSGi框架/容器:
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.framework</artifactId>
<version>4.2.1</version>
</dependency>
<dependency>
<groupId>org.ops4j.pax.url</groupId>
<artifactId>pax-url-mvn</artifactId>
<version>1.3.6</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
它总是给我上面的例外.Bundle GoldeneyeModellingFramework取决于GoldeneyeStorageService包含此包的maven项目com.host.domain.sharedpersonalize.storageservice. …
我正在使用OSGi-(felix),SpringDM,hibernate,maven的项目.当我安装bundle时,没关系,我运行bundle id时的输出是:
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;version="[2.5,3)",org.springframework.transaction.annotation;version="[2.5,3)", Bundle-SymbolicName=DrugManagerDAO, Export-Package=drug,drugGroup,model;version="1.0.0", Bundle-Version=1.0.0, Build-Jdk=1.7.0_45, Created-By=Apache Maven Bundle Plugin, Bundle-ManifestVersion=2]
BundleContext null
Revisions [169.0]
BundleId 169
SymbolicName DrugManagerDAO
RegisteredServices null
ServicesInUse null
Version 1.0.0
Location file:/home/nguyenvinhlinh/Projects/felix-framework-4.2.1/bundle/DrugManager-1.0.jar
State 2
Bundle 169|Installed | 1|DrugManagerDAO (1.0.0)
Run Code Online (Sandbox Code Playgroud)
这就是我看到的,当我开始这个包时:
org.osgi.framework.BundleException: Unresolved constraint in bundle DrugManagerDAO [169]: Unable to resolve 169.0: missing requirement [169.0] osgi.wiring.package; (osgi.wiring.package=org.hibernate)
Run Code Online (Sandbox Code Playgroud)
这是我的beans.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:osgi="http://www.springframework.org/schema/osgi"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/osgi
">
<tx:annotation-driven …Run Code Online (Sandbox Code Playgroud) 我试图找出org.osgi.framework.storage.clean=onFirstInitFelix框架背景下的真正含义.
根据OSGi规范:
org.osgi.framework.storage:文件系统中一个有效的文件路径到目录......框架可以自由地使用这个目录,例如,完全删除其中的所有文件和目录...
org.osgi.framework.storage.clean:指定是否以及何时应清除框架的存储区域.如果未指定任何值,则不会清除框架存储区域.
由于根据规范,框架可以根据需要自由使用此目录,因此当OSGi规范声明应该清理存储区域时,不清楚是什么意思.清理可能意味着每个OSGi实现都有所不同.
Apache Felix 文档说明:
首次初始化框架实例时,onFirstInit会刷新捆绑缓存.
具体到Felix文档:
rm -rf felix-cache与Felix容器关闭时相同,以便在启动时重建缓存,就好像这是第一次启动容器一样?我有以下服务:
@Component(
immediate = true,
metatype = true)
@Service
@Property(name = EventConstants.EVENT_TOPIC, value = {ReplicationAction.EVENT_TOPIC})
public class MyService implements EventHandler {
@Property
private static final String MULTI_PROPERTY = "config.multiproperty";
........
//another implementation
........
}
Run Code Online (Sandbox Code Playgroud)
我想MULTI_PROPERTY成为数组值,有可能使用像图像上的一组值:
怎么实现呢?