Hi Charles,

You should split into two different bundles. I think that the interface is not yet bound when the reference tries to resolve it.

To be honest, I've never tried to use a service reference to another descriptor file in the same bundle (I defined all in the same blueprint descriptor, so no need to use a service reference internally).

Regards
JB

On 02/01/2011 08:58 AM, 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

Reply via email to