4 Replies Latest reply on Jul 4, 2006 3:31 AM by hoagiex

    JNDI binding? (also: API Versions)


      In different tutorials I am seeing different specifications for the same models.

      e.g.: To bind a SessionBean to a give name, some use:


      others use:


      What am I missing or not getting? (ps. the LocalBinding annotation is also not available in the API documentation and/or Jboss EJB3.0 package)

      Also, I find it highly annoying that the mappedName proprety isn't supported by Jboss (4.0.4GA) and that when you use the name property, the JAR filename is included in the JNDI binding, which makes hardcoding JNDI bindings impossible, since you have no garuantee whatsoever that the jar filename won't be changed by someone down the road.

        • 1. Re: JNDI binding? (also: API Versions)

          There is no definition in the specification on how to bind a bean to a specific JNDI name. The LocalBinding is in the org.jboss.annotation.ejb package (from deploy/default/ejb3.deployer/jboss-annotations-ejb3.jar), you should use that one.

          Please let me know if it works out.

          • 2. Re: JNDI binding? (also: API Versions)

            @LocalBinding works perfectly .... but it's really REALLY lame that Jboss put in this annotation, while the sun EJB3.0 specification says that the mappedName property of @Stateless should do this job.

            Vendor specific solutions are evil and wrong!

            • 3. Re: JNDI binding? (also: API Versions)

              Please let me know where it says so. I couldn't find it.

              • 4. Re: JNDI binding? (also: API Versions)

                Sun JEE5 API, javax.ejb package Stateless annotation:

                public abstract String mappedName
                A product specific name(e.g. global JNDI name) that this session bean should be mapped to. Application servers are not required to support any particular form or type of mapped name, nor the ability to use mapped names. The mapped name is product-dependent and often installation-dependent. No use of a mapped name is portable.

                Using this property does absolutely nothing in Jboss, so I guess they don't support it.