How to call EJB from another EJB which is in another JAR file


EJB design: How to call EJB from another EJB which is in another JAR file

  1. I have trouble in calling EJB from another EJB.I develop them using JBuilder4 and IAS4.1.
    Please give explicit instruction to help me to fix that problems.

    Threaded Messages (15)

  2. use ejb reference link u can call another bean.
    either u specify in u r Xml discriptor or if u r with weblogic server ther is option in deployer tool for the same.
  3. I want to call a EJB in a servlet or JSP or another EJB, but if I don't bind these file(EJB,Session Bean,servlet) into a jar ,I can't lookup the EJB's JNDI name in servlet or JSP . The 'ejb reference link' you meaning is the EJB References defining in JBuilder 4 ,EJB DD Editor ->EJB References ? And I call the EJB by look up the homeName:"java:comp/env/ejb/your_ejb_refrence_name",right?
  4. JNDI is a keyword here. You must have JARs deployed and keep JNDI alive on your container (or containers).

    Greetings, Alex.
  5. I try to use ejb reference like Manoj said.However,do I need import the JAR files to my project?
    If I donot import the JAR files in my EJB file,
    when I compile the project, I will get many compiling errors.
    Could you show me some example codes.
  6. You must DEPLOY it! Not import or export. Just deploy. Run deploy tool of your appserver.

  7. If I donot import another EJB,I can not compile the project,then how can I call the EJB's methods from another EJBs.
  8. Ah, got your problem!

    You need to have stubs and home and remote interface classes for EJBs you call in your original JARs.
  9. How can I get stub jar files in JBuilder4?
    JBuilder4 produces not stub jar files,but class files.
    Could you give me some instruction?

  10. HI there
    first thing there are lot of confusion is going
    i wanted to know some very minute answers from you
    1)wether IAS 4.1 server gerates the xml discriptor for u ?
    2)what kind of JNDI server is avilebale with IAS4.1

    if possibel send me a code or free feel to contact me
    s dot manoj at zensar dot com
  11. Ok, the fact is given below.
    1>The xml descriptor files are generated in JBuilder4 when
    we write EJBs.
    2>IAS4.1 uses visinaming as service of JNDI.

    The EJBs are packaged in different JAR files, per EJB in one JAR file. I must call EJBs' methods from other EJBs.
    I try to solve the problem according several persons' advice. But they seem to not work.
    I will mail my code to you.

  12. When you start Deployment wizard for a JAR - it automatically generates stubs. The stubs ARE class files that have such keywords in their names as "Stub", "POA", "Helper", "Operations", "Holder", "InvokeHandler", "POATie"...

    They are provide IIOP-RMI compliance.
  13. I find these class files,such as _Acl_Stub.class and _AclHome_Stub.class and so on, then I add these files into JAR,however,when we deploy it,IAS4.1 says NoClassfoundException which mean the EJB home cannot found.
    After receiving the Exception mentioned above, I add these class files to my project. This time, JBuilder4 says NoClassFoundException.
    What can I do?
  14. Hi there
    its a commom problem of class path check the classpath.
  15. Hi,Manoj:thx
    But when I compile the project, there are no errors arising,
    But when I deploy it, deploy tool says ClassNotFoundException. When I debug the project in JBuilder4, the program throws a javax.naming.NameNotFoundException: Missing node. Root exception is org.omg.CosNaming.NamingContextPackage.NotFound
    just at ctx.Lookup("name").
    so I think it maybe not due to CLASSPATH.

  16. I think your JNDI name doesnot match the name in the DD.
    There can be a problem with the "Name of the Bean used" to bind with the Bean.