users@glassfish.java.net

error in generated ejb-jar.xml

From: <glassfish_at_javadesktop.org>
Date: Tue, 19 Jun 2007 06:35:57 PDT

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