Men X
Men X

Reputation: 163

Weblogic Unable to deploy EJB javax.naming.NameAlreadyBoundException

I have 2 ejb(s), MyTestEB in mytest project and TestEB in test project. mytest project references to test project

MyTestEB in ejb-jar.xml file in mytest project:

<entity id="Entity_TransactionEB">
        <description>Transaction Entity Bean</description>
        <display-name>Transaction Entity Bean</display-name>
        <ejb-name>MyTestEB</ejb-name>
        <local-home>
            test.transaction.ejb.TransactionLocalHome
        </local-home>
        <local>
            test.transaction.ejb.TransactionLocal
        </local>
        <ejb-class>
            test.transaction.ejb.TransactionBean
        </ejb-class>
        <persistence-type>Bean</persistence-type>
        <prim-key-class>
            test.transaction.TransactionKey
        </prim-key-class>
        <reentrant>False</reentrant>
        <resource-ref id="ResourceRef_TransactionEB_jdbc">
            <res-ref-name>jdbc/DataSource</res-ref-name>
            <res-type>javax.sql.DataSource</res-type>
            <res-auth>Container</res-auth>
        </resource-ref>
    </entity>

test.transaction.ejb.TransactionLocalHome; test.transaction.ejb.TransactionBean and test.transaction.TransactionKey are all in test project

TestEB in ejb-jar.xml file in test project:

<entity id="Entity_TransactionEB">
            <description>Transaction Entity Bean</description>
            <display-name>Transaction Entity Bean</display-name>
            <ejb-name>TestEB</ejb-name>
            <local-home>
                test.transaction.ejb.TransactionLocalHome
            </local-home>
            <local>
                test.transaction.ejb.TransactionLocal
            </local>
            <ejb-class>
                test.transaction.ejb.TransactionBean
            </ejb-class>
            <persistence-type>Bean</persistence-type>
            <prim-key-class>
                test.transaction.TransactionKey
            </prim-key-class>
            <reentrant>False</reentrant>
            <resource-ref id="ResourceRef_TransactionEB_jdbc">
                <res-ref-name>jdbc/DataSource</res-ref-name>
                <res-type>javax.sql.DataSource</res-type>
                <res-auth>Container</res-auth>
            </resource-ref>
        </entity>

When I deploy my application in Weblogic, I got the error(error snippet):

Unable to deploy EJB: MyTestEB from mytest-ejb.jar:

[EJB:011072]Unable to bind EJB Local Home Interface to the JNDI name: TestEB.
javax.naming.NameAlreadyBoundException: TestEB is already bound; remaining name ''
    at weblogic.jndi.internal.BasicNamingNode.bindHere(BasicNamingNode.java:357)

Upvotes: 2

Views: 9338

Answers (1)

Hououin Kyouma
Hououin Kyouma

Reputation: 409

"JNDI name is already bound" occurs when there are more that one instance tries to get tied to the JNDI tree. You can check what is causing this by opening the console -> Domain -> Servers. Choose a managed server and select the JNDI tree option. This will tell you who has taken the name. You can also do this in you XML, specify JNDI as <jndi-name>...</jndi-name> You can refer more about that here resource-description from Oracle Doc The whole list of things tat can be mentioned in the ejb-jar.xml is mentioned here docs.oracle.com/cd/E23943_01/web.1111/e13719/ejb_jar_ref.htm#i1114706

Upvotes: 1

Related Questions