Tag: osgi

Blueprint maven插件RuntimeException

我的代码中没有任何蓝图注释,但是当我尝试使用maven构建我的包时,我得到了 [ERROR] Failed to execute goal org.apache.aries.blueprint:blueprint-maven-plugin:1.1.0:blueprint-generate (default) on project data-collection-terminal-updates: Error building commands help: RuntimeException – [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.aries.blueprint:blueprint-maven-plugin:1.1.0:blueprint-generate (default) on project data-collection-terminal-updates: Error building commands help at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213) […]

karaf在组件工厂示例时不显示任何错误

我从这个链接尝试过组件工厂示例。 接口: package com.java.examplefactoryservice; public interface ExampleFactoryService { public void start(); public void stop(); } 工厂提供者: package com.java.examplecomponentfactoryserviceprovider; import java.util.Map; import org.apache.felix.scr.annotations.Activate; import org.apache.felix.scr.annotations.Component; import com.java.examplefactoryservice.ExampleFactoryService; @Component(name = “ExampleComponentFactoryServiceProvider”, factory = “example.factory.provider”) public class ExampleComponentFactoryServiceProvider implements ExampleFactoryService { @Activate public void activate(Map properties) { System.out.println(“Actiavted!!!”); } @Override public void start() { System.out.println(“Started !!!!”); } @Override […]

如何在Eclipse E4应用程序中启动时创建一些东西?

我想在E4 RCP应用程序启动后运行一些东西。 怎么做?

如何在OSGi中使用Apache POI

我想在OSGi中使用Apache POI来编写带有流式OOXML API(SXSSF)的Excel工作簿。 流式API自POI 3.9起可用。 由于最新的Apache POI 3.11jar不是捆绑包: 在OSGi中使POI工作的最佳方法是什么? 我尝试了两种方法: 将jar子直接嵌入将使用它们的唯一束中 使用POIjar作为捆绑包装预先包装 我绝望地将所有依赖项放在一起。 首先关于在我的包中嵌入POI jar:我的bndtools文件包含 -buildpath: \ … libs/dom4j-1.6.1.jar;version=file,\ libs/poi-3.11.jar;version=file,\ libs/poi-ooxml-3.11.jar;version=file,\ libs/poi-ooxml-schemas-3.11.jar;version=file Private-Package: \ … org.openxmlformats.schemas.*,\ org.apache.poi.*,\ org.dom4j.*,\ com.microsoft.schemas.office.x2006.*,\ schemaorg_apache_xmlbeans.*,\ schemasMicrosoftComOfficeExcel.*,\ schemasMicrosoftComOfficeOffice.*,\ schemasMicrosoftComVml.* 这会产生一个包,它导入很多很多东西,例如org.bouncycastle.asn1.x509和org.junit 。 我不打算在我的应用程序中加密或测试 – 所以这两个可能在某种程度上是“可选的”。 我怎么指定这个? 有没有一种收集所有这些依赖关系的好方法? 注意:至少还需要org.apache.commons.codec和com.sun.msv.datatype.xsd.lib ,但它们已经是捆绑包。 使用预先包装的jar子,我尝试使用org.apache.servicemix.bundles.poi 3.9_2。 这也需要dom4j所以我使用了预先包装好的org.apache.servicemix.bundles.dom4j但是至少需要javax.xml.stream 1.0版本,我的JVM / Felix OSGi将其作为“仅”版本0.0.0.1_007_JavaSE 。 我手动修复了这个问题(丑陋),但后来陷入了另一个依赖关系。 什么是好方法?

OSGi Fragment包含Hibernate,具有Runtime pojos

我的要求是使用hibernate映射各种数据库(特别是SQL Server,MySQl和Postgres); 从db record创建一个xml文件。 对于hibernate,我使用JAssist在运行时创建hbm文件和pojos。 我的代码工作得很好,为了进一步模块化,我实现了每个数据库的片段包。因此我的主机包将处理运行时类创建并将它们添加到类加载器,hbm文件创建逻辑和BL中。 片段通过传递参数来调用它。 当我为每个数据库创建一个片段包时,我的主机包中创建的运行时pojo类在我的片段包中可见,我使用“Thread.currentThread()。getContextClassLoader()。loadClass()”检查并能够创建其实例, 问题是当我从片段bundle调用Hibernate函数时,我得到“实体未映射”,AFAIK当hibernate无法找到带有表的映射类时,会出现这些exception。 所以我猜Hibernate没有找到我的运行时pojo类。 它可以在主机中找到。 主机:运行时Pojo创建,HBM和CFG创建和更新逻辑BL 片段:Hibernate层,调用Hibernate函数,XML创建逻辑

如何从eclipse / osgi应用程序中包含对jar文件的依赖?

我创建了一个Eclipse 4应用程序,我需要一个提供function的jar作为我的应用程序的一部分(这可能是任何东西,例如log4j ,使其变得微不足道)。 我添加了jar作为项目类路径的一部分( Right Click->Configure Build Path ),但在运行时我的服务失败并出现ClassNotFound错误(我猜是来自OSGI?)。 无论如何,搜索到这一点,至少据我所知,我应该将jar作为另一个Plugin一部分添加,并从我的应用程序/服务创建一个依赖于这个新插件。 即我Plugin Project from Existing JAR archives创建了一个Plugin Project from Existing JAR archives 。 这次设置工作。 因此,如果我理解这一点,在为Eclipse / OSGi开发时,我们不应该直接在类路径中添加jars ,而是通过插件添加它们(为什么?)。 问题:如果到目前为止我是正确的,在开发项目时包含jars的标准做法是什么? Plugin Project from existing JAR archives定义/创建一个Plugin Project from existing JAR archives并添加所需的所有必需的第三方库, 或者每个需要的jar 或其他可能具有不同的插件项目??? 对不起,如果我的术语不准确。 我是OSGi和Eclipse编程的新手 注意:谈论jars我不是指其他OSGi服务。 我指的是使用应用程序的许多部分所需的准备好的,可靠的第三方库的规范。 例如log4j或xml解析库或apache commons等

启动服务时出现Jpa-hibernate错误

以下是我在启动服务后看到的日志中的错误…您能否帮助解决此问题。 2013-08-22 10:35:37,111 | DEBUG | l Console Thread | AbstractServiceReferenceRecipe | r.AbstractServiceReferenceRecipe 143 | 7 – org.apache.aries.blueprint.core – 1.1.0 | Found initial references null for OSGi service (&(&(org.apache.aries.jpa.proxy.factory=true)(osgi.unit.name=tenant))(objectClass=javax.persistence.EntityManagerFactory)) 2013-08-22 10:35:37,111 | DEBUG | l Console Thread | BlueprintContainerImpl | container.BlueprintContainerImpl 280 | 7 – org.apache.aries.blueprint.core – 1.1.0 | Running blueprint container for bundle com.igt.arcus.framework.jta.arcus-framework-feature-service […]

Spring:PropertyPlaceholderConfigurer找不到属性文件

我使用PropertyPlaceholderConfigurer对Spring有一个奇怪的问题。 我的一个豆子设计如下: classpath:jdbc.properties 问题是spring永远不会找到jdbc.properties( FileNotFoundException )。 该文件位于bundle classpath中的名为“resources”的文件夹中(我在OSGi项目中工作)。 我几乎尝试了所有组合(“jdbc.properties”,“/ jdbc.properties”,“classpath:jdbc.properties”,“classpath:/jdbc.properties”,“/ resources / jdbc.properties”等等… )但它永远不会奏效。 有关信息,如果在某些时候,我做的事情如下: URL u = someClassLoader.getResource(“jdbc.properties”); 它确实工作没有任何问题,并找到该文件。 实际上我完全无法理解spring的错误是什么。 如果您有任何想法可以帮助我,请提前感谢。 我在spring不是很有经验,所以我可能在某处犯了一个错误。 [编辑] 实际上,这是类加载器的问题:如果我这样做: new ClassPathResource(“jdbc.properties”); 它不起作用。 但是: new ClassPathResource(“jdbc.properties”,someClassIntheBundle.class.getClassLoader()); 工作得很好。 我相信Spring使用我的bundle所使用的自己的bundle的ClassLoader。 你知道解决这个棘手问题的方法吗? 谢谢,

未找到XPathFactoryImpl错误(使用myBatis)

使用myBatis standAlone(Atlassian jira插件(OSGi)环境) 发生以下错误。 [INFO] [talledLocalContainer] org.apache.ibatis.exceptions.PersistenceException: [INFO] [talledLocalContainer] ### Error building SqlSession. [INFO] [talledLocalContainer] ### Cause: java.lang.RuntimeException: XPathFactory#newInstance() failed to create an XPathFactory for the default o bject model: http://java.sun.com/jaxp/xpath/dom with the XPathFactoryConfigurationException: javax.xml.xpath.XPathFactoryConfigurationException: java. util.ServiceConfigurationError: javax.xml.xpath.XPathFactory: Provider org.apache.xpath.jaxp.XPathFactoryImpl not found [INFO] [talledLocalContainer] ### Cause: java.lang.RuntimeException: XPathFactory#newInstance() failed to create an XPathFactory for the […]

在运行时在Eclipse中查找依赖包

Eclipse包(例如,在激活器代码中)如何在运行时找到依赖的Bundle实例? 我想找到Eclipse选择的捆绑包以满足依赖性要求,我不想自己解释清单。 一个例子:我想在我当前捆绑所依赖的所有捆绑包中找到名为“marker.txt”的所有资源。 也是传递依赖。 为了实现这一点,我需要能够找到所有这些捆绑包开始。