3 Replies Latest reply on Sep 13, 2002 2:49 AM by prasanna

    referencing ejbs

    zarni

      Hello, i'm very new to all this. I'm trying to deploy
      a simple entity bean and a very simple jsp that accesses it, but jboss reports that:

      org.jboss.deployment.DeploymentException: Error during deploy; - nested throwable: (javax.naming.NamingException: ejb-local-ref: PartyBeanRef, target not found, add valid ejb-link)

      Where (jboss-web.xml or web.xml) and how should i reference my beans in the deployment descriptors.

      Thank's for help...

      Zarni

        • 1. Re: referencing ejbs
          claycarpenter

          Judging from your object name, I'm guessing your having problems getting a reference object from a JNDI context lookup. I believe this is caused by the absence of a JNDI name/binding for your bean. You can specify/configure this in the jboss.xml file. My file, which declares an entity bean, is as follows (sorry about the excessive comments):


           <enterprise-beans>
            
          <!--- Name of the bean, must correspond to related --->
          <!--- bean declarations in ejb-jar.xml --->
             <ejb-name>User</ejb-name>
          <!--- JNDI binded name of the bean, used to look --->
          <!--- up references to the bean's home interface. --->
             <jndi-name>clay/test/ejb/User</jndi-name>
             <read-only>false</read-only>
          <!--- Other entity beans are defined here --->
            
          <!--- Session & Messaging beans, as well as other --->
          <!--- jboss-related information are defined here. --->
          </enterprise-beans>


          The jboss.xml file goes into the meta inf directory with the ejb-jar.xml file (and any others you need). You don't need to edit the jboss-web.xml or web.xml files, because all necessary configuration is done on the ejb's end, inside its jar file.

          Once you have redeployed your jar, you should be able to access your bean fine.

          Hope that helps.

          • 2. Re: referencing ejbs
            zarni

            Thank you for your help...

            I checked my *.xml files and found out that if you want to access your ejb's from within java server pages you have to define an ejb-ref tag in the web.xml and bind this ref to a jndi-name in the jboss-web.xml. The jndi-name should be the same as the one u used in jboss.xml.
            It took me at least three days to figure this out, ugh.

            Thanks,
            Zarni

            • 3. Re: referencing ejbs - binding local interfaces
              prasanna

              Hi !
              (JBoss 3.0 -)

              I had the same problems as u did. But I still could not solve it. My ejbs work perfectly well when I use the remote interfaces to access from a jsp page.
              But when I use local interfaces it gives me a
              NamingException ejb not bound ...add a valid ejb link.
              On my part I found out that one has to use ejb-local-ref
              in web.xml.

              <ejb-local-ref>
              <ejb-ref-name>ejb name ref. in jboss.xml</ejb-ref-name>
              <local-home> ..</local-home>
              ..
              </ejb-local-ref>

              This too did not work and throwed the same exception.
              I also found in the DTD of jboss_web_3_0.dtd that it does not support tags for local ref as in the dtd of web.xml which is from Sun.