Hi,

Yesterday I ran into an error with the new Karaf 4.2.0. This error seems to be 
related to blueprint 1.9.0 (the error does not occur in Karaf 4.1.5).

I have committed a project on Github to illustrate the issue : 
https://github.com/nicolas-dutertry/test-jpa

This project contains a blueprint bundle with a bean TestRepository annotated 
with @PersistenceContext. This bean is then injected into another bean 
TestServiceImpl which is then published as an osgi service :

    <jpa:enable/>
    <tx:enable/>

    <!-- This bean contains a @PersistenceContext EntityManager -->
    <bean id="testRepository" 
class="com.dutertry.test.karaf.jpa.service.impl.TestRepository"/>

    <bean id="testService" 
class="com.dutertry.test.karaf.jpa.service.impl.TestServiceImpl">
        <property name="testRepository" ref="testRepository"/>
    </bean>

    <service interface="com.dutertry.test.karaf.jpa.service.TestService" 
ref="testService"/>

With Karaf 4.1.5 the instance of TestRepository injected in testService is a 
proxy managing JPA stuff, but with Karaf 4.2.0 the injected instance is not a 
proxy. Thus when using testService, the following error occurs :
java.lang.IllegalStateException: Need active coordination

Do you think it is a blueprint bug or is it forbidden to inject a jpa bean into 
another bean in the same blueprint context ?

Regards,
--
Nicolas Dutertry
Sopra HR Software - http://www.soprahr.com/

Reply via email to