You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Christian Bourque <ch...@gmail.com> on 2009/12/30 02:24:49 UTC

method interceptor is never called

Hi,

I'm having a problem with a session bean and the latest version of OpenEJB
(3.1.2): my method interceptor is never called by the container, if I change
it to a class level interceptor it works as expected!

This doesn't work:

@Local(Test.class)
@Stateless
public class TestBean extends ... implements Test
{
     @Override
     @Interceptors(TagInterceptor.class)
     public Entity makePersistent(Entity entity) { ... }
}

This works:

@Local(Test.class)
@Stateless
@Interceptors(TagInterceptor.class)
public class TestBean extends ... implements Test
{
     @Override
     public Entity makePersistent(Entity entity) { ... }
}

Anyone aware of this problem?

Thanks

Christian

Re: method interceptor is never called

Posted by Jacek Laskowski <ja...@laskowski.net.pl>.
On Sat, Jan 16, 2010 at 5:45 AM, Christian Bourque
<ch...@gmail.com> wrote:

> I have just tried it with OpenEJB 3.1.3-SNAPSHOT and got the same error :(

Dunno what's happened. I'm quite busy this week so the earliest is the
upcoming week when I find some spare cycles. Hope you don't mind...

Jacek

-- 
Jacek Laskowski
Notatnik Projektanta Java EE - http://wszystkojawne.pl
p.s. Szukam speca/firmy od grafiki/CSS/HTML

Re: method interceptor is never called

Posted by Christian Bourque <ch...@gmail.com>.
Hi Jacek!

I have just tried it with OpenEJB 3.1.3-SNAPSHOT and got the same error :(

Thanks

Christian

On Wed, Jan 6, 2010 at 7:03 PM, Christian Bourque <
christian.bourque@gmail.com> wrote:

> Thanks Jacek! I'll try to test it asap!
>
> Christian
>
>
> On Wed, Jan 6, 2010 at 6:04 PM, Jacek Laskowski <ja...@laskowski.net.pl>wrote:
>
>> On Tue, Jan 5, 2010 at 12:36 AM, Jacek Laskowski <ja...@laskowski.net.pl>
>> wrote:
>>
>> > In the upcoming days I'm going to fix it -
>> > https://issues.apache.org/jira/browse/OPENEJB-1128.
>>
>> It took much of my time, but it's finally over. Fixed the issue so you
>> should be able to run your sample fine with the recent OpenEJB code.
>> Just bump up the version of OpenEJB from 3.1.2 to 3.1.3-SNAPSHOT. I
>> did and it worked fine.
>>
>> One possible issue is that I haven't pushed the latest SNAPSHOT to the
>> repos so you will have to pull down the sources and build them locally
>> to be happy as much as I am :) Sorry for the trouble. I'll push them
>> in the coming days right after I have figured out what it is to do it
>> with proper rights (there were some changes in ASF about the repos and
>> seems I didn't make them locally).
>>
>> Jacek
>>
>> --
>> Jacek Laskowski
>> Notatnik Projektanta Java EE - http://wszystkojawne.pl
>> p.s. Szukam speca/firmy od grafiki/CSS/HTML
>>
>
>

Re: method interceptor is never called

Posted by Christian Bourque <ch...@gmail.com>.
Thanks Jacek! I'll try to test it asap!

Christian

On Wed, Jan 6, 2010 at 6:04 PM, Jacek Laskowski <ja...@laskowski.net.pl>wrote:

> On Tue, Jan 5, 2010 at 12:36 AM, Jacek Laskowski <ja...@laskowski.net.pl>
> wrote:
>
> > In the upcoming days I'm going to fix it -
> > https://issues.apache.org/jira/browse/OPENEJB-1128.
>
> It took much of my time, but it's finally over. Fixed the issue so you
> should be able to run your sample fine with the recent OpenEJB code.
> Just bump up the version of OpenEJB from 3.1.2 to 3.1.3-SNAPSHOT. I
> did and it worked fine.
>
> One possible issue is that I haven't pushed the latest SNAPSHOT to the
> repos so you will have to pull down the sources and build them locally
> to be happy as much as I am :) Sorry for the trouble. I'll push them
> in the coming days right after I have figured out what it is to do it
> with proper rights (there were some changes in ASF about the repos and
> seems I didn't make them locally).
>
> Jacek
>
> --
> Jacek Laskowski
> Notatnik Projektanta Java EE - http://wszystkojawne.pl
> p.s. Szukam speca/firmy od grafiki/CSS/HTML
>

Re: method interceptor is never called

Posted by Jacek Laskowski <ja...@laskowski.net.pl>.
On Tue, Jan 5, 2010 at 12:36 AM, Jacek Laskowski <ja...@laskowski.net.pl> wrote:

> In the upcoming days I'm going to fix it -
> https://issues.apache.org/jira/browse/OPENEJB-1128.

It took much of my time, but it's finally over. Fixed the issue so you
should be able to run your sample fine with the recent OpenEJB code.
Just bump up the version of OpenEJB from 3.1.2 to 3.1.3-SNAPSHOT. I
did and it worked fine.

One possible issue is that I haven't pushed the latest SNAPSHOT to the
repos so you will have to pull down the sources and build them locally
to be happy as much as I am :) Sorry for the trouble. I'll push them
in the coming days right after I have figured out what it is to do it
with proper rights (there were some changes in ASF about the repos and
seems I didn't make them locally).

Jacek

-- 
Jacek Laskowski
Notatnik Projektanta Java EE - http://wszystkojawne.pl
p.s. Szukam speca/firmy od grafiki/CSS/HTML

Re: method interceptor is never called

Posted by Jacek Laskowski <ja...@laskowski.net.pl>.
On Mon, Jan 4, 2010 at 10:12 PM, Jacek Laskowski <ja...@laskowski.net.pl> wrote:
> On Mon, Jan 4, 2010 at 8:16 PM, Christian Bourque
> <ch...@gmail.com> wrote:
>
>> There you go! It's a maven project so simply run it with: mvn test
>>
>> You'll see that the second test will fail when it shouldn't...
>
> Failed tests:
>  testWithGenerics(test.test.AppTest)
>
> Tests run: 2, Failures: 1, Errors: 0, Skipped: 0
>
> [INFO] ------------------------------------------------------------------------
> [ERROR] BUILD FAILURE
> [INFO] ------------------------------------------------------------------------
>
> Looking into it...will report the findings soon.

Found the issue - openejb doesn't support "Using Generics in EJBs".
See [1] for a workaround that works (I don't mean you should migrate
to WLS though :)). I've just committed corresponding changes to the
interceptor example [2] to let you see what the workaround looks like.
In the nutshell, you should extend the interface with generics with
the one without and annotate it with @Local. It will work.

In the upcoming days I'm going to fix it -
https://issues.apache.org/jira/browse/OPENEJB-1128.

[1] http://download.oracle.com/docs/cd/E11035_01/wls100/ejb30/implementing.html#wp1129878
[2] https://svn.apache.org/repos/asf/openejb/trunk/openejb3/examples/interceptors

Jacek

-- 
Jacek Laskowski
Notatnik Projektanta Java EE - http://wszystkojawne.pl
p.s. Szukam speca/firmy od grafiki/CSS/HTML

Re: method interceptor is never called

Posted by Jacek Laskowski <ja...@laskowski.net.pl>.
On Mon, Jan 4, 2010 at 8:16 PM, Christian Bourque
<ch...@gmail.com> wrote:

> There you go! It's a maven project so simply run it with: mvn test
>
> You'll see that the second test will fail when it shouldn't...

Failed tests:
  testWithGenerics(test.test.AppTest)

Tests run: 2, Failures: 1, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------

Looking into it...will report the findings soon.

Jacek

-- 
Jacek Laskowski
Notatnik Projektanta Java EE - http://wszystkojawne.pl
p.s. Szukam speca/firmy od grafiki/CSS/HTML

Re: method interceptor is never called

Posted by Christian Bourque <ch...@gmail.com>.
Hi Jacek,

There you go! It's a maven project so simply run it with: mvn test

You'll see that the second test will fail when it shouldn't...

Christian

On Sun, Jan 3, 2010 at 1:18 PM, Jacek Laskowski <ja...@laskowski.net.pl>wrote:

> On Wed, Dec 30, 2009 at 2:24 AM, Christian Bourque
> <ch...@gmail.com> wrote:
>
> > I'm having a problem with a session bean and the latest version of
> OpenEJB
> > (3.1.2): my method interceptor is never called by the container, if I
> change
> > it to a class level interceptor it works as expected!
> >
> > This doesn't work:
> >
> > @Local(Test.class)
> > @Stateless
> > public class TestBean extends ... implements Test
> > {
> >     @Override
> >     @Interceptors(TagInterceptor.class)
> >     public Entity makePersistent(Entity entity) { ... }
> > }
>
> Hi Christian,
>
> I've been looking into it and couldn't figure out what might've caused
> the issue. I've even made some changes to the interceptor example [1]
> to reproduce the issue with no joy hence your help is greatly
> appreciated to hunt it down. Could you give the example a try with
>
> mvn clean test
>
> and see if it works for you. I'm sure it will, so change it so it
> reflects your failing example or send the failing example to the
> mailing list as an attachment (if you can't, send it to my mailbox -
> jlaskowski...apache.org). I'd love giving it a try myself.
>
> A couple of notes while I was looking into the issue:
>
> 1. @Override can only be declared if you override a method from a
> parent class. It seems the TestBean class overrides a method from a
> parent class (commented out unfortunately) as well as implements the
> method from the Test intf. Is this a case?
>
> 2. TagInterceptor.class can only have a single @AroundInvoke-annotated
> method. Is this a case? (I'm not sure if openejb validates it)
>
> 3. How do you execute your bean?
>
> [1]
> http://svn.apache.org/repos/asf/openejb/trunk/openejb3/examples/interceptors
>
> Jacek
>
> --
> Jacek Laskowski
> Notatnik Projektanta Java EE - http://wszystkojawne.pl
> p.s. Szukam speca/firmy od grafiki/CSS/HTML
>

Re: method interceptor is never called

Posted by Jacek Laskowski <ja...@laskowski.net.pl>.
On Wed, Dec 30, 2009 at 2:24 AM, Christian Bourque
<ch...@gmail.com> wrote:

> I'm having a problem with a session bean and the latest version of OpenEJB
> (3.1.2): my method interceptor is never called by the container, if I change
> it to a class level interceptor it works as expected!
>
> This doesn't work:
>
> @Local(Test.class)
> @Stateless
> public class TestBean extends ... implements Test
> {
>     @Override
>     @Interceptors(TagInterceptor.class)
>     public Entity makePersistent(Entity entity) { ... }
> }

Hi Christian,

I've been looking into it and couldn't figure out what might've caused
the issue. I've even made some changes to the interceptor example [1]
to reproduce the issue with no joy hence your help is greatly
appreciated to hunt it down. Could you give the example a try with

mvn clean test

and see if it works for you. I'm sure it will, so change it so it
reflects your failing example or send the failing example to the
mailing list as an attachment (if you can't, send it to my mailbox -
jlaskowski...apache.org). I'd love giving it a try myself.

A couple of notes while I was looking into the issue:

1. @Override can only be declared if you override a method from a
parent class. It seems the TestBean class overrides a method from a
parent class (commented out unfortunately) as well as implements the
method from the Test intf. Is this a case?

2. TagInterceptor.class can only have a single @AroundInvoke-annotated
method. Is this a case? (I'm not sure if openejb validates it)

3. How do you execute your bean?

[1] http://svn.apache.org/repos/asf/openejb/trunk/openejb3/examples/interceptors

Jacek

-- 
Jacek Laskowski
Notatnik Projektanta Java EE - http://wszystkojawne.pl
p.s. Szukam speca/firmy od grafiki/CSS/HTML

Re: method interceptor is never called

Posted by Jean-Louis MONTEIRO <je...@atosorigin.com>.
Hmm, gave it a try with a (List<String> initList) and it works too!
Can you please attach your sample here?

Thanks.
Jean-Louis


Christian Bourque wrote:
> 
> Hi Jean-Louis,
> 
> I think I've isolated the problem: it seems that if the intercepted method
> has generics parameters then it is silently ignored..
> 
> I created a small project using maven to reproduce the behavior, where can
> I
> send it?
> 
> Thanks
> 
> Christian
> 
> On Wed, Dec 30, 2009 at 5:37 AM, Jean-Louis MONTEIRO <
> jean-louis.monteiro@atosorigin.com> wrote:
> 
>>
>> Hi Christian,
>>
>> Don't know why it doesn't work for you.
>> I gave it a try with our interceptor example and it works as expected.
>>
>> If you have a small project we can use to reproduce, can you share it?
>>
>> Jean-Louis
>>
>>
>> Christian Bourque wrote:
>> >
>> > Hi,
>> >
>> > I'm having a problem with a session bean and the latest version of
>> OpenEJB
>> > (3.1.2): my method interceptor is never called by the container, if I
>> > change
>> > it to a class level interceptor it works as expected!
>> >
>> > This doesn't work:
>> >
>> > @Local(Test.class)
>> > @Stateless
>> > public class TestBean extends ... implements Test
>> > {
>> >      @Override
>> >      @Interceptors(TagInterceptor.class)
>> >      public Entity makePersistent(Entity entity) { ... }
>> > }
>> >
>> > This works:
>> >
>> > @Local(Test.class)
>> > @Stateless
>> > @Interceptors(TagInterceptor.class)
>> > public class TestBean extends ... implements Test
>> > {
>> >      @Override
>> >      public Entity makePersistent(Entity entity) { ... }
>> > }
>> >
>> > Anyone aware of this problem?
>> >
>> > Thanks
>> >
>> > Christian
>> >
>> >
>>
>> --
>> View this message in context:
>> http://n4.nabble.com/method-interceptor-is-never-called-tp990702p990847.html
>> Sent from the OpenEJB User mailing list archive at Nabble.com.
>>
> 
> 

-- 
View this message in context: http://n4.nabble.com/method-interceptor-is-never-called-tp990702p991325.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: method interceptor is never called

Posted by Christian Bourque <ch...@gmail.com>.
Hi Jean-Louis,

I think I've isolated the problem: it seems that if the intercepted method
has generics parameters then it is silently ignored..

I created a small project using maven to reproduce the behavior, where can I
send it?

Thanks

Christian

On Wed, Dec 30, 2009 at 5:37 AM, Jean-Louis MONTEIRO <
jean-louis.monteiro@atosorigin.com> wrote:

>
> Hi Christian,
>
> Don't know why it doesn't work for you.
> I gave it a try with our interceptor example and it works as expected.
>
> If you have a small project we can use to reproduce, can you share it?
>
> Jean-Louis
>
>
> Christian Bourque wrote:
> >
> > Hi,
> >
> > I'm having a problem with a session bean and the latest version of
> OpenEJB
> > (3.1.2): my method interceptor is never called by the container, if I
> > change
> > it to a class level interceptor it works as expected!
> >
> > This doesn't work:
> >
> > @Local(Test.class)
> > @Stateless
> > public class TestBean extends ... implements Test
> > {
> >      @Override
> >      @Interceptors(TagInterceptor.class)
> >      public Entity makePersistent(Entity entity) { ... }
> > }
> >
> > This works:
> >
> > @Local(Test.class)
> > @Stateless
> > @Interceptors(TagInterceptor.class)
> > public class TestBean extends ... implements Test
> > {
> >      @Override
> >      public Entity makePersistent(Entity entity) { ... }
> > }
> >
> > Anyone aware of this problem?
> >
> > Thanks
> >
> > Christian
> >
> >
>
> --
> View this message in context:
> http://n4.nabble.com/method-interceptor-is-never-called-tp990702p990847.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: method interceptor is never called

Posted by Jean-Louis MONTEIRO <je...@atosorigin.com>.
Hi Christian,

Don't know why it doesn't work for you.
I gave it a try with our interceptor example and it works as expected.

If you have a small project we can use to reproduce, can you share it?

Jean-Louis


Christian Bourque wrote:
> 
> Hi,
> 
> I'm having a problem with a session bean and the latest version of OpenEJB
> (3.1.2): my method interceptor is never called by the container, if I
> change
> it to a class level interceptor it works as expected!
> 
> This doesn't work:
> 
> @Local(Test.class)
> @Stateless
> public class TestBean extends ... implements Test
> {
>      @Override
>      @Interceptors(TagInterceptor.class)
>      public Entity makePersistent(Entity entity) { ... }
> }
> 
> This works:
> 
> @Local(Test.class)
> @Stateless
> @Interceptors(TagInterceptor.class)
> public class TestBean extends ... implements Test
> {
>      @Override
>      public Entity makePersistent(Entity entity) { ... }
> }
> 
> Anyone aware of this problem?
> 
> Thanks
> 
> Christian
> 
> 

-- 
View this message in context: http://n4.nabble.com/method-interceptor-is-never-called-tp990702p990847.html
Sent from the OpenEJB User mailing list archive at Nabble.com.