5 Replies Latest reply on Jul 9, 2004 10:08 AM by peterb

    EJB Deployment

    gtigti

      Hi,

      I'm new to jboss and I have to deploy a J2EE application.
      The WebModule, the JavaModule and the DataSource (Oracle) are working fine, but not the EJBModule

      I have this error :

      javax.naming.NameNotFoundException: ejb not bound

      I red about jboss.xml but I dunno where to put it, what do I have to put in it or if it's necessary to write it or not.

      Note that from the jmx-xonsole, I have the following :

      JMX MBean Operation Result
      Operation list()

      java:comp namespace of the OPCAISSE bean:
      +- env (class: org.jnp.interfaces.NamingContext)


      These two lines are displayed for each of my Java beans, so the EJB Module was correctly deployed I guess.

      Can someone help me with this please ? ...

      Thx in advance

        • 1. Re: EJB Deployment
          gtigti

          No one have had problems with EJB deployment ?

          Please, it's very urgent ......

          • 2. Re: EJB Deployment
            gtigti

            I think I have to write this fragment for each session bean or entity bean I have :


            <ejb-name></ejb-name>
            <jndi-name></jndi-name>
            <local-jndi-name></local-jndi-name>


            but I don't know what values I have to put in these tags, suppose I have an entity bean with name OPCAISSE in com.gti.iagence.ejb.opcaisse.entity package

            So the fragment will look like this ?


            <ejb-name>OPCAISSE</ejb-name>
            <jndi-name>com/gti/iagence/ejb/opcaisse/entity/OPCAISSE</jndi-name>
            <local-jndi-name>OPCAISSELocal</local-jndi-name>


            please help ....

            • 3. Re: EJB Deployment
              jamesstrachan

              I don't know whether you are trying to deploy a session bean or entitry bean, but here is an example of both xml descriptors that works.

              
              Fragment from ejb-jar.xml
              
               <session>
               <display-name>Menu Option Use Case Session Bean</display-name>
               <ejb-name>milton/appmenu/optionmaint</ejb-name>
               <home>org.milton.services.applicationmenu.OptionMaintHome</home>
               <remote>org.milton.services.applicationmenu.OptionMaintRemote</remote>
               <ejb-class>org.milton.services.applicationmenu.OptionMaintBean</ejb-class>
               <session-type>Stateless</session-type>
               <transaction-type>Container</transaction-type>
               <ejb-ref>
               <ejb-ref-name>ejb/milton/appmenu/menuoption</ejb-ref-name>
               <ejb-ref-type>Entity</ejb-ref-type>
               <home>org.milton.services.applicationmenu.MenuOptionHome</home>
               <remote>org.milton.services.applicationmenu.MenuOptionRemote</remote>
               <ejb-link>milton/appmenu/menuoption</ejb-link>
               </ejb-ref>
               </session>
               <entity>
               <description>Menu Option Entity Bean</description>
               <display-name>Menu Option EJB</display-name>
               <ejb-name>milton/appmenu/menuoption</ejb-name>
               <home>org.milton.services.applicationmenu.MenuOptionHome</home>
               <remote>org.milton.services.applicationmenu.MenuOptionRemote</remote>
               <ejb-class>org.milton.services.applicationmenu.MenuOptionBean</ejb-class>
               <persistence-type>Bean</persistence-type>
               <prim-key-class>java.lang.String</prim-key-class>
               <reentrant>False</reentrant>
               <primkey-field>shortCode</primkey-field>
               <resource-ref>
               <res-ref-name>jdbc/MiltonDS</res-ref-name>
               <res-type>javax.sql.DataSource</res-type>
               <res-auth>Container</res-auth>
               </resource-ref>
               </entity>
              
              
              Entire jboss.xml
              
              <?xml version="1.0" encoding="Cp1252"?>
              <!DOCTYPE jboss PUBLIC "-/JBoss//DTD JBOSS 3.0//EN" "http://www.jboss.org/j2ee/dtd/jboss_3_0.dtd">
              
              
              <!-- Define security domain for the Milton application. -->
              <jboss>
               <security-domain>java:/jaas/Milton</security-domain>
               <unauthenticated-principal>guest</unauthenticated-principal>
               <enforce-ejb-restrictions>false</enforce-ejb-restrictions>
               <resource-managers>
               <resource-manager>
               <res-name>jdbc/MiltonDS</res-name>
               <res-jndi-name>java:/DefaultDS</res-jndi-name>
               </resource-manager>
               </resource-managers>
              </jboss>
              
              


              This gives a full definition of a session bean, which references an entity bean.

              The entity bean in turn references a datasource defined in jboss.xml.

              You can use a reference in jboss.xml of form :-

              
               <entity>
               <ejb-name>milton/appmenu/menuoption</ejb-name>
               <jndi-name>another/jndi/name</jndi-name>
               </entity>
              
              


              but you only need this if you can't map your EJB names one-to-one with the JNDI names.

              James


              • 4. Re: EJB Deployment
                gtigti

                I'm trying to deploy session beans and entity beans, but I dunno if I will need to reference them all in a jboss.xml file, my DS is working fine without that file.

                So ca, I deploy without using jboss.xml ?

                my ejb-jar.xml file looks like this :


                <?xml version="1.0" encoding="UTF-8"?>
                <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
                "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
                <ejb-jar id="EJBJar_1084196237578">
                <display-name>EJBJARArchive</display-name>
                <enterprise-beans>

                <ejb-name>OPCAISSESB</ejb-name>
                com.gti.iagence.ejb.opcaisse.session.OPCAISSESBHome
                com.gti.iagence.ejb.opcaisse.session.OPCAISSESB
                <ejb-class>com.gti.iagence.ejb.opcaisse.session.OPCAISSESBBean</ejb-class>
                <session-type>Stateless</session-type>
                <transaction-type>Bean</transaction-type>
                <ejb-local-ref id="EJBLocalRef_1084197960188">

                <ejb-ref-name>ejb/EXTRAIT1</ejb-ref-name>
                <ejb-ref-type>Entity</ejb-ref-type>
                <local-home>com.gti.iagence.ejb.utilmetier.entity.EXTRAITHome</local-home>
                com.gti.iagence.ejb.utilmetier.entity.EXTRAIT
                <ejb-link>EXTRAIT</ejb-link>
                </ejb-local-ref>
                <ejb-local-ref id="EJBLocalRef_1084197960172">

                <ejb-ref-name>ejb/COMPTE1</ejb-ref-name>
                <ejb-ref-type>Entity</ejb-ref-type>
                <local-home>com.gti.iagence.ejb.utilmetier.entity.COMPTEHome</local-home>
                com.gti.iagence.ejb.utilmetier.entity.COMPTE
                <ejb-link>COMPTE</ejb-link>
                </ejb-local-ref>
                <ejb-local-ref id="EJBLocalRef_1084197960203">

                <ejb-ref-name>ejb/CAISSE1</ejb-ref-name>
                <ejb-ref-type>Entity</ejb-ref-type>
                <local-home>com.gti.iagence.ejb.opcaisse.entity.CAISSEHome</local-home>
                com.gti.iagence.ejb.opcaisse.entity.CAISSE
                <ejb-link>CAISSE</ejb-link>
                </ejb-local-ref>
                <ejb-local-ref id="EJBLocalRef_1084197960219">

                <ejb-ref-name>ejb/OPCAISSE1</ejb-ref-name>
                <ejb-ref-type>Entity</ejb-ref-type>
                <local-home>com.gti.iagence.ejb.opcaisse.entity.OPCAISSEHome</local-home>
                com.gti.iagence.ejb.opcaisse.entity.OPCAISSE
                <ejb-link>OPCAISSE</ejb-link>
                </ejb-local-ref>
                <ejb-local-ref id="EJBLocalRef_1084360137141">

                <ejb-ref-name>ejb/INSTANCE1</ejb-ref-name>
                <ejb-ref-type>Entity</ejb-ref-type>
                <local-home>com.gti.iagence.ejb.utilmetier.entity.INSTANCEHome</local-home>
                com.gti.iagence.ejb.utilmetier.entity.INSTANCE
                <ejb-link>INSTANCE</ejb-link>
                </ejb-local-ref>
                <ejb-local-ref id="EJBLocalRef_1084464058000">

                <ejb-ref-name>ejb/VERS_DEPL_CENTRAL1</ejb-ref-name>
                <ejb-ref-type>Entity</ejb-ref-type>
                <local-home>com.gti.iagence.ejb.opcaisse.entity.VERS_DEPL_CENTRALHome</local-home>
                com.gti.iagence.ejb.opcaisse.entity.VERS_DEPL_CENTRAL
                <ejb-link>VERS_DEPL_CENTRAL</ejb-link>
                </ejb-local-ref>
                <ejb-local-ref id="EJBLocalRef_1084469748797">

                <ejb-ref-name>ejb/VERS_RET_DEPL1</ejb-ref-name>
                <ejb-ref-type>Entity</ejb-ref-type>
                <local-home>com.gti.iagence.ejb.opcaisse.entity.VERS_RET_DEPLHome</local-home>
                com.gti.iagence.ejb.opcaisse.entity.VERS_RET_DEPL
                <ejb-link>VERS_RET_DEPL</ejb-link>
                </ejb-local-ref>
                <ejb-local-ref id="EJBLocalRef_1084528627031">

                <ejb-ref-name>ejb/CHQDELIV1</ejb-ref-name>
                <ejb-ref-type>Entity</ejb-ref-type>
                <local-home>com.gti.iagence.ejb.utilspecial.entity.CHQDELIVHome</local-home>
                com.gti.iagence.ejb.utilspecial.entity.CHQDELIV
                <ejb-link>CHQDELIV</ejb-link>
                </ejb-local-ref>


                ......

                • 5. Re: EJB Deployment
                  peterb

                  You need to add all your beans to a jboss.xml file that maps EJB names to JNDI names. This is explained in the previous messages.

                  Furthermore I think you are looking up "ejb" instead of the actual bean you want, which would be something like "OPCAISSESB".