felix现在都有3.01的版本了,1.4实在太落后了,尤其是1.4不支持处理fragment bundle,这让我今天吃了个大鳖。但是我非常想用struts-osgi-plugin,以及一个struts-admin-bundle-2.1.8.1的官方示例bundle。但struts官网上这么说:

This plugin is only experimental and can change in the future.

刚开始我没看清,用得真起劲,遇到了一个bug:

类似下面这个小片段,实际上是好多好多。。。

Auto-properties start: org.osgi.framework.BundleException: Could not create bundle object.

ERROR: Error starting file:/F:/works2/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/wsnAdminWebapp/WEB-INF/classes/bundles/2/com.springsource.slf4j.api-1.5.6.jar (org.osgi.framework.BundleException: Unresolved constraint in bundle 5: package; (&(package=org.slf4j.impl)(version>=1.5.6)(!(version>=2.0.0))))

org.osgi.framework.BundleException: Unresolved constraint in bundle 5: package; (&(package=org.slf4j.impl)(version>=1.5.6)(!(version>=2.0.0)))

at org.apache.felix.framework.Felix._resolveBundle(Felix.java:1792)

at org.apache.felix.framework.Felix._startBundle(Felix.java:1652)

at org.apache.felix.framework.Felix.startBundle(Felix.java:1588)

at org.apache.felix.framework.Felix.setFrameworkStartLevel(Felix.java:1180)

at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:265)

at java.lang.Thread.run(Thread.java:619)

这令我郁闷了一个下午(青春就是这么挥霍的)。我本以为是spring dm依赖的org.apache.commons.logging包没有,正如《OSGI中启动spring dm加载的commons-logging问题》中所述,但不管我我怎么调整lib下的jar包,都没找到原因。 Read the rest of this entry »

转载自墙外http://aneeshkumarkb.blogspot.com/ ,非常nice的教程

OSGi Tutorial for beginners, Hello World OSGi Tutorial, Equinox OSGi Tutorial, Start developing OSGi Bundles

OSGi – The Dynamic Module System for Java : Part 1

Level: Novice


Aneesh Kumar KB(aneesh_kb@cdactvm.in), E-Governance, CDAC

This tutorial enables to understand the basic concepts of OSGi(Open Service Gateway Initiative), the Dynamic Module System for Java and start with OSGi bundle development.

Before you start

About this series

This is a two part tutorial in which the first part covers the basic OSGi technology, architecture and a Hello world OSGi bundle development. The second part of this tutorial covers the Service Oriented Architecture (SOA) in OSGi and Service bundle development .

Objectives

In this tutorial you will
1. learn the OSGi technology and its architecture
2. familiarize with famous OSGi implementations.
3. create a Hello world OSGi bundle.

Prerequisites Read the rest of this entry »