2 Replies Latest reply on Aug 30, 2006 10:25 AM by Thanh-Son Huynh

    java:comp NameSpace in EJB 3.0

    Thanh-Son Huynh Newbie


      I am using JBoss 4.0.4GA with EJB 3.0 and having a problem of looking up a EJB reference defined in jboss.xml using


      When I used the JBoss MBean service JNDIView, I recon that all the EJBs version 3.0 don't have a java:comp namespace section. Only EJBs version 2.X have it.

      Is it normal that EJBs 3.0 don't have that namespace anymore?

      Thank you.

        • 1. Re: java:comp NameSpace in EJB 3.0
          Bill Burke Master

          we changed the ENC implementation for EJB3 to be ThreadLocal based instead of keyed by classloader. We can't change the implementation for java:comp for JBoss 4, so there is a new java:comp namespace for now:


          You can get this as a constant via org.jboss.ejb3.Container.ENC_CTX_NAME

          we'll change the value of this constant back to java:comp for JBoss 5.

          • 2. Re: java:comp NameSpace in EJB 3.0
            Thanh-Son Huynh Newbie

            Thanks for your quick reply.

            The question now is how to add a EJB Ref to that namespace (java:comp.ejb3). I have 2 EJBs: myEjb1 and myEjb2. The myEjb1 has a ref to myEJB2 like this:

            <?xml version="1.0" encoding="UTF-8"?>
            <jboss xmlns="http://java.sun.com/xml/ns/javaee"
             xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/jboss_5_0.xsd"

            And the MyBean2 binds to the JNDI name 'ejb/myEJB2'.
            When I deploy both EJBs in a EAR file to JBoss 4.0.4GA/EJB3.0, I get the exception:

            javax.naming.NamingException: Could not bind statless proxy with ejb name MyBean1 into JNDI under jndiName: /ejb/myEJB2 [Root exception is javax.naming.NameAlreadyBoundException]

            And in the JNDIView, it shows that the MyBean2 was already bound to 'ejb/myEJB2'.

            I don't understand why.

            Thank you