我试图找出Apache ServiceMix 4.2的开始
可悲的是,主页上的教程似乎已经过时了 ...... 4.2服务似乎是开箱即用的,并配置了karaf,而教程则讨论将文件复制到不再存在的"hotdeploy"文件夹中在4.2 ...
有人能指出我对ServiceMix 4.2有效的教程吗?我正在尝试测试两个简单的HelloWorld Web服务的通信,或者看看如何配置BC来连接Web服务或类似的东西,只是为了开始.非常感谢任何帮助或指示.
我按照http://blog.nanthrax.net/2011/11/apache-karaf-cellar-and-dosgi/上的Karaf Cellar示例进行了操作.
我创建了3个OSGi包,即服务(Bundle1),服务实现(Bundle2)和客户端(Bundle3).我有2个karaf容器在不同的机器上运行,其中(Bundle1)和(Bundle2)部署在一个karaf实例上,(Bundle1)和(Bundle3)部署在其他karaf实例上.如示例中给出的那样,每件事情都很好.我从Karaf container2中删除了客户端包,并希望通过蓝图中描述的camel路由调用该服务.
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
<reference id="myService" interface="org.service.cellar.EchoService" timeout="20000" availability="optional" />
<camelContext id="camel" trace="false"
xmlns="http://camel.apache.org/schema/blueprint">
<route id="client">
<from uri="timer://foo?fixedRate=true&period=10000" />
<bean ref="myService" method="process" />
<log message=" Invoking Service : ${body}" />
</route>
</camelContext>
</blueprint>
Run Code Online (Sandbox Code Playgroud)
一旦我在karaf container2中部署了上述蓝图,我就在karaf容器中看到以下异常1.我无法找出此错误的来源.任何有关此问题的评论表示赞赏.
谢谢.
2012-10-15 13:24:40,477 | ERROR | pool-11-thread-7 | EventDispatchTask | 78 - org.apache.karaf.cellar.core - 2.2.4 | Error while dispatching task
java.lang.NullPointerException
at org.apache.karaf.cellar.dosgi.RemoteServiceCallHandler.handle(RemoteServiceCallHandler.java:74)[83:org.apache.karaf.cellar.dosgi:2.2.4]
at org.apache.karaf.cellar.dosgi.RemoteServiceCallHandler.handle(RemoteServiceCallHandler.java:34)[83:org.apache.karaf.cellar.dosgi:2.2.4]
at sun.reflect.GeneratedMethodAccessor31.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[:1.6.0_35]
at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_35]
at org.apache.aries.proxy.impl.ProxyHandler$1.invoke(ProxyHandler.java:50)[7:org.apache.aries.proxy:0.3.1] … 我有项目模块,它被构建为osgi包(spring-dm).捆绑包正在karaf容器中部署.我有数据库交互classees,使用spring-jdbc开发.
我无法设置声明式事务,有人可以分享经验/指向我可以获取更多信息的资源.
框架与版本
卡拉夫:2.2.9
春季3.1.2.RELEASE
提前致谢!!
我正在尝试使karaf-maven-plugin为我的应用程序生成一个功能文件.该应用程序取决于cxf功能,但我似乎无法使插件生成功能xml来反映这一点.
我的功能模块剪切:
<dependencies>
<dependency>
<groupId>com.test.test</groupId>
<artifactId>test</artifactId>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>karaf-maven-plugin</artifactId>
<version>3.0.3</version>
<extensions>true</extensions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>karaf-maven-plugin</artifactId>
<configuration>
<startLevel>80</startLevel>
<includeTransitiveDependency>true</includeTransitiveDependency>
<aggregateFeatures>false</aggregateFeatures>
</configuration>
</plugin>
</plugins>
</build>
Run Code Online (Sandbox Code Playgroud)
我的模块的依赖项:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<version>5.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.compendium</artifactId>
<version>5.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.configadmin</artifactId>
<version>1.8.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.2.8</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>provided</scope>
</dependency> …Run Code Online (Sandbox Code Playgroud) 到目前为止,我已经成功构建了OSGI包,并通过Apache CXF调用这些包中定义的Web服务.接下来,我希望能够在我们的捆绑包中设置断点,因为它们在Karaf环境中执行.
我已经研究过EIK,但似乎项目在一段时间内没有活动?兼容性页面指出与其兼容的最新Eclipse版本是Juno.
从EIK项目似乎最后一次活动开始,我在StackOverflow上也遇到了以下引用:
Karaf团队现在也正在努力与EIK更好地整合,但目前它还没有像所需的那样深度集成(参见相关问题)
使用Eclipse调试在Karaf 3.0.3或Karaf 4.0.0 M3中运行的OSGI包的最佳方法是什么?
我正在构建一个 .kar 文件,但是当我运行时mvn package出现此错误:
[INFO] --- maven-bundle-plugin:2.4.0:bundle (default-bundle) @ common ---
[WARNING] Bundle se.eman.path.to.my.package:common:bundle:1.0.0-SNAPSHOT : Split package, multiple jars provide the same package:com/sun/xml/bind/v2
Use Import/Export Package directive -split-package:=(merge-first|merge-last|error|first) to get rid of this warning
Package found in [Jar:jaxb-impl, Jar:jaxb-core]
Class path [Jar:., Jar:camel-core, Jar:slf4j-api, Jar:jaxb-impl, Jar:jaxb-core, Jar:jaxb-api, Jar:istack-commons-runtime, Jar:FastInfoset, Jar:jsr173_api, Jar:camel-groovy, Jar:groovy-all, Jar:commons-logging, Jar:slf4j-log4j12,
Jar:log4j]
[WARNING] Bundle se.eman.path.to.my.package:common:bundle:1.0.0-SNAPSHOT : Split package, multiple jars provide the same package:com/sun/istack
Use Import/Export Package directive -split-package:=(merge-first|merge-last|error|first) to get rid of this warning …Run Code Online (Sandbox Code Playgroud) 不幸的是,被称为Karaf的OSGi容器实现的文献资料很少。刷过概念,没有建立术语之间的关系。
阅读Karaf开发人员撰写的文字后得出的结论(我想是吗?):
当OSGi容器中其他捆绑软件(我称为依赖项)不可用时,“前提条件”不允许启动我的“特殊服务器”捆绑软件。
依赖项是相同的
这两个都不会导致Karaf自动获取并启动那些依赖项
根据文档https://karaf.apache.org/manual/latest/provisioning的要求,将导致Karaf自动获取并启动那些依赖项/先决条件/要求。
features.xml开发人员可以在自己的存储库中了解从何处获取依赖项/先决条件/要求,但不会自动将其添加到Karaf中。
请填写我。
这里是我的,我跑通过features.xml的例子maven-resources-plugin的copy-resources这样的插值目标${var}小号出现。
<?xml version="1.0" encoding="UTF-8"?>
<features xmlns="http://karaf.apache.org/xmlns/features/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.0.0 http://karaf.apache.org/xmlns/features/v1.0.0"
name="special-server-features">
<!-- Special Server -->
<feature name="special-server" version="1.0.0" install="auto" resolver="(obr)">
<details>
A feature is just a group of bundles that should all be installed together.
When an OSGi container adds a bundle, it goes through a resolution process
to make sure that the bundle’s dependencies are met (and that it does not
conflict with …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 Spring Boot 2.1.4 和 Java 8、OSGi 版本 5.0.0 和 Apache Karaf 4.1.3 构建 OSGi Karaf 应用程序。
我在 GitHub 中创建了以下项目,当我使用 Spring Boot 1.5.9 时,该项目构建并运行良好。
但是当我将 Spring boot 版本从 1.5.9-RELEASE 更改为 2.1.4-RELEASE 并尝试执行此操作mvn clean install时,我从 maven-bundle-plugin 收到以下错误
[WARNING] Bundle com.nemesis:osgi-spring-boot-demo-bundle:bundle:0.0.1-SNAPSHOT : Export com.nemesis.osgi.springboot, has 4, private references [com.nemesis.osgi.springboot.controller, org.springframework.context.annotation, org.springframework.boot, org.springframework.boot.autoconfigure],
[ERROR] Bundle com.nemesis:osgi-spring-boot-demo-bundle:bundle:0.0.1-SNAPSHOT : Exception: java.lang.ArrayIndexOutOfBoundsException: 19
[ERROR] Bundle com.nemesis:osgi-spring-boot-demo-bundle:bundle:0.0.1-SNAPSHOT : Invalid class file META-INF/versions/9/module-info.class (java.lang.ArrayIndexOutOfBoundsException: 19)
[ERROR] Bundle com.nemesis:osgi-spring-boot-demo-bundle:bundle:0.0.1-SNAPSHOT : Classes found in the wrong directory: …Run Code Online (Sandbox Code Playgroud) osgi apache-karaf maven-bundle-plugin osgi-bundle spring-boot
我搜索了 looooot,但找不到解决我的问题的方法。
我使用 osgi、karaf 和 java 8。
我有一些模块,例如:
WEBSERVICE-这个模块里面的东西可以说API,持久性,适配器
持久性和 api 启动正常,但适配器给出了该错误:
Uses constraint violation. Unable to resolve resource adapter [adapter [288](R 288.2)]
because it is exposed to package 'javax.xml.bind.annotation' from resources
org.apache.felix.framework [org.apache.felix.framework [0](R 0)] and
jakarta.xml.bind-api [jakarta.xml.bind-api [79](R 79.0)] via two dependency
chains.
Run Code Online (Sandbox Code Playgroud)
链在适配器和 api 中。
但是,这是什么意思?
我可以将它安装为功能,它们都会启动,但我的另一包将放在 GracePeriod 中,如果我在 karaf 上执行 DIAG,它会说:
Status: GracePeriod
Declarative Services
Blueprint
01/09/19 19:00
Missing dependencies:
(&(osgi.unit.name=example_db)(objectClass=javax.persistence.EntityManager))
Run Code Online (Sandbox Code Playgroud)
请注意,我有其他 webservice 模块,其中一些工作正常,我检查了 pom,它们具有相同的依赖项和相同的版本
数据源也很好,我已经尝试添加一些功能,如 hibernate.entityManager,但它不起作用。
我正在处理 karaf 的捆绑包和插件的复杂项目结构。
附加到流程时,我无法使用 WATCH,因为找不到项目:
无法评估,因为 java.lang.IllegalStateException:找不到项目 XY。
是否可以从断点所在的文件及其包含的 maven 文件确定正确的项目名称?
由于某种原因,XY 内的内容不起作用。
这是启动配置:
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "Debug Karaf",
"projectName" : "XY",
"request": "attach",
"hostName" : "localhost",
"port": 5005
}
]
Run Code Online (Sandbox Code Playgroud)
编辑:断点和逐步调试确实有效。奇怪的是,这两件事是不同的。
apache-karaf ×10
osgi ×7
java ×4
maven ×3
karaf ×2
osgi-bundle ×2
dosgi ×1
eclipse ×1
launch ×1
provisioning ×1
spring ×1
spring-boot ×1