[ 
https://issues.apache.org/jira/browse/HIVEMIND-196?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Patrick Moore updated HIVEMIND-196:
-----------------------------------

    Description: 
This may be the same as Hivemind-120 but the description seems different.

For a definition:
    <service-point id="testwrapped1" 
interface="com.transparentpolitics.core.persistence.FakeServiceImpl">
        <invoke-factory>
                <construct 
class="com.transparentpolitics.core.persistence.FakeServiceImpl"/>
        </invoke-factory>
        <interceptor 
service-id="transparentpolitics.persistence.transactionalInterceptor"/>
    </service-point>

If I have an interceptor factory like this:

    @SuppressWarnings("unused")
    public void createInterceptor(InterceptorStack stack, Module 
invokingModule, List parameters) {
        Object delegate = stack.peek();
        InvocationHandler handler = new TransactionalInterceptor(delegate);

        Object interceptor =
            Proxy.newProxyInstance(
                invokingModule.getClassResolver().getClassLoader(),
                new Class[] { stack.getServiceInterface()},
                handler);

        stack.push(interceptor);   
    }

It will fail on the newProxyInstance because the classloader for the generated 
stack.getServiceInterface() class ($$$FakeServiceImpl) is different than the 
class loader supplied by "invokingModule.getClassResolver().getClassLoader()".





  was:
This may be the same as Hivemind-120 but the description seems different.

If I have an interceptor factory like this:

    @SuppressWarnings("unused")
    public void createInterceptor(InterceptorStack stack, Module 
invokingModule, List parameters) {
        Object delegate = stack.peek();
        InvocationHandler handler = new TransactionalInterceptor(delegate);

        Object interceptor =
            Proxy.newProxyInstance(
                invokingModule.getClassResolver().getClassLoader(),
                new Class[] { stack.getServiceInterface()},
                handler);

        stack.push(interceptor);   
    }

It will fail on the newProxyInstance because the classloader for the generated 
stack.getServiceInterface() class is different than the class loader supplied 
by "invokingModule.getClassResolver().getClassLoader()".






> Cannot create an interceptor for services have an interface that is not a 
> java interface.
> -----------------------------------------------------------------------------------------
>
>                 Key: HIVEMIND-196
>                 URL: https://issues.apache.org/jira/browse/HIVEMIND-196
>             Project: HiveMind
>          Issue Type: Bug
>    Affects Versions: 1.1.1
>            Reporter: Patrick Moore
>            Priority: Minor
>
> This may be the same as Hivemind-120 but the description seems different.
> For a definition:
>     <service-point id="testwrapped1" 
> interface="com.transparentpolitics.core.persistence.FakeServiceImpl">
>       <invoke-factory>
>               <construct 
> class="com.transparentpolitics.core.persistence.FakeServiceImpl"/>
>       </invoke-factory>
>         <interceptor 
> service-id="transparentpolitics.persistence.transactionalInterceptor"/>
>     </service-point>
> If I have an interceptor factory like this:
>     @SuppressWarnings("unused")
>     public void createInterceptor(InterceptorStack stack, Module 
> invokingModule, List parameters) {
>         Object delegate = stack.peek();
>         InvocationHandler handler = new TransactionalInterceptor(delegate);
>         Object interceptor =
>             Proxy.newProxyInstance(
>                 invokingModule.getClassResolver().getClassLoader(),
>                 new Class[] { stack.getServiceInterface()},
>                 handler);
>         stack.push(interceptor);   
>     }
> It will fail on the newProxyInstance because the classloader for the 
> generated stack.getServiceInterface() class ($$$FakeServiceImpl) is different 
> than the class loader supplied by 
> "invokingModule.getClassResolver().getClassLoader()".

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to