7 Replies Latest reply on Jan 8, 2002 12:05 AM by lvyu

    External EJB reference

    Christian Mouttet Newbie

      I'm about to port an application from Sun-RI-1.3 to JBoss 2.4 and have the following problem.

      I have one session EJB in a jar file, ejb-jar.xml:

      <ejb-name>ClientList</ejb-name>
      ...

      which is mapped to ejb/clientlist/ClientList in jboss.xml:


      <ejb-name>ClientList</ejb-name>
      <jndi-name>ejb/clientlist/ClientList</jndi-name>

      <resource-ref>
      <res-ref-name>jdbc/MyDataSource</res-ref-name>
      <jndi-name>jdbc/MyDatabase</jndi-name>
      </resource-ref>



      A second EJB in another jar file ejb-jar.xml

      <ejb-name>ClientController</ejb-name>


      The ClientController calls ClientList. Putting the EJBs in one single jar file is no option.

      Regarding to the manual, I added following to the ClientController's ejb-jar file

      <ejb-ref>
      <ejb-ref-name>ejb/clientlist/ClientList</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      com.cedar.de.docnumber.clientlist.clientlist.ejb.ClientListHome
      com.cedar.de.docnumber.clientlist.clientlist.ejb.ClientList
      </ejb-ref>

      and jboss.xml

      <ejb-ref>
      <ejb-ref-name>ejb/clientlist/ClientList</ejb-ref-name>
      <jndi-name>ejb/clientlist/ClientList</jndi-name>
      </ejb-ref>


      I get this ugly error message while deploying

      [Container factory] org.jboss.ejb.DeploymentException: ejb-ref ejb/clientlist/ClientList, expected either ejb-link in ejb-jar.xml or jndi-name in jboss.xml


      What is wrong?

      Thanks for your help
      Chris

        • 1. Re: External EJB reference
          andy Newbie

          Hi cmouttet,

          i have the same problem, can anyone help us?

          bao

          • 2. Re: External EJB reference
            Paul Austin Newbie

            Check the order of the elements in jboss.xml against the dtd to make sure the document is valid.

            • 3. Re: External EJB reference
              Christian Mouttet Newbie

              Now I know what's going wrong.

              I thought that the jboss.xml is the JBoss equivalent for sun-j2ee-ri.xml. That was my problem. The jboss.xml files must be included in the component's jar files.

              We have to spit up the sun-j2ee-ri.xml <enterprise-beans> entries containing the <jndi-name> in every single component jboss.xml. Under <ejb-ref> ... <jndi-name> the jnp://host:1099/ must be added.

              Starting with a very small 2-EJB-sized application. But every EJB must be in a different jar file to use external access.

              Good luck
              Chris

              • 4. Re: External EJB reference
                Paul Austin Newbie

                You can package more than one ejb in an ejb jar if the ejb-jar.xml and jboss.xml has an entry for each ejb.

                Paul

                • 5. Re: External EJB reference
                  Christian Mouttet Newbie

                  Paul,

                  thats right. This is what the manual mentioned as internal reference call.

                  My original problem was that I have more ejb.jar files in an ear file. One EJB from one jar references an other EJB in a different jar file. That is the external reference. I misunderstood the jboss.xml intention.

                  Chris

                  • 6. Re: External EJB reference
                    David Newbie

                    As an additional note (I was working on this problem myself) the new documentation talks about this here:

                    http://www.jboss.org/online-manual/HTML/ch07s13.html

                    • 7. Re: External EJB reference
                      lvyu Newbie

                      The online manual is not enough about the external ejb reference. If Bean A want to call Bean B , it must have the B's home and interface classes in its jar files.
                      I hope this could be help! and following post may be useful too!



                      EJB External Refence - Packaging Home and Remote Interfaces Posted: Nov 27, 2001 1:49 PM Reply

                      What is the best way to deploy several EJB jars that call each other? It appears that you have to have the home and remote interfaces either:

                      1) Packaged in the calling JAR
                      2) In the Classpath of JBOSS Application Server as
                      a) A single JAR which contains all Home and Remote Interfaces
                      b) A jar for each Home and Remote Interface

                      Issues:
                      1) Does adding Jars to the classpath require server re-starts
                      2) Does modifying an existing jar -- cause potential problems if JBOSS caches the classes in that jar

                      What are the best practices for this architecture?


                      Tom






                      lvyuawen

                      Posts: 3
                      Registered: Dec, 2001


                      Re: EJB External Refence - Packaging Home and Remote Interfaces Posted: Jan 7, 2002 9:47 PM Reply

                      I have tried many days to master how to implement the external ejb reference before finding your post.
                      And your post help me so much and thank you very much.

                      It is hard to say , but i think the best way is
                      Pachaged in the calling JAR.
                      1.that means a Engineer change order(ECO) should be brought to software development process.

                      thanks again£¡