Nicolas Dutertry created ARIES-1793:
---------------------------------------

             Summary: Blueprint interceptors do not work anymore
                 Key: ARIES-1793
                 URL: https://issues.apache.org/jira/browse/ARIES-1793
             Project: Aries
          Issue Type: Bug
          Components: Blueprint
    Affects Versions: blueprint-core-1.9.0
         Environment: Karaf 4.2.0
            Reporter: Nicolas Dutertry
         Attachments: aries-interceptor.patch

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 :
{code:xml}
    <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"/>
{code}
With Karaf 4.1.5 the instance of TestRepository injected in testService is an 
aries 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:
{code:java}
java.lang.IllegalStateException: Need active coordination
    at 
org.apache.aries.jpa.support.impl.EMSupplierImpl.get(EMSupplierImpl.java:81) 
~[?:?]
    at org.apache.aries.jpa.support.osgi.impl.EmProxy.invoke(EmProxy.java:38) 
~[?:?]
    at com.sun.proxy.$Proxy77.createQuery(Unknown Source) ~[?:?]
    at Proxy4c2993b8_dc6f_46b4_8e62_524dc0ad05f5.createQuery(Unknown Source) 
~[?:?]
    at 
com.dutertry.test.karaf.jpa.service.impl.TestRepository.list(TestRepository.java:26)
 ~[?:?]
    at 
com.dutertry.test.karaf.jpa.service.impl.TestServiceImpl.list(TestServiceImpl.java:25)
 ~[?:?]
    at 
com.dutertry.test.karaf.jpa.cmd.ListPersonCommand.execute(ListPersonCommand.java:24)
 ~[?:?]
    at 
org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:84)
 ~[?:?]
    at 
org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68)
 ~[?:?]
    at 
org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86)
 ~[?:?]
    at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:571) ~[?:?]
    at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:497) 
~[?:?]
    at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:386) ~[?:?]
    at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:417) ~[?:?]
    at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) ~[?:?]
    at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) ~[?:?]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:?]
    at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) 
~[?:?]
    at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) 
~[?:?]
    at java.lang.Thread.run(Thread.java:748) [?:?]{code}
 

After some investigation, I have found that this bug is due to the resolution 
of issue ARIES-1544. I have done a patch (see attached file) which solve the 
issue I think.

[^aries-interceptor.patch]

Can you please integrate my patch or correct the issue another way ?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to