Using ejb-ref tag for EJB toEJB reference

Hello all respected members,
I am using weblogic 5.1 (sp 9).
I have two Session EJBs - a client and another is the referenced by
the client.
The client is using services of the referenced EJB.
The two EJBs are in two very different packages.
Now say I am trying to deploy the client EJB first, without deploying
the referenced EJB.
What I expect (rather, want)is, when the client EJB is being deloyed,
it should give a notification somehow (let's say, by throwing an
exception) that the referenced EJB is not yet deployed.
First of all, is this possible ?
Secondly, I am aware of the of the <ejb-ref> tag. In order to meet my
requirement, I have added the same tag in the client's ejb-jar.xml and
corresponding <ejb-reference-description> tag in the
weblogic-ejb-jar.xml file.
When I start the weblogic server, I can see that the referenced EJB is
not deployed. But the client EJB is being deployed, it does not give
any notification that the referenced EJB is not yet deployed and gets
deployed successfully.
In other words, I expect <ejb-ref> tag to let me know that the
referenced EJB is not yet deployed. Is my understanding of <ejb-ref>
tag correct ?
It is clear to me that when the client EJB tries to instantiate the
referenced EJB to use its services, it would throw an exception
(during the lookup) since the referenced EJB is not deployed. But I
want to avoid this exception at this stage. I want to get a
notification of this, much before i.e. when the weblogic is deploying
my client EJB. I think the <ejb-ref> tag does this. Hence I am using
it.
If I am going in wrong direction, is there any other way to fulfil my
requirement ?
Please advise.
Neelesh.

The <ejb-ref> element is used at deployment to map the bean references.
The beans referred to should already be deployed.
Neelesh wrote:
Hello all respected members,
I am using weblogic 5.1 (sp 9).
I have two Session EJBs - a client and another is the referenced by
the client.
The client is using services of the referenced EJB.
The two EJBs are in two very different packages.
Now say I am trying to deploy the client EJB first, without deploying
the referenced EJB.
What I expect (rather, want)is, when the client EJB is being deloyed,
it should give a notification somehow (let's say, by throwing an
exception) that the referenced EJB is not yet deployed.
First of all, is this possible ?
Secondly, I am aware of the of the <ejb-ref> tag. In order to meet my
requirement, I have added the same tag in the client's ejb-jar.xml and
corresponding <ejb-reference-description> tag in the
weblogic-ejb-jar.xml file.
When I start the weblogic server, I can see that the referenced EJB is
not deployed. But the client EJB is being deployed, it does not give
any notification that the referenced EJB is not yet deployed and gets
deployed successfully.
In other words, I expect <ejb-ref> tag to let me know that the
referenced EJB is not yet deployed. Is my understanding of <ejb-ref>
tag correct ?
It is clear to me that when the client EJB tries to instantiate the
referenced EJB to use its services, it would throw an exception
(during the lookup) since the referenced EJB is not deployed. But I
want to avoid this exception at this stage. I want to get a
notification of this, much before i.e. when the weblogic is deploying
my client EJB. I think the <ejb-ref> tag does this. Hence I am using
it.
If I am going in wrong direction, is there any other way to fulfil my
requirement ?
Please advise.
Neelesh.

