一些奇怪的问题。从官方站点运行清晰的Karaf 4.1.6发行版,无需进行任何添加。从karaf“ karaf-blueprint-archetype ”
制作简单的蓝图包<?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 ">
<bean id="serviceBean" class="com.itprofix.simple.MyServiceImpl"/>
<service ref="serviceBean" interface="com.itprofix.simple.MyService"/>
</blueprint>
制作jar&比制作简单的test-feature.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<features name="test-features-pack" xmlns="http://karaf.apache.org/xmlns/features/v1.3.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.3.0 http://karaf.apache.org/xmlns/features/v1.3.0">
<feature name="feature-a" version="1.0" description="test A" install="auto">
<bundle start="true" start-level="82">file:base/simple-bundle-1.0-SNAPSHOT.jar</bundle>
</feature>
</features>
部署test-feature.xml。一切都好。
INFO | fileinstall-C:\apache-karaf-4.1.6/deploy | fileinstall | 9 - org.apache.felix.fileinstall - 3.6.4 | Installing bundle test-features.xml / 0.0.0
INFO | fileinstall-C:\apache-karaf-4.1.6/deploy | fileinstall | 9 - org.apache.felix.fileinstall - 3.6.4 | Started bundle: feature:file:/C:/apache-karaf-4.1.6/deploy/test-features.xml
INFO | FelixDispatchQueue | FeaturesServiceImpl | 10 - org.apache.karaf.features.core - 4.1.6 | Adding features: feature-a/[1.0.0,1.0.0]
INFO | features-1-thread-1 | FeaturesServiceImpl | 10 - org.apache.karaf.features.core - 4.1.6 | Changes to perform:
INFO | features-1-thread-1 | FeaturesServiceImpl | 10 - org.apache.karaf.features.core - 4.1.6 | Region: root
INFO | features-1-thread-1 | FeaturesServiceImpl | 10 - org.apache.karaf.features.core - 4.1.6 | Bundles to install:
INFO | features-1-thread-1 | FeaturesServiceImpl | 10 - org.apache.karaf.features.core - 4.1.6 | file:base/simple-bundle-1.0-SNAPSHOT.jar
INFO | features-1-thread-1 | FeaturesServiceImpl | 10 - org.apache.karaf.features.core - 4.1.6 | Installing bundles:
INFO | features-1-thread-1 | FeaturesServiceImpl | 10 - org.apache.karaf.features.core - 4.1.6 | file:base/simple-bundle-1.0-SNAPSHOT.jar
INFO | features-1-thread-1 | FeaturesServiceImpl | 10 - org.apache.karaf.features.core - 4.1.6 | Starting bundles:
INFO | features-1-thread-1 | FeaturesServiceImpl | 10 - org.apache.karaf.features.core - 4.1.6 | simple-bundle/1.0.0.SNAPSHOT
INFO | features-1-thread-1 | FeaturesServiceImpl | 10 - org.apache.karaf.features.core - 4.1.6 | Done.
重新启动Karaf,并且在加载时卡住了。
INFO: Lock acquired. Setting startlevel to 100
INFO | FelixStartLevel | FeaturesServiceImpl | 10 - org.apache.karaf.features.core - 4.1.6 | The specified feature: 'feature-a' version '1.0.0' is already installed
INFO | FelixStartLevel | FeaturesServiceImpl | 10 - org.apache.karaf.features.core - 4.1.6 | Adding features: feature-a/[1.0.0,1.0.0]
INFO | features-1-thread-1 | FeaturesServiceImpl | 10 - org.apache.karaf.features.core - 4.1.6 | No deployment change.
INFO | features-1-thread-1 | FeaturesServiceImpl | 10 - org.apache.karaf.features.core - 4.1.6 | Starting bundles:
INFO | features-1-thread-1 | FeaturesServiceImpl | 10 - org.apache.karaf.features.core - 4.1.6 | org.apache.karaf.deployer.features/4.1.6
可能是什么问题?