0 Replies Latest reply on Oct 27, 2004 4:39 AM by Norman Fung

    EJB Deployment Decriptors

    Norman Fung Newbie

      I'm newbie in J2EE, having read a bunch of stuff I'm still in the wood. Please bear with me.

      Here's an example descriptor:

       <env-entry-value>Some value</env-entry-value>
       <ejb-ref-name>ejb/ses1</ejb-ref-name> QUESTION 1: ejb/ses1??? Is it "SS1" JNDI name? Why isn't JNDI name declared in "ejb-jar.xml"??

      QUESTION 2. What's the purpose of "ejb-ref", "ejb-local-ref" in EJB deployment descriptor? Is it that if one EJB (ejb/beanA) depends on another, say (ejb/ses1) (by virtue of having the dependency declared in deployment descriptor) - deployment of "ejb/beanA" would fail if "ejb/ses1" was not deployed on the target server? That DEPLOYMENT of an EJB (depending on a particular resource) would FAIL if that resource it depends on is absent on the destination server? Is this the only purpose?

      QUESTION 3. Should I specify JNDI names for <ejb-name> tag?

      QUESTION 4. Is "fully qualified" JNDI name (for the above bean):
      JNDI name = "java:comp/" + <ejb-name>
      example: "java:comp/ejb/beanA"

      OR just:
      JNDI name = "java:" + <ejb-name>
      example: "java:ejb/beanA"

      Is this true for all application servers? JBoss? Or does it depends on "ejb-name" to "jndi-name" mapping as specified in "jboss.xml" (see below)

      QUESTION 5. For JBoss EJB's, "ejb-name" to "jndi-name" mapping is done in "jboss.xml":


      Does it mean if "jndi-name" is NOT specified, then by default, "jndi-name" of the bean would equal "ejb-name"?

      "java:com/" + <ebj-name>


      "java:com/" + <jndi-name>



      QUESTION 6. Why "java:comp/"? What's that for? Is it:
      a. "java:comp/"
      b. "java:comp"
      c. "java:"

      I think I've seen different versions, getting really confused.

      QUESTION 7. For environment variables, it seems:

      JNDI name="java:comp/env" +<env-entry-name>

      In this case,

      Is this true for all servers?

      QUESTION 8. For data sources (JBoss), you need to put "mysql-ds.xml" under "Deploy" folder:

       <jndi-name>jdbc/exampleDS</jndi-name> <connection-url>jdbc:mysql://</connection-url>

      6a. I dont understand why we need to append "java:" in context.lookup:

      context=new InitialContext();
      dataSource=(DataSource) context.lookup("java:jdbc/exampleDS");

      6b. Can we rename the file name "mysql-ds.xml" to anything we like as long as it remains in "Deploy" folder? (Tested this on JBoss)