我正在寻找一个安全框架,它允许OSGi服务以及CXF Web服务的基于角色的安全性.前段时间我已经使用了弹簧安全性,但是现在我们已经切换到蓝图,据我所知,它不再是一种选择.要配置访问规则,我想主要使用标准的@RolesAllowed注释.那么我最好的出发点是什么?我也想过将自己作为蓝图扩展来实现,但我更喜欢现有的解决方案.
在骆驼中,说不是所有人都ENDPOINT
支持是正确的INOUT
ExchangePattern
吗?
如果是,那么文档的哪一部分告诉哪个端点支持哪个ExchangePattern
或这是一种隐含的知识。
由它ENDPOINT
来支持INOUT
。
下面是我得出结论的代码示例。
我正在玩骆驼示例-jms-file,我将其修改为
queue1 --> queue2 ---> file://test ---> file://test1
context.addRoutes(new RouteBuilder() {
public void configure() {
from("test-jms:queue:test.queue1")
.process(sleep(1))
.to("test-jms:queue:test.queue2");
from("test-jms:queue:test.queue2")
.process(sleep(2))
.to("file://test");
from("file://test")
.process(sleep(3))
.to("file://test1");
}
private Processor sleep(final int sleepId) {
return new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
System.out.println("Going for sleep sleepid=" + sleepId + ", thread=" + Thread.currentThread().getName());
Thread.sleep(5000l);
System.out.println("Done sleep sleepid=" + sleepId + ", thread=" + Thread.currentThread().getName()); …
Run Code Online (Sandbox Code Playgroud) 我按照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] …
在我的项目中,我确实可以进行故障安全测试.
如果我运行,mvn clean install -DskipTests
则跳过两种测试.
如果我尝试使用-Dit.test = TestName运行单个故障安全测试,那么首先运行所有的surefire测试然后我的测试..但是因为可靠性测试需要很长时间,这是不好的.
在某些情况下,我想跳过surefire测试,但运行故障安全IT测试.
unit-testing maven maven-surefire-plugin maven-failsafe-plugin
我有一些事务代码在旧版本的Apache Karaf中运行良好.现在在Apache Karaf 4.0.4中我看到了很多例外.
和
java ×3
osgi ×3
apache-karaf ×2
apache-camel ×1
dosgi ×1
maven ×1
security ×1
unit-testing ×1
xa ×1