Spring-DM and blueprint do not support well such a construct unless
the referenced service is an optional dependency.
The reason is that dependencies must be satisfied before the
application is started, so it waits forever.
You need to either use an optional dependency or directly reference the bean
<bean id="PROPAGATION_REQUIRES_NEW"
class="org.apache.camel.spring.spi.SpringTransactionPolicy">
<property name="transactionManager" ref="txManager"/>
<property name="propagationBehaviorName"
value="PROPAGATION_REQUIRES_NEW"/>
</bean>
On Tue, Feb 1, 2011 at 08:58, Charles Moulliard <[email protected]> wrote:
> Hi,
>
> I try to register an OSGI Service and use it in the same bundle but
> get an unsatisfied dependencies error.
>
> Is it allow to do that ?
>
> Error :
>
> 08:54:40,317 | INFO | ExtenderThread-2 | DependencyServiceManager
> | startup.DependencyServiceManager 288 | 76 -
> org.springframework.osgi.extender - 1.2.0 | Adding OSGi service
> dependency for importer
> [&org.springframework.osgi.service.importer.support.OsgiServiceProxyFactoryBean#0]
> matching OSGi filter
> [(&(objectClass=org.springframework.transaction.PlatformTransactionManager)(tx=JPA))]
> 08:54:40,318 | INFO | ExtenderThread-2 | DependencyServiceManager
> | startup.DependencyServiceManager 232 | 76 -
> org.springframework.osgi.extender - 1.2.0 |
> OsgiBundleXmlApplicationContext(bundle=com.goodyear.emea.gicl.esb.sap-all,
> config=osgibundle:/META-INF/spring/*.xml) is waiting for unsatisfied
> dependencies
> [[&org.springframework.osgi.service.importer.support.OsgiServiceProxyFactoryBean#0]]
>
> Config
>
> aaa.xml file
>
> <!-- TransactionManager is required -->
> <bean id="txManager"
> class="org.springframework.orm.jpa.JpaTransactionManager">
> <property name="entityManagerFactory"
> ref="entityManagerFactory" />
> <property name="dataSource" ref="dataSource" />
> </bean>
>
> <!-- Expose Transaction Manager -->
> <osgi:service ref="txManager"
> interface="org.springframework.transaction.PlatformTransactionManager">
> <service-properties>
> <entry key="tx" value="JPA"/>
> </service-properties>
> </osgi:service>
>
>
> bbb.xml file
>
> <bean id="PROPAGATION_REQUIRES_NEW"
> class="org.apache.camel.spring.spi.SpringTransactionPolicy">
> <property name="transactionManager">
> <osgi:reference filter="(tx=JPA)"
> interface="org.springframework.transaction.PlatformTransactionManager"/>
> </property>
> <property name="propagationBehaviorName"
> value="PROPAGATION_REQUIRES_NEW"/>
> </bean>
>
> Regards,
>
> Charles Moulliard
>
> Sr. Principal Solution Architect - FuseSource
> Apache Committer
>
> Blog : http://cmoulliard.blogspot.com
> Twitter : http://twitter.com/cmoulliard
> Linkedin : http://www.linkedin.com/in/charlesmoulliard
> Skype: cmoulliard
>
--
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com