Hi
OSGi nood, so bare with me :-)
I'm trying to deploy bundles built on Spring-DM in Sling but run into
troubles using osgi:reference construct. Looks like the Spring-DM
implementation tries to use FrameworkUtil but runs into class loading
issues. When starting up Sling using mvn jetty:run I notice that the
OSGI bundles are available, even though the System bundle seems to
provide the OSGI packages. But, even uninstalling the OSGi bundles will
give the stack trace below. Any help would be appreciated! Sling looks
exactly like the project I'm looking for :-)
17.02.2008 10:03:15 *ERROR*
o.s.o.e.i.d.s.DependencyWaiterApplicationContextExecutor: Unable to
create application context for [com.protocol7.osgi.bundle1], unsatisfied
dependencies: none
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'osgiHttpService': Invocation of init method failed;
nested exception is java.lang.NoClassDefFoundError: Could not initialize
class org.osgi.framework.FrameworkUtil
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1260)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:438)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:383)
at java.security.AccessController.doPrivileged(Native Method)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:353)
at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:245)
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:169)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:242)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at
org.springframework.osgi.extender.internal.dependencies.startup.DependencyServiceManager.findServiceDependencies(DependencyServiceManager.java:195)
at
org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.stageOne(DependencyWaiterApplicationContextExecutor.java:239)
at
org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.refresh(DependencyWaiterApplicationContextExecutor.java:163)
at
org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.refresh(AbstractDelegatedExecutionApplicationContext.java:124)
at
org.springframework.osgi.extender.internal.ContextLoaderListener$2.run(ContextLoaderListener.java:630)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class
org.osgi.framework.FrameworkUtil
at
org.springframework.osgi.util.OsgiFilterUtils.createFilter(OsgiFilterUtils.java:233)
at
org.springframework.osgi.service.importer.support.AbstractOsgiServiceImportFactoryBean.getUnifiedFilter(AbstractOsgiServiceImportFactoryBean.java:154)
at
org.springframework.osgi.service.importer.support.AbstractOsgiServiceImportFactoryBean.afterPropertiesSet(AbstractOsgiServiceImportFactoryBean.java:120)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1288)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1257)
... 14 common frames omitted
I'm trying the register a servlet with the HttpService exposed by Sling.
The servlet is a regular HttpServlet instance. The Spring config looks like:
<osgi:reference interface="org.osgi.service.http.HttpService"
id="osgiHttpService" />
<bean class="com.protocol7.osgi.bundle1.HttpRegistrator"
init-method="init">
<property name="servlet" ref="servlet"></property>
<property name="httpService" ref="osgiHttpService"></property>
</bean>
<bean id="servlet" class="javax.servlet.http.HttpServlet" />
All the HttpRegistrator does is the use registerServlet on the supplied
servlet.
/niklas