Similar Messages

  • What are ejb-ref entries for?

    Why is there an <ejb-ref> element in the web.xml descriptor? I can just as simply
    reference an EJB from a webapp using the code:
    InitialContext ctx = new InitialContext();
    SpecialHome home = (SpecialHome) ctx.lookup("jndi.path.to.home");
    Special special = home.create();
    As I can using the code:
    InitialContext ctx = new InitialContext();
    SpecialHome home = (SpecialHome)
    ctx.lookup("java:comp/env/ejb/ejb-ref-specified-item");
    Special special = home.create();
    So... what's the benefit of using an <ejb-ref> element to add indirection to my ejb
    references as opposed to resolving them by absolute JNDI name? Is it faster? Or
    is it just that the indirection allows me to theoretically swap out naming servers/contexts/names
    at some future point (in which case it seems like an awful lot of trouble). Or is
    there something else I'm missing?
    Thanks!

    The ejb-ref is an ejb standard to be implemented across all the different application servers. You
    have to use this if you are going to support multiple application servers. I don't think there is any
    performance benefit using this.
    Shiva.
    Joshua Davies wrote:
    Why is there an <ejb-ref> element in the web.xml descriptor? I can just as simply
    reference an EJB from a webapp using the code:
    InitialContext ctx = new InitialContext();
    SpecialHome home = (SpecialHome) ctx.lookup("jndi.path.to.home");
    Special special = home.create();
    As I can using the code:
    InitialContext ctx = new InitialContext();
    SpecialHome home = (SpecialHome)
    ctx.lookup("java:comp/env/ejb/ejb-ref-specified-item");
    Special special = home.create();
    So... what's the benefit of using an <ejb-ref> element to add indirection to my ejb
    references as opposed to resolving them by absolute JNDI name? Is it faster? Or
    is it just that the indirection allows me to theoretically swap out naming servers/contexts/names
    at some future point (in which case it seems like an awful lot of trouble). Or is
    there something else I'm missing?
    Thanks!

  • PageNotFound when using servlets as clients for EJB

    Can anyone help me? I have a container managed EJB. I'm using servlets as my client. I placed my EJB's in a jar file and my servlets and html pages in a WAR file. I deployed them using J2EE's deploytool. I can access my html files but not my servlet files. It always says file not found or a 405 error (resource not allowed) I access my servlet this way...
    http://localhost:8000/ReservationContextRoot/ReservationAlias
    my web.xml file looks like the following:
    <?xml version="1.0" encoding="Cp1252"?>
    <!DOCTYPE web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN' 'http://java.sun.com/j2ee/dtds/web-app_2.2.dtd'>
    <web-app>
    <display-name>ReservationWAR</display-name>
    <description>no description</description>
    <servlet> <servlet-name>ReservationServlet</servlet-name>
    <display-name>ReservationServlet</display-name>
    <description>no description</description>
    <servlet-class>ReservationServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>ReservationServlet</servlet-name>
    <url-pattern>ReservationAlias</url-pattern>
    </servlet-mapping>
    <session-config>
    <session-timeout>30</session-timeout>
    </session-config>
    <resource-ref>
    <description>no description</description>
    <res-ref-name>jdbc/ReservationDB</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    <ejb-ref> <description>no description</description>
    <ejb-ref-name>ejb/Reservation</ejb-ref-name>
    <ejb-ref-type>Entity</ejb-ref-type>
    <home>ReservationHome</home>
    <remote>Reservation</remote>
    </ejb-ref>
    </web-app>

    Are you sure your servlet class itself can run without problem? Try debug in the these steps:
    1. Change your servlet to simply output some HTML text, so you can be sure tomcat can get to your servlet. If this is OK, it means the servlet itself has problem, probably the EJB stuff.
    2. Make sure the EJB container is running.
    3. Make your servlet a standalone client (not a servlet) and see if it can run. Pay attention to how you do JNDI lookup of the EJB.
    Yi

  • Help needed - why we use ejb-ref element in ejb-jar.xml

    hi all
    can anyone tell me what is the purpose of this element in the ejb deploy descriptor? thanks

    Suppose u have bean A, which needs to look up another bean B. Normally you wud need to use the jndi lookup using the initial context to access the bean B's home interface. If you use ejb-ref element you dont need to know the JNDI name of bean B. You can use ejb-ref-name instead. So you can say this is a short cut method of looking up and getting a reference to a bean's home object.

  • More information about the ejb-ref element of ejb-jar.xml

    Hello,
    I am currently studying ejbs and I came across the ejb-ref element of the ejb-jar.xml file. I am in reference to O'Reilly Entreprise JavaBeans book. The book says that, thanks to the ejb-ref element it is possible to access one ejb from another ejb with the following client code:
    InitialContext jndiContext = new InitialContext();
    Object ref = jndiContext.lookup("java:comp/env/ejb/ProcessPaymentHomeRemote");
    ProcessPaymentHomeRemote home = (ProcessPaymentHomeRemote) PortableRemoteObject.narrow(ref, ProcessPaymentHomeRemote.class);I thought one could invoke the above client code without the ejb-ref element being present in the ejb-jar.xml... I am right or wrong?
    Then why the need for the ejb-ref element? Can anyone give me a concrete example of usage of the ejb-ref element where the ejb-ref element really is useful? What are the advantages of using the ejb-ref element?
    Thanks in advance,
    Julien Martin.

    Hi Julien,
    The main reason is portability. It's true that in many J2EE implementations it is possible to access an EJB's Home object without going through the component context (java:comp/env), but all such approaches are NOT portable. In the J2EE programming model, all resource access is made via the private component namespace. Using this level of indirection allows the bean developer to code the application without having to know which physical resource will be used at runtime. Each J2EE implementation can use a different scheme to identity physical resources, so by sticking to logical references in your code, you guarantee portability. Finally, you have the advantage that you can change which physical resource is mapped at deployment time without having to change your code.
    So, the bottom line is, whenever you have any J2EE component (ejb, servlet, jsp, Application Client) that looks up an ejb, data source, queue, connection factory, etc., always use the environment reference type that J2EE defines for it and look it up via java:comp/env.
    --ken
    Kenneth Saks
    J2EE SDK Team
    SUN Microsystems

  • Possible to use RMI without IIOP for EJBs?

    Is it possble to use RMI on a client to connect to a remote EJB without using CORBA
    (IIOP)?
    How might I do it?
    I'd like to avoid the CORBA overhead if possible.
    Thanks.

    Do I just have to replace iiop:// with t3:// in the url?
    Andy Piper <[email protected]> wrote:
    "Tom Hennen" <[email protected]> writes:
    Is it possble to use RMI on a client to connect to a remote EJB withoutusing CORBA
    (IIOP)?
    How might I do it?
    I'd like to avoid the CORBA overhead if possible.Use t3
    andy

  • To use a Threading Class for EJBs or not?

    I was wondering if someone can help me answer this question? I am going to have this class that will be used by the Beans to complete a transaction. Because I have several Beans that all need this one particular class to complete a transaction, I was wondering if it would be good to create this class in a cache type manner. Meaning this class will only be instantiated once when the server loads after that all the beans will only reference it through this class' getInstance() method. I know this class does not contain any data that needs to persist however I would like to avoid having mulitple instances of this one particular class. The class completes a rather long transaction process. It is not much from my side, but I have to wait a few seconds for the other application that I connect to, to complete the transaction, then finally get a return. This class does not do too much work, but it just needs to wait for a long time to get back a response. Since threads are lighter and cheaper than a complete process I was wondering if I should create this class that extends the thread. Below I have some basic code that can do this but I was wondering if this would be a good methodolgy for transaction heavy application. Sorry for making it too long. I have marked the class with X's to prevent the client who we connect to.
    public class XXXXXXX extends Thread {
    private static XXXXXXXX wconn = null;
    private XXXXXXXX xxc;
    private String response = null;
    public XXXXXXXX() {
    this.xxc = new XXXXXXXX ();
    * set properties *
    this.xxc.host = ""; //Connector ID
    this.xxc.port = 8800; //without SSL
    //this.xxc.port = 443; //SSL
    this.xxc.ssl = false; //SSL (if true, change port to 443!)
    this.xxc.compress = true; //compression
    this.xxc._native = true; // native request; MUST set to true for XML Pro
    this.xxc.keepalive = false; //indicates if the connection to the server should persist
    public void run()
    public static XXXXXXXX getInstance()
    return wconn;
    private other functions ....
    Thank You for any insight that you can provide.

    So you want to run something outside the containter. It doesn't matter whether you have a seperate app or just run inside the same JVM as the container. Once you are outside the container it doesn't matter how you implement it in terms of J2EE.
    It sounds to me like you just have a job and you are submitting that job for processing. You might want to examine what happens when more than one thread accesses that instance at the same time but other than that it works. You might also want to look at what happens if one or more of the other systems are down (where persisting the job on your side might make sense.)

  • How will be the weblogic-ejb-jar and ejb-jar xml for EJB Local Interface?

    Hi,
    I have one ear application which is using Stateless Session Beans. I don't have any Bean to Bean communication . At present, the client is invoking remote methods thro Home/Remote interfaces. My doubt is , shall I implement EJBLocal home/ local interface to obtain this same functionality cos, in this app, both client and EJb bean have been deployed in same JVM. Can Local interfaces only be applicable to Bean - Bean relation ship?If LocalHome/Local interfaces can be implemented in my scenario, then may I know how will be the ejb-jar.xml and weblogic-ejb-jar.xml?
    thanks and regards,
    Venkat.

    Local interfaces are for communication between ejbs and their clients when both are in the same JVM. The clients can be normal clients, jsps, servlets, and other ejbs. If the client is not in the same JVM you cannot use local interfaces even though your client is another ejb.
    Advantage of using local interface is it reduces the network overhead.
    For more information you can download Mastering Enterprise Java Beans Third Edition by Ed Roman. You can go through 45
    You can download pdf version from.
    http://www.theserverside.com/books/wiley/masteringEJB/index.tss.
    Let me know the URL of the ejb doc that you referred.
    Thanks..

  • ejb-local-ref where to put this tag in ejb-jar.xml ??

    I have an ejb-jar.xml that looks like this. I have had no problem with remote interfaces. Now I want the bean to have a local interface too.
    Just let me know where the tag I have mentioned for the <ejb-local-ref> has to be put into.
    When I compile this file it throws me an error which i have shown below the output of the ejb-jar.xml file
    <ejb-jar>
    <enterprise-beans>
    <entity>
    <ejb-name>IDMaster</ejb-name>
    <home>maxateev.mondial.brg.idmaster.IDMasterHome</home>
    <remote>maxateev.mondial.brg.idmaster.IDMaster</remote>
    <local-home>maxateev.mondial.brg.idmaster.IDMasterLocalHome</local-home>
    <local>maxateev.mondial.brg.idmaster.IDMasterLocal</local>
    <ejb-class>maxateev.mondial.brg.idmaster.IDMasterEJB</ejb-class>
    <persistence-type>Container</persistence-type>
    <ejb-local-ref>
    <ejb-ref-name>ejb/IDMasterLocalHome</ejb-ref-name>
    <ejb-ref-type>Entity</ejb-ref-type>
    <local-home>maxateev.mondial.brg.idmaster.IDMasterLocalHome</local-home>
    <local>maxateev.mondial.brg.idmaster.IDMasterLocal</local>
    </ejb-local-ref>
    <prim-key-class>java.lang.String</prim-key-class>
    <reentrant>False</reentrant>
    <cmp-version>2.x</cmp-version>
    <abstract-schema-name>IDMaster</abstract-schema-name>
    <cmp-field>
    <field-name>idPrefix</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>idValue</field-name>
    </cmp-field>
    <primkey-field>idPrefix</primkey-field>
    <query>
         <query-method>
              <method-name>findAllIDMasters</method-name>
              <method-params/>
         </query-method>
         <ejb-ql><![CDATA[SELECT OBJECT (f) FROM IDMaster as f]]></ejb-ql>
    </query>
    </entity>
    </enterprise-beans>
    <assembly-descriptor>
    <container-transaction>
    <method>
    <ejb-name>IDMaster</ejb-name>
         <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    </assembly-descriptor>
    </ejb-jar>
    I have also added the following tag in the weblogic-jar.xml
    <local-jndi-name>IDMasterEJB.IDMasterLocalHome</local-jndi-name>
    Just let me know whether I am correct
    On compilation (using ant utility) the error thrown is like this :
    ejbc:
    [java] ERROR: Error parsing 'ejb-jar.xml' line 47: The content of element type "entity" must ma
    tch "(description?,display-name?,small-icon?,large-icon?,ejb-name,home?,remote?,local-home?,local?,e
    jb-class,persistence-type,prim-key-class,reentrant,cmp-version?,abstract-schema-name?,cmp-field*,pri
    mkey-field?,env-entry*,ejb-ref*,ejb-local-ref*,security-role-ref*,security-identity?,resource-ref*,r
    esource-env-ref*,query*)".
    [java] ERROR: ejbc found errors
    [java] Java Result: 1
    Kindly Help !!!
    Thanks n regards
    Sajiv

    This should take care of it
    <ejb-jar>
    <enterprise-beans>
    <entity>
    <ejb-name>IDMaster</ejb-name>
    <home>maxateev.mondial.brg.idmaster.IDMasterHome</home>
    <remote>maxateev.mondial.brg.idmaster.IDMaster</remote>
    <local-home>maxateev.mondial.brg.idmaster.IDMasterLocalHome</local-home>
    <local>maxateev.mondial.brg.idmaster.IDMasterLocal</local>
    <ejb-class>maxateev.mondial.brg.idmaster.IDMasterEJB</ejb-class>
    <persistence-type>Container</persistence-type>
    <ejb-local-ref>
    <ejb-ref-name>ejb/IDMasterLocalHome</ejb-ref-name>
    <ejb-ref-type>Entity</ejb-ref-type>
    <local-home>maxateev.mondial.brg.idmaster.IDMasterLocalHome</local-home>
    <local>maxateev.mondial.brg.idmaster.IDMasterLocal</local>
    </ejb-local-ref>
    <prim-key-class>java.lang.String</prim-key-class>
    <reentrant>False</reentrant>
    <cmp-version>2.x</cmp-version>
    <abstract-schema-name>IDMaster</abstract-schema-name>
    <cmp-field>
    <field-name>idPrefix</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>idValue</field-name>
    </cmp-field>
    <primkey-field>idPrefix</primkey-field>
    <ejb-local-ref>
    <ejb-ref-name>ejb/IDMasterLocalHome</ejb-ref-name>
    <ejb-ref-type>Entity</ejb-ref-type>
    <local-home>maxateev.mondial.brg.idmaster.IDMasterLocalHome</local-home>
    <local>maxateev.mondial.brg.idmaster.IDMasterLocal</local>
    </ejb-local-ref>
    <query>
    <query-method>
    <method-name>findAllIDMasters</method-name>
    <method-params/>
    </query-method>
    <ejb-ql><![CDATA[SELECT OBJECT (f) FROM IDMaster as f]]></ejb-ql>
    </query>
    </entity>
    </enterprise-beans>
    <assembly-descriptor>
    <container-transaction>
    <method>
    <ejb-name>IDMaster</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    </assembly-descriptor>
    </ejb-jar>

  • Ejb-ref element references to other beans

    Hello,
    Can anyone tell me what ejb references to other beans are for? (ejb-ref element).
    I am completely missing the point and would be grateful if someone could tell me why I should have the overhead of writing this:
    <ejb-ref>
    <ejb-ref-name>ejb/waUserMgr</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <home>com.reuters.pds.webapp.bl.user.api.WAUserMgrHome</home>
    <remote>com.reuters.pds.webapp.bl.user.api.WAUserMgr</remote>
    <ejb-link>WAUserMgrEJB</ejb-link>
    </ejb-ref>
    Any comment welcome..
    Julien.

    Hi,
    The <ejb-ref> element is optional, you could use the actual JNDI name instead.
    The advantage with using <ejb-ref> is that, if you deploy the bean on another server, probably with a different JNDI name,
    your code can still continue using the same name as defined by <ejb-ref-name>.
    Internally, the <ejb-ref-name> will be mapped to the actual JNDI location, maybe using symbolic links.

  • Does mapping to JNDI for ejb-refs have a performance impact?

    Does mapping to JNDI names for ejb-refs have a performance impact for
    WLS6.1?
    In the ejb-jar.xml deployment descriptor, you can define an ejb reference as
    follows:
    <ejb-ref>
    <ejb-ref-name>ejb/AccountHomeRemote</ejb-ref-name>
    <ejb-ref-type>Entity</ejb-ref-type>
    <home>com.package structure.AccountHomeRemote</home>
    <remote>com.package structure.AccountRemote</remote>
    <!-- <ejb-link>AccountBean</ejb-link>-->
    </ejb-ref>
    Now, optionally, you can use the ejb-link element - or - you can, in the
    weblogic DD, specify a JNDI name that the ejb-ref maps to.
    Using a JNDI name buys you some flexibility. If, for some reason, the jar is
    divided, you dont have to convert ejb-link's to JNDI names. The question is:
    Is there a performance cost in doing this?
    Cheers

    Hi Aashish,
    Thanks for your quick reply. it was helpful, but i am not using RFC's. Correct me if i am wrong, but i have explained the scenarios in detail below.
    Scenario 1. Synchronous
    1) PI Picks file from a common folder.
    2) PI does a data mapping and sends the data to ECC.
    3) ECC contains an inbound interface which receives the data and in which abap proxy code is written.
    4) The abap proxy code executes a function module and sends the response as an internal table back to PI.
    5) PI receives the response and places it in a text/csv file and places it back to another folder.
    I assume that the above would be possible only using BPM. What i understand is that in order for an interface to receive and send data, abstract mappings are to be used, and for this BPM is required. We do not have any conversions etc. its just a simple matter of receiving an internal table from ECC and creating a file to place in the folder.
    I also understand that BPM could have bottlenecks due to queue and cache issues, messages might be pending, or lost etc.
    Scenario 2. Asynchronous
    1) PI Picks file from a common folder.
    2) PI does a data mapping and sends the data to ECC.
    3) ECC contains an inbound interface which receives the data and in which abap proxy code is written.
    4) ABAP Proxy code executes the same function module and calls a seperate outbound interface and passes the values to it. This would be used in sending the response back.
    5)  PI receives the response from the second interface and places it in a text/csv file and places it back to another folder.
    I would like to know which would be the better approach. Documentation/references to support your claims would be much appreciated.
    Cheers,
    Mz

  • Question about using ejb remote home vs ejb reference

    hi guys
    i am new to EJB and want to understand the difference between these two. i notice that the ejb reference is declared in the ejb-jar.xml so that the calling ejb can get the home object by using
    initCtx.lookup("java:comp/env/ejb/CabinHome");which is declared in
    <ejb-ref>
      <description>Cruise ship cabin</description>
      <ejb-ref-name>ejb/CabinHome</ejb-ref-name>
      <ejb-ref-type>Entity</ejb-ref-type>
      <home>com.titan.cabin.CabinHome</home>
      <remote>com.titan.cabin.Cabin</remote>
      <ejb-link>CabinBean</ejb-link>
    </ejb-ref>how does this differ from using the JNDI to get the home interface. which one is preferred?
    thanks for your help.

    Right, portable Java EE applications always access resources via their component environment rather than doing a direct global JNDI lookup. Declaring the ejb dependency provides a level of indirection that allows it to be mapped to the appropriate target ejb in each application server without requiring any code changes. The same principle is used for other kinds of component dependencies such as data sources, queues, etc.
    The downside to this in J2EE 1.4 and earlier was the overhead/complexity of declaring the ejb-ref/ejb-local-ref in the deployment descriptor. Java EE 5 improves this by introducing environment annotations such as @EJB that make it easy to declare the dependencies. In Java EE 5, @EJB is equivalent to ejb-ref/ejb-local-ref but doesn't require the use of .xml.
    The bottom line is if you're writing code that's running within a Java EE component, always access Java EE resources/dependencies through your component environment or use an environment annotation.
    --ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Using ejb ref

    Hi !
    I made an Entity bean for a master table, make its local interfaces and deploy it in a seperate jar.
    Then i want to call this Entity bean thru any session bean using local interfaces and this session bean
    is in a seperate jar file.
    Right now its not working - i heard it can be used using <ejb-ref> tag.
    Can anyone tell me what all entries do i need to make for this :
    Do i need to write some code also for ti or only entries in deployment descriptor files will do ?
    and what all entries do i need to make in deplyment descriptors or entity and deployment descriptors of session beans.
    If somone has sample code then do please send across...
    Thanks in advance !!

    I tried the thing :
    I made an Entity Bean and a session bean in seperate jar files
    The ejb-ref entries in session beans deployment descriptor files are ::
    <ejb-local-ref>
         <ejb-ref-name>ejb/EmpLocal</ejb-ref-name>
         <ejb-ref-type>Entity</ejb-ref-type>
         <local-home>EmpHomeLocal</local-home>
         <local>EmpLocal</local>
    </ejb-local-ref>
    Now, the code in session bean from where i am calling Entity bean is ::
    InitialContext initialcontext = new InitialContext();
    System.out.println("Initial Context created ");
    home = (EmpHomeLocal)initialcontext.lookup("java:comp/env/EmpLocal");
    System.out.println("After getting Local Home");
    But its giving me the following error in Session Bean
    Initial Context created
    java.lang.ClassCastException: EmpEJB_1huw_LocalHomeImpl
    Can, anyone help me to call an Entity bean's local methods from a Session bean - bith in seperate jar files

  • Have to ask again:when to use ejb-ref ?

    hi, I asked this last week but nobody answered it.
    i am really curious about it and i checked some docs it said " it is useful
    coz beans can look each other up without needing to initialize JNDI to any
    particular driver".
    i wonder what means particular driver and when there will be great
    difference between using and not using.
    thanx in advance
    Ciao,
    zhxt

    In WLS you can have either global JNDI names that are visible throughout
    the server or JNDI names that are local to your application.
    The recommended best practice these days is to use ejb-refs and/or
    ejb-links to lookup your EJBs. For local EJBs, you don't need to have a
    global JNDI name since they are not visible to other applications.
    -- Rob
    scratchback wrote:
    hi, I asked this last week but nobody answered it.
    i am really curious about it and i checked some docs it said " it is useful
    coz beans can look each other up without needing to initialize JNDI to any
    particular driver".
    i wonder what means particular driver and when there will be great
    difference between using and not using.
    thanx in advance
    Ciao,
    zhxt

  • When to use ejb-ref?

    if i do not write <ejb-ref> in ejb-jar.xml,what will happen?the application
    can not run or performance is low?
    and is there any difference between bmp and cmp?i mean "does cmp need
    <ejb-ref>?"
    Ciao,
    zhxt

    In WLS you can have either global JNDI names that are visible throughout
    the server or JNDI names that are local to your application.
    The recommended best practice these days is to use ejb-refs and/or
    ejb-links to lookup your EJBs. For local EJBs, you don't need to have a
    global JNDI name since they are not visible to other applications.
    -- Rob
    scratchback wrote:
    hi, I asked this last week but nobody answered it.
    i am really curious about it and i checked some docs it said " it is useful
    coz beans can look each other up without needing to initialize JNDI to any
    particular driver".
    i wonder what means particular driver and when there will be great
    difference between using and not using.
    thanx in advance
    Ciao,
    zhxt

Maybe you are looking for