6 Replies Latest reply on Dec 11, 2002 8:28 PM by gayathri

    Local Interface question

    stevek

      I looked at many messages, but still cannot find the answer. I want to use the local interface on a session bean from within a JSP. I did not modify ejb-jar.xml or jboss.xml. I only tried to modify jboss-web.xml and web.xml and here they are:

      web.xml:
      --------
      <ejb-local-ref>
      <ejb-ref-name>ejb/webtest/TestSessionLocal</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      <local-home>test.interfaces.TestSessionLocalHome</local-home>
      test.interfaces.TestSessionLocal
      <ejb-link>ejb/test/TestSessionLocal</ejb-link>
      </ejb-local-ref>

      note: the data within <ejb-link> came from my ejb-jar.xml where the session bean is defined.

      jboss-web.xml :
      ---------------
      <ejb-ref>
      <ejb-ref-name>ejb/webtest/TestSessionLocal</ejb-ref-name>
      <jndi-name>ejb/test/TestSessionLocal</jndi-name>
      </ejb-ref>

      index.jsp:
      ----------
      TestSessionLocalHome localHome = (TestSessionLocalHome) lContext.lookup(
      "java:comp/env/ejb/webtest/TestSessionLocal"


      error when deployed:
      --------------------
      target not found, add valid ejb-link

      NOTES:
      ------

      you may recognize this code since I grabbed it from the template provided by JBOSS. I am just trying to add a local interface to the TestSession bean and use it within index.jsp.

      Thanks

        • 1. Re: Local Interface question

          Does the example work without the entry in the jboss-web.xml? The reason I ask is that normally you would use EITHER the ejb-link OR the entry in the jndi-web.xml, but not both.

          If JBoss is using the jboss-web.xml entry, I think there may be a problem because the jndi-name that you are pointing to is a globally accessible name (i.e. it doesn't start with "java:" and so can be accessed from outside the machine). Since this is a local interface, it should NOT exist in the global JNDI namespace, so JBoss would be correct in its error report.

          • 2. Re: Local Interface question
            stevek

            If I remove the entry from jboss-web.xml, I get the same error when I deploy "target not found, add valid ejb-link". If I remove the stuff from web.xml, I can deploy it, but the I get the error "TestSessionLocal not bound" when I access the bean from the jsp.

            Thanks for any help

            • 3. Re: Local Interface question

              Well then, I'm not sure what's wrong, but perhaps you can work it out from the attached example (which works on JBoss 3.0.2).

              The zip includes an ear file, and you should be able to test it by hitting /local/index.jsp

              • 4. Re: Local Interface question
                stevek

                Thanks for the response - I guess the key is to put everything in an EAR file. It worked after I deployed the new file.

                Thanks again

                • 5. Re: Local Interface question
                  zezinho

                  WHAT THE HELL IS JBOSS????

                  • 6. Re: Local Interface question
                    gayathri

                    When I did call the Local interface, I gave a simple name in the ejb-link.Try removing
                    "ejb/test/" from the ejb-link.