users@glassfish.java.net

Re: How deploy a session ejb more then once?

From: <glassfish_at_javadesktop.org>
Date: Wed, 18 Jul 2007 08:02:08 PDT

Hi Ralph,

Take a look at the sun-ejb-jar_3_0-0.dtd in the lib/dtds directory. The best way to set the
global values (Remote EJB JNDI name, Webservice endpoint uri, etc) of your applications
is to create a sun-ejb-jar.xml file based on this dtd and include it in the each ejb-jar.

By default, a Remote EJB's global JNDI name defaults to the fully qualified class name of
its business interface. This is a ease-of-use feature which handles the bulk of the simple
cases. However, in your case if you have multiple EJBs that expose the same Remote
business interface, either in the same application or different applications, you need to
explicitly select global JNDI names that are unique across the entire application server.

Here's an example :

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Sun ONE Application
 Server 7.0 EJB 2.0//EN" "http://www.sun.com/software/sunone/appserver/dtds/sun-
ejb-jar_3_0-0.dtd">
<sun-ejb-jar>
  <enterprise-beans>
    <ejb>
      <ejb-name>FooBean</ejb-name>
      <jndi-name>ejb/FooBean1</jndi-name>
    </ejb>
  </enterprise-beans>
</sun-ejb-jar>

Same issue for the EJB webservice endpoint, since the endpoint address uri is selected
from a global web context path. Use the endpoint-address-uri element for that one.
[Message sent by forum member 'ksak' (ksak)]

http://forums.java.net/jive/thread.jspa?messageID=227127