Apache Karaf启用Gemini蓝图

时间:2017-08-27 23:17:18

标签: spring osgi apache-karaf karaf blueprint-osgi

我已经下载了Karaf 3.0.8并试图启用spring 3.2和gemini蓝图 - 但没有成功

karaf@root()> feature:install spring/3.2.17.RELEASE_1
karaf@root()> feature:install gemini-blueprint 
Exception in thread "EclipseGeminiBlueprintExtenderThread-25" org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 22 in XML document from URL [bundle://55.0:0/OSGI-INF/blueprint/kar-deployer.xml] is invalid; 
nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c:    
The matching wildcard is strict, but no declaration can be found for element 'ext:property-placeholder'.
....
karaf@root()> feature:list -i
Name             | Version          | Installed | Repository     | Description                                       
---------------------------------------------------------------------------------------------------------------------
spring           | 3.2.17.RELEASE_1 | x         | spring-3.0.8   | Spring 3.2.x support                              
gemini-blueprint | 1.0.0.RELEASE    | x         | spring-3.0.8   | Gemini Blueprint Extender                         
standard         | 3.0.8            | x         | standard-3.0.8 | Karaf standard feature                            
config           | 3.0.8            | x         | standard-3.0.8 | Provide OSGi ConfigAdmin support                  
region           | 3.0.8            | x         | standard-3.0.8 | Provide Region Support                            
package          | 3.0.8            | x         | standard-3.0.8 | Package commands and mbeans                       
kar              | 3.0.8            | x         | standard-3.0.8 | Provide KAR (KARaf archive) support               
ssh              | 3.0.8            | x         | standard-3.0.8 | Provide a SSHd server on Karaf                    
management       | 3.0.8            | x         | standard-3.0.8 | Provide a JMX MBeanServer and a set of MBeans in K
karaf@root()> list -t 0
START LEVEL 100 , List Threshold: 0
ID | State    | Lvl | Version          | Name                                                               
------------------------------------------------------------------------------------------------------------
 0 | Active   |   0 | 4.2.1            | System Bundle                                                      
 1 | Active   |   5 | 2.4.7            | OPS4J Pax Url - aether:                                            
 2 | Active   |   5 | 2.4.7            | OPS4J Pax Url - wrap:                                              
 3 | Active   |   8 | 1.8.4            | OPS4J Pax Logging - API                                            
 4 | Active   |   8 | 1.8.4            | OPS4J Pax Logging - Service                                        
 5 | Active   |  10 | 3.0.8            | Apache Karaf :: Service :: Guard                                   
 6 | Active   |  10 | 1.8.4            | Apache Felix Configuration Admin Service                           
 7 | Active   |  11 | 3.5.2            | Apache Felix File Install                                          
 8 | Active   |  12 | 5.0.3            | ASM all classes with debug info                                    
 9 | Active   |  20 | 1.1.1            | Apache Aries Util                                                  
10 | Active   |  20 | 1.0.1            | Apache Aries Proxy API                                             
11 | Active   |  20 | 1.0.8            | Apache Aries Blueprint CM                                          
12 | Active   |  20 | 1.0.4            | Apache Aries Proxy Service                                         
13 | Active   |  20 | 1.0.1            | Apache Aries Blueprint API                                         
14 | Resolved |  20 | 1.0.0            | Apache Aries Blueprint Core Compatiblity Fragment Bundle, Hosts: 15
15 | Active   |  20 | 1.6.1            | Apache Aries Blueprint Core, Fragments: 14                         
16 | Active   |  24 | 3.0.8            | Apache Karaf :: Deployer :: Spring                                 
17 | Active   |  24 | 3.0.8            | Apache Karaf :: Deployer :: Blueprint                              
18 | Active   |  24 | 3.0.8            | Apache Karaf :: Deployer :: Wrap Non OSGi Jar                      
19 | Active   |  25 | 3.0.8            | Apache Karaf :: Region :: Core                                     
20 | Active   |  25 | 3.0.8            | Apache Karaf :: Features :: Core                                   
21 | Active   |  26 | 3.0.8            | Apache Karaf :: Deployer :: Features                               
22 | Active   |  30 | 2.13.0           | JLine                                                              
23 | Active   |  30 | 0.2.1            | JLEdit :: Core                                                     
24 | Active   |  30 | 3.0.8            | Apache Karaf :: Features :: Command                                
25 | Active   |  30 | 3.0.8            | Apache Karaf :: Bundle :: Core                                     
26 | Active   |  30 | 3.0.8            | Apache Karaf :: Bundle :: Commands                                 
27 | Active   |  30 | 3.0.8            | Apache Karaf :: Shell :: Console                                   
28 | Active   |  30 | 3.0.8            | Apache Karaf :: JAAS :: Modules                                    
29 | Active   |  30 | 3.0.8            | Apache Karaf :: JAAS :: Config                                     
30 | Active   |  30 | 0.14.0           | Apache Mina SSHD :: Core                                           
31 | Active   |  30 | 3.0.8            | Apache Karaf :: Shell :: Help System                               
32 | Active   |  30 | 3.0.8            | Apache Karaf :: Shell :: Table                                     
33 | Active   |  30 | 3.0.8            | Apache Karaf :: System :: Core                                     
34 | Active   |  30 | 3.0.8            | Apache Karaf :: System :: Shell Commands                           
35 | Active   |  30 | 3.0.8            | Apache Karaf :: Shell :: Various Commands                          
36 | Active   |  30 | 1.0.0            | Apache Aries Quiesce API                                           
37 | Active   |  30 | 3.0.8            | Apache Karaf :: ConfigAdmin :: Core                                
38 | Active   |  30 | 3.0.8            | Apache Karaf :: ConfigAdmin :: Commands                            
39 | Active   |  30 | 3.0.8            | Apache Karaf :: Instance :: Core                                   
40 | Active   |  30 | 3.0.8            | Apache Karaf :: Instance :: Command                                
41 | Active   |  30 | 3.0.8            | Apache Karaf :: JAAS :: Command                                    
42 | Active   |  30 | 3.0.8            | Apache Karaf :: Diagnostic :: Core                                 
43 | Active   |  30 | 3.0.8            | Apache Karaf :: Diagnostic :: Command                              
44 | Active   |  30 | 3.0.8            | Apache Karaf :: Log :: Core                                        
45 | Active   |  30 | 3.0.8            | Apache Karaf :: Log :: Command                                     
46 | Active   |  30 | 3.0.8            | Apache Karaf :: Service :: Core                                    
47 | Active   |  30 | 3.0.8            | Apache Karaf :: Service :: Command                                 
48 | Active   |  30 | 1.0.0.v20110524  | Region Digraph                                                     
49 | Active   |  30 | 3.0.8            | Apache Karaf :: Region :: Persistence                              
50 | Active   |  30 | 3.0.8            | Apache Karaf :: Region :: Shell Commands                           
51 | Active   |  30 | 3.0.8            | Apache Karaf :: Package :: Core                                    
52 | Active   |  30 | 3.0.8            | Apache Karaf :: Package :: Commands                                
53 | Active   |  30 | 3.0.8            | Apache Karaf :: KAR :: Core                                        
54 | Active   |  30 | 3.0.8            | Apache Karaf :: KAR :: Command                                     
55 | Active   |  30 | 3.0.8            | Apache Karaf :: Deployer :: Karaf Archive (.kar)                   
56 | Active   |  30 | 2.0.7            | Apache MINA Core                                                   
57 | Active   |  30 | 3.0.8            | Apache Karaf :: Shell :: SSH                                       
58 | Active   |  30 | 3.0.8            | Apache Karaf :: Management                                         
59 | Active   |  30 | 1.1.1            | Apache Aries JMX API                                               
60 | Active   |  30 | 1.1.6            | Apache Aries JMX Core                                              
61 | Active   |  30 | 1.1.0            | Apache Aries JMX Blueprint API                                     
62 | Active   |  30 | 1.1.0            | Apache Aries JMX Blueprint Core                                    
63 | Active   |  30 | 1.0.0            | Apache Aries JMX Whiteboard                                        
64 | Active   |  30 | 1.0.0.6          | Apache ServiceMix :: Bundles :: aopalliance                        
65 | Active   |  30 | 3.2.17.RELEASE_1 | Apache ServiceMix :: Bundles :: spring-core                        
66 | Active   |  30 | 3.2.17.RELEASE_1 | Apache ServiceMix :: Bundles :: spring-expression                  
67 | Active   |  30 | 3.2.17.RELEASE_1 | Apache ServiceMix :: Bundles :: spring-beans                       
68 | Active   |  30 | 3.2.17.RELEASE_1 | Apache ServiceMix :: Bundles :: spring-aop                         
69 | Active   |  30 | 3.2.17.RELEASE_1 | Apache ServiceMix :: Bundles :: spring-context                     
70 | Active   |  30 | 3.2.17.RELEASE_1 | Apache ServiceMix :: Bundles :: spring-context-support             
71 | Active   |  30 | 1.0.0.RELEASE    | gemini-blueprint-io                                                
72 | Active   |  30 | 1.0.0.RELEASE    | gemini-blueprint-core                                              
73 | Active   |  30 | 1.0.0.RELEASE    | gemini-blueprint-extender 

重新启动后,几乎每个捆绑包都打印了以下异常

73 - org.eclipse.gemini.blueprint.extender - 1.0.0.RELEASE | Application context refresh failed (OsgiBundleXmlApplicationContext(bundle=org.apache.karaf.config.command, config=OSGI-INF/blueprint/shell-config.xml))
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 25 in XML document from URL [bundle://38.0:0/OSGI-INF/blueprint/shell-config.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'command-bundle'.

对于某些捆绑包,command-bundle元素和ext:property-placeholder

的其他元素存在问题

所以看起来Karaf核心包有无效的蓝图xml?这是一个错误吗?

1 个答案:

答案 0 :(得分:1)

Apache Karaf 2.x和3.x版本在内部使用蓝图。 蓝图规范有些限制,并未涵盖通过命名空间的任何扩展机制。 Aries Blueprint和Gemini Blueprint都支持这种方式,但方式不同。 那些Karaf版本依赖于Aries Blueprint,因此让Gemini Blueprint工作有点困难。

Karaf 4.x不再在内部使用Blueprint,因此在那里安装Gemini Blueprint要容易得多。
也就是说,双子座蓝图并不活跃,所以你应该看看Aries Blueprint的实现。如果需要,Aries Blueprint还提供完整的Spring兼容层。