HELP!!! How I can call to EJB from another EJB??

I have two EJBs, for each EJB I have a jar, how I can call to EJB jar to another???
I have tried the following, in the first EJB I have import the second EJB jar and call it with context, lookup, PortableRemoteObject etc.. but the instruction lookup not find the second EJB reference.
The name in the lookup instruction is the JNDI name of the second EJB but not find a reference to it.
Please help me!!! Thanks!!
The error is:
javax.naming.NameNotFoundException: Missing node. Root exception is org.omg.CosNaming.NamingContextPackage.NotFound
     at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(NotFoundHelper.java:34)
     at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.extract(NotFoundHelper.java:50)
     at org.omg.CosNaming._NamingContextStub.resolve(_NamingContextStub.java:161)
     at com.inprise.j2ee.jndi.java.CorbaContext.resolveName(CorbaContext.java:242)
     at com.inprise.j2ee.jndi.java.CorbaContext.lookup(CorbaContext.java:261)
     at com.inprise.j2ee.jndi.java.javaContext.internal_lookup(javaContext.java:483)
     at com.inprise.j2ee.jndi.java.javaContext.internal_lookup(javaContext.java:493)
     at com.inprise.j2ee.jndi.java.javaContext.internal_lookup(javaContext.java:493)
     at com.inprise.j2ee.jndi.java.javaContext.lookup(javaContext.java:937)
     at com.inprise.j2ee.jndi.java.javaContext.lookup(javaContext.java:942)
     at javax.naming.InitialContext.lookup(InitialContext.java:350)
     at ejbclient.EnterpriseClientBean.addition(EnterpriseClientBean.java:115)
     at ejbclient.EnterpriseClientBean.actionPerformed(EnterpriseClientBean.java:97)
     at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1450)
     at avax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Abstr

