users@glassfish.java.net

Re: error in generated ejb-jar.xml

From: Sahoo <sahoo_at_sun.com>
Date: Wed, 20 Jun 2007 10:45:39 +0530

I just tried your example with V2 b48-beta3, and it worked. Can you
check your code again? Are there multiple SendMailRemote.class with
different package names?

Another observation about your example:
Although you are using different interface names for remote and local
business interface of your bean, they still have same method signatures
and hence the bean will have the same implementation for both the
interfaces. That's usually dangerous, because the remote and local
interfaces have different semantics for argument passing; pass-by-value
vs. pass-by-reference. It's not a problem in your example now, because
all the arguments are immutable types.

Thanks,
Sahoo
glassfish_at_javadesktop.org wrote:
> Hi there.
>
> I have a stateless session bean running on GF V2 beta 2 (b41d). It's a simple bean with two methods both of which are exposed in a local and remote interface:
>
> [code]
> @Remote
> public interface SendMailRemote
> {
> void sendMail(String email, String subject, String body);
> void sendMail(String email, String replyTo, String subject, String body);
> }
>
> and:
>
> @Local
> public interface SendMailLocal
> {
> void sendMail(String email, String subject, String body);
> void sendMail(String email, String replyTo, String subject, String body);
> }
> [/code]
>
> The bean code itself is:
> [code]
> @Stateless(mappedName="ejb3/SendMailRemote")
> public class SendMailBean implements SendMailRemote, SendMailLocal
> {
> ...
> }
> [/code]
>
> Pretty straightforward so far. The bean resides in an ejb jar which is included in an ear.
> In sun-ejb-jar.xml I have
> [code]
> <ejb>
> <ejb-name>SendMailBean</ejb-name>
> <jndi-name>ejb3/SendMailRemote</jndi-name>
> </ejb>
> [/code]
> under [code]<enterprise-beans>[/code] node (even though not really necessary).
>
> Thus the interfaces never show up in the jndi browser. Further investigation reveals the following generated xml:
>
> [code]
> <session>
> <display-name>SendMailBean</display-name>
> <ejb-name>SendMailBean</ejb-name>
> <mapped-name>ejb3/SendMailRemote</mapped-name>
> <business-local>com.brodos.ejb3.mail.SendMailLocal</business-local>
> <business-local>com.brodos.mail.SendMailRemote</business-local>
> <ejb-class>com.brodos.ejb3.mail.SendMailBean</ejb-class>
> <session-type>Stateless</session-type>
> <transaction-type>Container</transaction-type>
> <resource-ref>
> <res-ref-name>mail/Brodos</res-ref-name>
> <res-type>javax.mail.Session</res-type>
> <res-auth>Container</res-auth>
> <res-sharing-scope>Shareable</res-sharing-scope>
> <injection-target>
> <injection-target-class>com.brodos.ejb3.mail.SendMailBean</injection-target-class>
> <injection-target-name>mailBrodos</injection-target-name>
> </injection-target>
> </resource-ref>
> <security-identity>
> <use-caller-identity/>
> </security-identity>
> </session>
> [/code]
>
> from the 'generated' directory under domain1 directory.
>
> Note the line [b]<business-local>com.brodos.mail.SendMailRemote</business-local>[/b] should be [b]business-remote[/b]!
>
> Alexander.
> [Message sent by forum member 'sahlix' (sahlix)]
>
> http://forums.java.net/jive/thread.jspa?messageID=222866
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>