1 Reply Latest reply on Dec 26, 2007 3:30 PM by wayne baylor

    Still having problems with java:comp/env lookups

    Magnus Sandberg Novice


      I still have problems with getting my local beans into java:comp/env.

      In my application I have annotated Local beans in an ear - I will deploy the ear more than one time so I need my beans in the 'ear-name/' global-namespace.

      I must also do some dynamic-lookups (non-annotated) using the EJBObject.lookup(..) (right?) when doing this the local beans needs to be in java:comp/env (right?)

      I still haven't been able to figure out how to achieve this ...

      any pointers or examples would be very appreciated!


        • 1. Re: Still having problems with java:comp/env lookups
          wayne baylor Apprentice

          ejb-jar.xml declares the ejbs and the jboss.xml maps them to their global jndi name.


          <ejb-jar version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd">

          <!DOCTYPE jboss PUBLIC
           "-//JBoss//DTD JBOSS 3.2//EN"

          with these you can use the following to look up the ejb:

          MyLocal bean = (MyLocal)new InitialContext().lookup("com.example.MyBean/local");