ok.. Here it goes.. I am writing a sample code..
public class EJB1LogBean implements SessionBean {
// test is a method of stateless session beam
public void test ( TestVal val )
throws RemoteException{
try {
EJB2LogHome ejb2Home= (EJB2LogHome)getHome("java:comp/env/ejb/EJB2LogHome",1);
EJB2Log ejb2Log = ejb2LogHome.create ( val );
} catch ( CreateException e ) {
     System.out.println("Create Exception occurred ");
     e.printStackTrace();
     } catch ( RemoteException e ) {
     System.out.println( "RemoteException Occured");
e.printStackTrace();
     throw new RemoteException () ;
     } catch(Exception ee) {
ee.printStackTrace();
private EJBHome getHome(String jndiName,int type) {
try {
Context context = new InitialContext();
Object ref = context.lookup( jndiName );
switch(type)
case 1:
EJB2LogHome ejb2LogHome = ( EJB2LogHome )
PortableRemoteObject.narrow( ref, EJB2LogHome.class );
return ejb2LogHome;
} catch ( Exception e ) {
e.printStackTrace();
return null;
}//EJB1LogBean ends
Here as you can see, EJB1LogBean(session bean) is calling a second EJB, EJB2LogBean (entity bean). TestVal is a sample value object passed. It is plain java class and can vary from app to app and it has got nothing to do with ejbs.
"java:comp/env/ejb" is a J2EE standard and while getting a home interface, you have to append the home interface class name to "java:comp/env/ejb". Here I am passing "java:comp/env/ejb/EJB2LogHome" and "1" to getHome method, whose job is to get a reference to a home interface. getHome method is a local method. "1" is passed just to give a flexibility to getHome method as you can have more ejbs to invoked. In that case, you can go on adding different case statements for 2, 3 etc.
The only thing you have to keep in mind is that your deployment descriptor for EJB1LogBean will contain the entires for both the beans i.e. for EJB1LogBean and EJB2LogBean. This is because EJB2LogBean is wrapped by EJB1LogBean.
Hope this helps.
Please let me know if you need anything more.
- Amit

Similar Messages

  • How do you call a method from  another class without extending as a parent?

    How do you call a method from another class without extending it as a parent? Is this possible?

    Why don't you just create an instance of the class?
    Car c = new Car();
    c.drive("fast");The drive method is in the car class, but as long as the method is public, you can use it anywhere.
    Is that what you were asking or am I totally misunderstanding your question?
    Jen

  • How do i call a Function from another Function ?

    When i press a button, i want a series of functions to execute one after another (they contain tweens, but its irrelevant), each of them waiting for the previous to be completed. I want to put the series of functions inside one function, so i can call just this function to execute all the others. The animations are working fine, but i dont know how call Functions from within another function. Also it would be necessary each function to wait until the previous has completed, to execute. Here is a clear example of what i need to do:
    boton.onPress = animate ;
    Function animate () {
         animation1 (onComplete: animation2);
         animation2 (onComplete: animation3);
         animation3 ;
    Function animation1 () { Tween 1};
    Function animation2 () { Tween 2};
    Function animation3 () { Tween 3};
    any suggestions ?

    I'd do something like this:
    boton.onPress = animation1 ;
    Function animation1 () {
         var Tween1 = new Tween();
        Tween1.onComplete =  animation2;
    Function animation2 () {
         var Tween2 = new Tween();
         Tween2.onComplete = animation3;
    Function animation3 () {
         var Tween3 = new Tween();

  • How do I call a function from another file?

    In MainView.m I have one function -(void)goTell;
    I want to be able to call the function from SecondView.m. How do I do this?
    I have declared the function in the MainView.h and added #include MainView.h to SecondView.m, but it still doesn't work.
    This code crashes my program (for some reason this board takes away my brackets... assume the code is written correctly):
    [[MainView alloc] init];
    MainView *myMainView;
    [myMainView goTell];
    By the way... goTell has nothing in it. It's just a blank function for testing purposes.
    Ethan

    BTW - Wrap your code like this in posts tags so it stay readable.
    put code here
    Your code needs to be:
    MainView *myMainView = [[MainView alloc] init];
    [MyMainView goTell];

  • How a to call a form from another form when the button is pressed

    Hi All
    I working with oracle apps r12
    I have develop a new form and attached into a special menu here i have two button
    When i click a button i need to call my new form.
    I have tried so far is
    I have write a trigger in that button when button pressed
    open_form('Form_name',Activate)
    regards
    Srikkanth
    Edited by: Srikkanth.M on Aug 18, 2011 7:06 PM

    Can you not use zoom functionality ?
    How to Zoom or Create Master-Details relationship Using Forms Personalization? (Doc ID 457643.1)
    HTH
    Srini

  • How to call a BSP from another BSP?

    Hi All,
    I've created a BSP for hiring new employees.  I have a situation whereby when the user presses a button a pop window will be displayed listing all the positions in the company.  The user selects the correct position, which then populates an input box on the originating page and the pop up window closes.
    This pop up window is a page in another bsp which goes off and gets the positions and stores the selection in a cookie.
    Now my problem is how do i call this 'get postions' bsp from my originating bsp?
    I've tried using the <%@ include file="/sap/bc/bsp/sap/z_hr_org_model"%> but i get the error only page fragments can be included.
    So how do i call one bsp from another??
    Any help would be much appreciated,
    Kind Regards,
    Liz.

    Look at the below [link|http://****************/Tutorials/BSP/F4Help/Tutorial.htm]
    The only difference in your case is, you need to call the popup from different BSP Application.
    To do that, just add the full path when you call the document.open..
    For example,
    document.open("/sap/bc/bsp/sap/z_hr_org_model/main.do", ............)
    Raja

  • How to call one .SWF from another?

    How do I call one .SWF from another. I built a very beefy
    base .SWF, and want to add music overlay, and an intro slide show
    to the exsting Flash animation, but put it in a second .FLA/.SWF
    file. How do I call one from the other?
    This will be embedded in an HTML file but I assume this is
    superfluous to my question.
    F.Z.

    I think you should open that Another SWF (FLA),
    and add some actionscript..
    For example, you could create a movie clip, and write
    actionscript in the
    first keyframe:
    loadMovie("
    http://www.somewebpage.com/movie.swf",
    this);
    "FredZimmerman" <[email protected]> wrote in
    message
    news:ftnjas$mj5$[email protected]..
    > How do I call one .SWF from another. I built a very
    beefy base .SWF, and
    > want
    > to add music overlay, and an intro slide show to the
    exsting Flash
    > animation,
    > but put it in a second .FLA/.SWF file. How do I call one
    from the other?
    >
    > This will be embedded in an HTML file but I assume this
    is superfluous to
    > my
    > question.
    >
    > F.Z.
    >

  • I lost my I phone how can I track it from another I phone

    I lost my I phone how I can I find it from another I phone

    IF you set up the find my iphone feature on your iphone, then you can search for it from the Find my iphone app on another iphone.  Sign into your account and see if it can locate it.
    IF you did not set upt the find my iphone feature on the iphone, then you cannot track it.

  • Calling repaint method from another class

    My question in a very simple form :
    how do I call repaint mathod from another class.
    e.g: Let's say class "A.java" is a JFrame .
    Class "B.java" is a JPanel which is added to the JFrame above.
    Class "C.java" is a JDialog containing some JButtons.
    How do I call the repaint method from the class "C.java".
    Thank you in advance!!

    My question in a very simple form :
    how do I call repaint mathod from another class.
    e.g: Let's say class "A.java" is a JFrame .
    Class "B.java" is a JPanel which is added to the JFrame above.
    Class "C.java" is a JDialog containing some JButtons.
    How do I call the repaint method from the class "C.java".
    Thank you in advance!!

  • New iphone 6 with ios 8.0 crushed and didnt open again. call center told me that use itunes to update 8.0.2 but server is too slow and didnt let me download it. it stopts in the middle of the session. how can i download it from another link or server

    new iphone 6 with ios 8.0 crushed and didnt open again. call center told me that use itunes to update 8.0.2 but server is too slow and didnt let me download it. it stopts in the middle of the session. how can i download it from another link or server. by the way i try to dowload from turkey.

    anyone help me there? )=

  • I can call my iphone from my imac but the accept screen disappears when receiving a call to my imac, therefore I can not receive a call placed to my imac,, help!

    I can call my iphone from my imac but the accept screen disappears when receiving a call to my imac, therefore I can not receive a call placed to my imac,, help!

    Hi,
    I also have a similar issue since upgrading from the 4s to the 5s.
    The issue I have is, issue number 2:" If I do receive a text message/iMessage notification, it disappears within 5-10 minutes before I can even check (no other notifications disappear)"
    Which also consists of the same events in the last message from monicash "So for example, if i get a text while sleeping... i wake up in the morning to check my notifications and there is nothing there because it disappeared (even though there should be a notification there with my current settings that are ON)."

  • Help on Calling a method from another class

    how can i call a method from another class.
    Class A has 3 methods
    i just want to call only one of these 3 methods into my another class.
    How can I do that.

    When i am trying this
    A a=new A;
    Its calling all the methods from class A. I just want
    to call a specfic method.How can it be done?When i am trying this
    A a=new A();
    Its calling all the methods from class A. I just want to call a specfic method.How can it be done?

  • How i can extract spacial coodinates from a picture

    hi all,
    how i can extract  spacial coodinates from a picture.

    Hi,
    Could you elaborate a bit on what you mean by extracting the spatial coordinates? Also what development environmet are you working in? 
    Here are a few resources that may be helpful:
    Choosing a Calibration Type:
    http://zone.ni.com/reference/en-XX/help/370281W-01/nivisionlvbasics/choose_a_calibration_type/
    Calibration:
    http://zone.ni.com/reference/en-XX/help/370281W-01/imaqvision/calibration_pal/
    Spatial Calibration:
    http://zone.ni.com/reference/en-XX/help/372916P-01/TOC4.htm
    I hope this information helps!
    Kale W. 
    Applications Engineer
    National Instruments
    http://www.ni.com/support

  • HT5463 how i can block particular number from my contacts list

    how i can block particular number from my contacts list please guide me because even true caller software is also not supporting iphone

    As Ocean20 said, there is no official function that does this built in. What you could do however is to find an app that mute calls that come from "blocked" numbers.

  • How can i copy songs from another library to my itunes library with homesharing?

    How can i copy songs from another library to my itunes library with homesharing?  I see the other libraries, but cannot drag the songs into my library.  The help window says to use the "show menu" at the bottom, but I don't have that menu with itunes 11.

    You can do this in 2 ways.
    1) You can enable the sidebar and you can drag and drop like you used to be able to.  To turn on Sidebar in iTunes 11, go to View > Show Sidebar
    2) Another way is to connect to your Home Share from the drop-down menu from the left (where it says Music) and select your Home Share.  Once you are connected to your Home Share, select Music and you should see a button that says "All Items" and on the right, you should see the Import button.  To copy, select the songs you want to import and then click on Import.

Maybe you are looking for

  • How to submit a html form using java

    hi friends, i have a html form with some input fields, when ever a user submit the form the user information is stored in the database. is it possible to pass the user information in the url(url rewriting) and submit it by a java program so that the

  • SAP Query-to be saved on Easy access menu

    Dear All, This is regarding the SAP Query that I have created on Production. Pls help me out with the way to save it on sap easy access menu. At the moment, i have saved the t-code SQ01 in Favorites but it is not serving the purpose because everytime

  • TS1398 can you change the connection order in iOS for known networks

    Is it possible to change the order of preference for known Wifi networks. When I turn on Wifi at home it selects the BT fon connection not the private network connection because the Fon connection was set up after the private network. This gets annoy

  • MySQL Timestamp

    Greetings again. MySQL's manual states that whenever a row is updated and/or inserted in a table with a timestamp column, the timestamp will update automatically to the current time. However, when I attempt to update a row from the program created wi

  • Adobe Fireworks cs6 is not opening .Saying internal eror occured  help me please

    Adobe Fireworks cs6 is not opening .Saying internal eror occured  help me please :