I try to do that because I have issue with Hibernate + JPA + Spring Tx regarding to transaction commit who does not occur when using separate bundles. This is why I created one bundle to see if the same error occurs or not. By the way, If I refer directly to the bean instead of the osgi:reference, everything works fine
On Tue, Feb 1, 2011 at 9:11 AM, Andreas Pieber <[email protected]> wrote: > TBH I've never took a look into springs source to know y, but it doesn't like > it > if you import in the same bundle you export it. Simple solution is to split > into > to different bundles (as jb suggested), or use the bean txManager directly > instead of the service. > > BTW, it doesn't matter if you define you beans in one or 10 .xml files in one > bundle. Spring "concats" them first and start to load them afterwards. > > kind regards, > andreas > > On Tue, Feb 01, 2011 at 08:58:59AM +0100, Charles Moulliard 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 >
