ejb@glassfish.java.net

Re: default remote and local business interface from indirectly-implemented interfaces

From: Kenneth Saks <Kenneth.Saks_at_Sun.COM>
Date: Wed, 01 Mar 2006 11:41:05 -0500

Cheng Fang wrote:

>bean class:
>===========
>@Stateless
>@Interceptors({AssemblyInterceptor.class})
>public class AssemblyBean extends AssemblyBeanBase
>// implements AssemblyRemoteIF, AssemblyLocalIF
>
The problem is that these are commented out. The remote and local
business interface processing is based on the bean class, not any
super-classes. The same goes for the component-defining annotations,
@RemoteHome, @LocalHome, type-level @Interceptors. There is
no support for "session bean inheritance" so many of the things that
define the structural behavior of the bean are limited to being declared
on the bean class itself or ejb-jar.xml. As in prior versions of EJB,
inheritance is allowed from the bean class, but only as implementation
inheritance.

>{
>
> public AssemblyBean() {
> }
>}
>
>bean superclass:
>================
>abstract public class AssemblyBeanBase
> implements AssemblyRemoteIF, AssemblyLocalIF {
> private int postConstructCalls;
>
> public AssemblyBeanBase() {
> }
>
> protected void incrementPostConstructCalls() {
> this.postConstructCalls++;
> }
>
> public int remoteAdd(int a, int b) {
> return a + b;
> }
>
> public int getPostConstructCalls() {
> return postConstructCalls;
> }
>}
>
>bean interfaces:
>================
>@Local
>public interface AssemblyLocalIF
>// The two interfaces can't extend from AssemblyCommon, as that would
>// introduce a third interface implemented by the bean class.
>// extends AssemblyCommonIF
>{
> int getPostConstructCalls();
> int remoteAdd(int a, int b);
>
>}
>
>@Remote
>public interface AssemblyRemoteIF
>// extends AssemblyCommonIF
>{
> int getPostConstructCalls();
> int remoteAdd(int a, int b);
>
>}
>
>
>ejb-jar.xml:
>===========
>none
>
>-- Cheng
>
>On Wed, 1 Mar 2006, Kenneth Saks wrote:
>
>
>
>>Cheng Fang wrote:
>>
>>
>>
>>>Hi,
>>>
>>>I have a ejb3 session bean indirectly implements a @Remote interface and a
>>>@Local interface, and the two interfaces are the only interfaces for this
>>>bean class.
>>>
>>>
>>>
>>Hi Cheng,
>> Can you post an example of the way the bean class is defined?
>>
>> --ken
>>
>>
>>
>>>I'm expecting these two interfaces will be applied as the
>>>bean's remote and local business interfaces, respectively. But somehow it
>>>failed to deploy with errors like this:
>>>
>>>Caused by: java.lang.RuntimeException: Target ejb xxx for remote ejb 3.0
>>>reference xxx does not expose a remote business interface of type <the
>>>remote interface>
>>>
>>>Once I duplicate the implements clause in the bean directly, it deploys
>>>fine, which leads me to think glassfish only gets the direct interfaces.
>>>I looked at Class.getInterfaces() (whic I guess is used by glassfish), and
>>>it seems only look at direct interfaces.
>>>


>>>
>>>Could someone confirm from the implementation side this is the case?
>>>
>>>I can give more details if necessary.
>>>
>>>Thanks.
>>>-- Cheng
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: ejb-unsubscribe_at_glassfish.dev.java.net
>>>For additional commands, e-mail: ejb-help_at_glassfish.dev.java.net
>>>
>>>
>>>
>>>
>>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: ejb-unsubscribe_at_glassfish.dev.java.net
>>For additional commands, e-mail: ejb-help_at_glassfish.dev.java.net
>>
>>
>>
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: ejb-unsubscribe_at_glassfish.dev.java.net
>For additional commands, e-mail: ejb-help_at_glassfish.dev.java.net
>
>
>