users@glassfish.java.net

give interfaces unique JNDI names? (err: name for bean is already in use)

From: <glassfish_at_javadesktop.org>
Date: Mon, 18 Feb 2008 10:35:31 PST

Hi,

How can I give my local and remote EJB interfaces unique JNDI names? What do I put in the deployment descriptors? I'm reusing the same session bean with different queue resources in the deployment descriptor, but Glassfish is unhappy because the remote interface class name is the same for both session beans:

[i]Jndi name [com.ilmn.dam.fab.jms.FabToHubSenderRemote]
 for bean [FabSeattle01ToHubSenderSBean] is already in use[/i]



[b]EJB-JAR.XML
===========[/b]

<ejb-jar...>
  <enterprise-beans>

    <session>
        <ejb-name>FabSeattle01To[b]Hub[/b]SenderSBean</ejb-name>
        <business-local>com.ilmn.dam.fab.jms.FabToHubSenderLocal</business-local>
        <business-remote>[i][b]com.ilmn.dam.fab.jms.FabToHubSenderRemote[/b][/i]</business-remote>
        <ejb-class>com.ilmn.dam.fab.jms.FabToHubSenderSBean</ejb-class>

        <session-type>Stateless</session-type>
        <transaction-type>Container</transaction-type>

      <security-identity>
        <use-caller-identity/>
        </security-identity>

    </session>

    <session>
        <ejb-name>FabSeattle01To[b]Pts[/b]SenderSBean</ejb-name>
        <business-local>com.ilmn.dam.fab.jms.FabToHubSenderLocal</business-local>
        <business-remote>[i][b]com.ilmn.dam.fab.jms.FabToHubSenderRemote[/b][/i]</business-remote>
        <ejb-class>com.ilmn.dam.fab.jms.FabToHubSenderSBean</ejb-class>

        <session-type>Stateless</session-type>
        <transaction-type>Container</transaction-type>

      <security-identity>
        <use-caller-identity/>
        </security-identity>

    </session>
</enterprise-beans>
</ejb-jar>



[b]SUN-EJB-JAR.XML
===============[/b]

<sun-ejb-jar>
  <enterprise-beans>

    <!-- session bean to send messages to HUB -->

    <ejb>
      <ejb-name>FabSeattle01To[b]Hub[/b]SenderSBean</ejb-name>
      <jndi-name>jms/FabSeattle01ToHubSenderSBean</jndi-name>
      <resource-ref>
        <res-ref-name>jms/FabZzzNnFactory</res-ref-name>
        <jndi-name>jms/FabSeattle01Factory</jndi-name>
      </resource-ref>
      <message-destination-ref>
        <message-destination-ref-name>jms/FabZzzNnToHubQueue</message-destination-ref-name>
        <jndi-name>jms/FabSeattle01ToHubQueue</jndi-name>
      </message-destination-ref>
    </ejb>

    <ejb>
      <ejb-name>FabSeattle01To[b]Pts[/b]SenderSBean</ejb-name>
      <jndi-name>jms/FabSeattle01ToPtsSenderSBean</jndi-name>
      <resource-ref>
        <res-ref-name>jms/FabZzzNnFactory</res-ref-name>
        <jndi-name>jms/FabSeattle01Factory</jndi-name>
      </resource-ref>
      <message-destination-ref>
        <message-destination-ref-name>jms/FabZzzNnToHubQueue</message-destination-ref-name>
        <jndi-name>jms/FabSeattle01ToPtsQueue</jndi-name>
      </message-destination-ref>
    </ejb>
</enterprise-beans>
</sun-ejb-jar>

[b]LOG:
====[/b]

[#|2008-02-18T09:56:06.177-0800|SEVERE|sun-appserver9.1|javax.enterprise.system.
container.ejb|_ThreadID=14;_ThreadName=httpWorkerThread-4848-1;javax.naming.Name
AlreadyBoundException: Use rebind to override;_RequestID=56a368e9-53ff-4afd-9a00
-5b245820063b;|EJB5090: Exception in creating EJB container [javax.naming.NameAl
readyBoundException: Use rebind to override]|#]

[#|2008-02-18T09:56:06.177-0800|SEVERE|sun-appserver9.1|javax.enterprise.system.
container.ejb|_ThreadID=14;_ThreadName=httpWorkerThread-4848-1;_RequestID=56a368
e9-53ff-4afd-9a00-5b245820063b;|appId=dam-fab-enterpriseApp moduleName=dam-fab-e
jb_jar ejbName=FabSeattle01ToHubSenderSBean|#]

[#|2008-02-18T09:56:06.177-0800|SEVERE|sun-appserver9.1|javax.enterprise.system.
core.classloading|_ThreadID=14;_ThreadName=httpWorkerThread-4848-1;dam-fab-enter
priseApp;com.ilmn.dam.fab.jms.FabToHubSenderRemote;FabSeattle01ToHubSenderSBean;_Req
uestID=56a368e9-53ff-4afd-9a00-5b245820063b;|LDR5012: Jndi name conflict found i
n [dam-fab-enterpriseApp]. Jndi name [com.ilmn.dam.fab.jms.FabToHubSenderRemote]
 for bean [FabSeattle01ToHubSenderSBean] is already in use.|#]

[#|2008-02-18T09:56:06.177-0800|SEVERE|sun-appserver9.1|javax.enterprise.system.
container.ejb|_ThreadID=14;_ThreadName=httpWorkerThread-4848-1;javax.naming.Name
AlreadyBoundException: Use rebind to override;_RequestID=56a368e9-53ff-4afd-9a00
-5b245820063b;|EJB5090: Exception in creating EJB container [javax.naming.NameAl
readyBoundException: Use rebind to override]|#]

[#|2008-02-18T09:56:06.177-0800|SEVERE|sun-appserver9.1|javax.enterprise.system.
core.classloading|_ThreadID=14;_ThreadName=httpWorkerThread-4848-1;_RequestID=56
a368e9-53ff-4afd-9a00-5b245820063b;|LDR5013: Naming exception while creating EJB
 container:
javax.naming.NameAlreadyBoundException: Use rebind to override
        at com.sun.enterprise.naming.TransientContext.doBindOrRebind(TransientCo
ntext.java:292)
        at com.sun.enterprise.naming.TransientContext.bind(TransientContext.java
[Message sent by forum member 'frenchdrip' (frenchdrip)]

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