我正在尝试为Apache Cookbook实现消息签名的Apache Camel路由器: https://github.com/CamelCookbook/camel-cookbook-examples/blob/master/camel-cookbook-security/src/main/resources/META-INF/spring/signatures-context.xml
我使用的是Karaf 5.7.0(Talend ESB的一部分)和Camel 2.12.1 camel-crypto包依赖于“spring-crypto-utils”(http://springcryptoutils.com/)已根据Camel Cookbook示例添加到Blueprint配置中。
我的蓝图配置:
<?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"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
xmlns:crypt="http://springcryptoutils.com/schema/crypt"
default-activation="eager"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://cxf.apache.org/blueprint/jaxws http://cxf.apache.org/schemas/blueprint/jaxws.xsd
http://springcryptoutils.com/schema/crypt http://springcryptoutils.com/schema/crypt.xsd
">
<cm:property-placeholder persistent-id="mock.jms"
update-strategy="reload" placeholder-prefix="jms:${">
<cm:default-properties>
<cm:property name="broker" value="tcp://localhost:61616" />
<cm:property name="destinationstd" value="stdlog" />
<cm:property name="destinationsat" value="satlog" />
</cm:default-properties>
</cm:property-placeholder>
<!-- Camel route -->
<bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
<property name="brokerURL" value="jms:${broker}" />
</bean>
<bean id="processor" class="mock.jms.Processor" />
<crypt:keystore id="keyStore"
location="classpath:keystore.jks"
password="keystorePassword"/>
<crypt:keystore id="trustStore"
location="classpath:truststore.jks"
password="truststorePassword"/>
<camelContext xmlns="http://camel.apache.org/schema/blueprint">
<route>
<from uri="activemq:topic:stdlog" />
<log message="MessageId: ${in.header.JMSMessageID}"/>
<!-- <to uri="log:cz.icz.kbe?level=ERROR"/> -->
<to uri="log:cz.icz.kbe?showHeaders=true test"/>
<choice>
<when>
<simple>${body} regex '(?is).*EventMarker.*:.*Audit.*'</simple>
<bean ref="processor" />
<to uri="activemq:topic:satlog" />
</when>
</choice>
</route>
</camelContext>
<!-- End Camel route -->
</blueprint>
我正在尝试实现非常简单的Camel路由,该路由过滤来自ActiveMQ的消息,该消息适合所提供的正则表达式,并将SHA1WithRSA签名添加到消息头(camel-crypto功能)但是当我只是添加标签来加载密钥库内容时(此密钥库)稍后将用于签名)捆绑包无法启动并在GracePeriod中挂起并显示日志消息:
2015-06-02 18:25:35,172 | INFO | Refresh Packages | e.aries.blueprint.container.BlueprintContainerImpl 307 | 11 - org.apache.aries.blueprint.core - 1.2.0 | Bundle jms is waiting for namespace handlers [http://springcryptoutils.com/schema/crypt]
似乎camel找不到“springcryptoutils”命名空间的命名空间处理程序。代码正确编译并正确生成bundle,在karaf(使用/ deploy文件夹进行手动部署)部署期间会出现问题。 karaf没有抱怨我的捆绑的依赖,karaf命令“标题”没有显示任何可疑的:
karaf@trun> headers 292
JMS Mock (292)
--------------
Manifest-Version = 1.0
Created-By = Apache Maven Bundle Plugin
Bnd-LastModified = 1433262312090
Build-Jdk = 1.8.0_40
Built-By = belunek
Tool = Bnd-2.4.0.201411031534
Bundle-Blueprint = OSGI-INF/blueprint/jms.cli.xml
Bundle-ManifestVersion = 2
Bundle-SymbolicName = jms
Bundle-Version = 1.0.0
Bundle-Name = JMS Mock
Export-Package =
mock.jms;version=1.0.0,
mock.jms.cli;version=1.0.0
Import-Package =
org.apache.felix.gogo.commands;version="[0.10,1)",
org.apache.karaf.shell.console;version="[2.3,3)",
com.fasterxml.jackson.databind;version="[2.2,3)",
javax.jms,
org.apache.activemq,
org.apache.activemq.camel.component,
org.apache.camel;version="[2.12,3)",
org.osgi.service.blueprint;version="[1.0.0,2.0.0)",
org.slf4j,
org.apache.felix.service.command;status=provisional;version="[0.10,1)"
请问有什么问题吗?
编辑: 我通过简单的puttng jar将所有必需的bundle安装到karaf deploy目录中。目标是安装camel-crypto以及此捆绑包所需的所有依赖项。 Theres是aditional部署的JAR列表: ActiveMQ的 - 骆驼5.7.0.jar bcpg-jdk15on-1.52.jar bcprov-jdk15on-1.52.jar 骆驼加密2.12.1.jar 弹簧加密utils的-1.4.0.jar
有完整的POM列表 - 由于我的尝试而包含一些不必要的部分并且失败
http://maven.apache.org/xsd/maven-4.0.0.xsd“&GT;
<modelVersion>4.0.0</modelVersion>
<groupId>mock.jms</groupId>
<artifactId>jms</artifactId>
<version>1.0.0</version>
<packaging>bundle</packaging>
<name>JMS Mock</name>
<properties>
<osgi.version>4.3.1</osgi.version>
<bundle-plugin.version>2.4.0</bundle-plugin.version>
<karaf.version>2.3.1</karaf.version>
<activemq.version>5.7.0</activemq.version>
<camel.version>2.12.1</camel.version>
<jackson.version>2.2.2</jackson.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<version>${osgi.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.compendium</artifactId>
<version>${osgi.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.karaf.shell</groupId>
<artifactId>org.apache.karaf.shell.console</artifactId>
<version>${karaf.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.karaf.shell</groupId>
<artifactId>org.apache.karaf.shell.commands</artifactId>
<version>${karaf.version}</version>
<scope>provided</scope>
</dependency>
<!--suppress NonOsgiMavenDependency -->
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-all</artifactId>
<version>${activemq.version}</version>
<scope>provided</scope>
</dependency>
<!--suppress NonOsgiMavenDependency -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>${camel.version}</version>
<scope>provided</scope>
</dependency>
<!--suppress NonOsgiMavenDependency -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-crypto</artifactId>
<version>${camel.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring</artifactId>
<version>${camel.version}</version>
<scope>provided</scope>
</dependency>
<!--suppress NonOsgiMavenDependency -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-xmlsecurity</artifactId>
<version>${camel.version}</version>
<type>bundle</type>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jasypt</artifactId>
<version>${camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring-security</artifactId>
<version>${camel.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>4.0.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>4.0.0.RELEASE</version>
</dependency>
<!--suppress NonOsgiMavenDependency -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
<scope>provided</scope>
</dependency>
<!--suppress NonOsgiMavenDependency -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
<scope>provided</scope>
</dependency>
<!--suppress NonOsgiMavenDependency -->
<dependency>
<groupId>com.google.code.spring-crypto-utils</groupId>
<artifactId>spring-crypto-utils</artifactId>
<version>1.4.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<version>${bundle-plugin.version}</version>
<dependencies>
<dependency>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bndlib</artifactId>
<version>2.4.0</version>
</dependency>
</dependencies>
<configuration>
<instructions>
<_nouses>true</_nouses>
<_noee>true</_noee>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${project.name}</Bundle-Name>
<Bundle-Version>${project.version}</Bundle-Version>
<Import-Package>
org.apache.felix.service.command,
org.apache.felix.gogo.commands,
org.apache.karaf.shell.console,
*
</Import-Package>
<Export-Package>
mock.jms*;version=${project.version}
</Export-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>