>
> Just to see that I am sure(please correct me and ofc any explanation
> is appreciated).
>
> the ejb-ref and ejb-local-ref work also with "local/HandlerBean"
> meaning I still a re-map from local/HandlerBean to something else.
>
> The ejb-ref and friends as far as I know is used together with the
> session bean. In my case I could access the bean without using the
> ejb-ref (I found it`s name from the jmx-console). (can anyone shed
> some light in this area?).

Okay, each component [application, web context, ejb, ....] you deply
will have its own Context. It will be located at "java:/comp/env".

Now if you are looking for something that is bound to "java:/comp/env"
from with a servlet you have to put it there. You would put it there
thru ejb-ref in your web.xml

If you used "java:/comp/env" from within an EJB then you would need
references in the ejb-jar.xml

That is all true about local context. JBoss however has a global context.
Where it binds your objects. I am not sure exactly what convention is
when you do not provide those three optional xmls that I was talking
about in my earlier post, but those are basically needed to provide
connections.

So jboss.xml will bind your ejbs into the global context so that other
components [apps] can reference it (in their local "java:/comp/env";
jbossweb.xml will do similar job for your web app.


Okay just to give you some example, suppose we have a bean Facade:

ejb-jar.xml

  <session >
    <description><![CDATA[Facade Bean]]></description>
    <ejb-name>Facade</ejb-name>
    <home>edu.columbia.law.tas.ejb.FacadeHome</home>
    <remote>edu.columbia.law.tas.ejb.Facade</remote>
    <ejb-class>edu.columbia.law.tas.ejb.FacadeEJB</ejb-class>
    <session-type>Stateful</session-type>
    <transaction-type>Container</transaction-type>
  </session>

jboss.xml

  <session>
    <ejb-name>Facade</ejb-name>
    <!-- note this is your global name for FacadeHome
                        watch it referenced in jbossweb.xml -->
    <jndi-name>ejb/tas/FacadeHome</jndi-name>
  </session>

web.xml
  <!-- this is the declaration that will bind FacadeHome into the
       local context of your web application so that you can do

       InitialContext initialContext = new InitialContext();
       try {
         java.lang.Object objRef =
initialContext.lookup("java:/comp/env/ejb/Facade");
         return (edu.columbia.law.tas.ejb.FacadeHome)
                  PortableRemoteObject.narrow(
                        objRef,
                        edu.columbia.law.tas.ejb.FacadeHome.class);
       } finally {
         initialContext.close();
       }
     -->
  <ejb-ref>
    <ejb-ref-name>ejb/Facade</ejb-ref-name>
    <ejb-ref-type>Entity</ejb-ref-type>
    <home>edu.columbia.law.tas.ejb.FacadeHome</home>
    <remote>edu.columbia.law.tas.ejb.Facade</remote>
    <ejb-link>Facade</ejb-link>
  </ejb-ref>

jbossweb.xml
   <!-- finally this is where you connect your ejb/Facade to
        the global home -->
   <ejb-ref>
     <ejb-ref-name>ejb/Facade</ejb-ref-name>   <!-- local name fo it -->
     <jndi-name>ejb/tas/FacadeHome</jndi-name> <!-- global context look at
jboss.xml  -->
   </ejb-ref>

That is about it. The only thing that I can not find in jmx-console
is how do I see the env context of my web context it has to have
one, but it might be Jetty hidden. So I have not found a way to browse it.

Alex.



-------------------------------------------------------
This SF.net email is sponsored by: Scholarships for Techies!
Can't afford IT training? All 2003 ictp students receive scholarships.
Get hands-on training in Microsoft, Cisco, Sun, Linux/UNIX, and more.
www.ictp.com/training/sourceforge.asp
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to