EJB lookup from another EJB server

Hi people,
I have two application servers on two different computers. One
of them contains an EJB, which I need to access from another EJB
server. I know that I can achieve this using RMI, but will then
security and transaction contexts be propagated to the called
EJB?
Sincerely,
Sergei Batiuk.

Here is the solution posted on another forum:
[email protected] Dec 8, 6:03 am show options
Newsgroups: ibm.software.websphere.studio
From: [email protected]
Date: 8 Dec 2004 06:03:04 -0800
Local: Wed, Dec 8 2004 6:03 am
Subject: Re: EJB lookup on from one server to another does not work
Eric,
I dealt with this same problem trying to run 2 local servers (websphere
test servers), using 2 separate WSAD 5.1.2 workspaces. Running on 1
server I have an application that contains an EJB, and running on the
other server is an application that uses an access bean to make a
remote call to my EJB, running on my other server. I too repeately
received the "NameNotFoundException" when trying to lookup my EJB home
reference.
What you have to do to get around this is to modify the server
configuration of the application that contains the EJB that you are
attempting to call remotely. You must open the the server.wsi file for
the server that is running the EJB and go to the "Configuration" tab.
You must check the "Enable administrative console". Once this is
complete, start your server. When it is started, right click on the
server, and select "run administrative console". In the admin console,
select
servers -> application servers -> <your server> -> end points ->
bootstrap address. For "host" you must change "localhost" to either
your ip address or computer name (ive only tried my ip, but your
computer name should work too). When building your properties to get
the initial context, make sure you use
"env.put(Context.PROVIDER_URL, "corbaloc:iiop:<the ip or computer name
listed as the bootstrap host of server running ejb>:<the port listed as
the bootstrap port of server running ejb, which is 2809 in your case>
Restart your server and things should work.

Similar Messages

  • Calling EJB from another EJB

    I need to make a several calls to the methods inside EJB1 from EJB2. I was getting
    the remote reference of the EJB2 inside the ejbCreate() of the EJB1, is it a good
    practice ?? If not, do I need to get remote reference of the EJB2 every time I
    need to call EJB2 method??
    Thanks in advance.

    To refer a Ejb from another Ejb include <ejb-ref> in ejb-jar.xml
    <session>
    <ejb-name>Ejb1</ejb-name>
    <ejb-ref>
    <ejb-ref-name>Ejb2</ejb-ref-name>
    <ejb-ref-type>Entity</ejb-ref-type>
    <home>com.ejb.Ejb2Home</home>
    <remote>com.ejb.Ejb2</remote>
    </ejb-ref>
    <session>
    Include a <reference-discriptor> in weblogic-ejb-jar.xml
    <weblogic-enterprise-bean>
    <ejb-name>EjbSession</ejb-name>
    <reference-descriptor>
    <ejb-reference-description>
    <ejb-ref-name>Ejb2</ejb-ref-name>
    <jndi-name>com.ejb.Ejb2Home</jndi-name>
    </ejb-reference-description>
    </reference-descriptor>
    </weblogic-enterprise-bean>
    In Ejb1 bean class refer to Ejb2 method with a remote reference to Ejb2.
    InitialContext initialContext = new InitialContext();
    Ejb2Home ejb2Home = (Ejb2Home)initialContext.lookup("com.ejb.Ejb2Home");
    Ejb2 ejb2 = ejb2Home.findByPrimaryKey();
    Alex Pratt wrote:
    I need to make a several calls to the methods inside EJB1 from EJB2. I was getting
    the remote reference of the EJB2 inside the ejbCreate() of the EJB1, is it a good
    practice ?? If not, do I need to get remote reference of the EJB2 every time I
    need to call EJB2 method??
    Thanks in advance.

  • Error in calling an EJB from another EJB

    Hello All,
    I have a scenario where i need to call a method of an ejb from another ejb.
    Both the EJB's are in different DC's.
    EG: DC1 using DC2
    I have added the public part of DC2 in DC1.
    The following code is written in DC1 to access the EJB of DC2
          MyRemote l_remote;
           MyHome l_home;
           InitialContext l_ctx = new InitialContext();
    >>       l_home = (MyHome)l_ctx.lookup("JNDI Name");
           l_remote = (MyRemote)l_home.create();
    There is no error at build time and deploy time, but at run time "MyHome" class is not found.
    Even i am not able to access the helper class defined in the DC2 at runtime.
    Please help.
    Thanks in Advance

    First off, wrong forum section.
    Check if your JNDI name is correctly placed for the bean you're calling -- check j2ee-engine.xml for that. Check the EJB container if the ear file you deployed is there and updated.
    Try placing  "localejbs/JNDI name" on your lookup parameter.
    Regards,
    Jan

  • HT3678 If I download a .mov file from gmail, I am not able to open the file. I reinstalled QuickTime 7.6.6, still unable to open the file. If I download the same file from another mail server I have no trouble. What is gmail doing to my file?

    If I download a .mov file from gmail, I am not able to open the file. I reinstalled QuickTime 7.6.6, still unable to open the file. If I download the same file from another mail server I have no trouble. What is gmail doing to my file?

    Also i have reinstalled the reader9 two  times and tried with reader8 also but in both the cases same problem.
    it would be gr8 help if someone can help.

  • Issue in executing an application from another remote server

    Hi Experts,
    I have an application on one of the remote server which is running on Windows Server 2003.
    I would like to execute this application from another remote server (also running on Windows Server 2003). I am able to browse the application path using "\\", but when double clicking on the application
    gives "you may not have appropriate permission to access the item"
    How do I set the permission & what permission is required?
    Please anybody can explain?
    Thanks in advance.
    Regards,
    Naveen J V

    Is this a single exe file, or is it part of an installed application with exe, dlls, registery settings, etc?
    If this is an installed application, you cannot run it like this. That would be like trying to start microsoft office which is installed on a different computer.

  • RMAN backup from another DB server

    Hi all,
    I would like to know Can we take a rman backup from another DB server in oracle 9.2...
    i.e
    suppose that we have two server
    1. main server
    2. dup server
    I want to take a backup of main server throeugh dup server.....
    if it is poosible then what are all the things that i have to configure....
    pls suggest me.....

    getting an error,
    here hotest is the main db
    and testho is dup db
    F:\Documents and Settings\deepali>rman target rman/cat@hotest catalog rman/cat@testho
    Recovery Manager: Release 9.2.0.4.0 - Production
    Copyright (c) 1995, 2002, Oracle Corporation.  All rights reserved.
    connected to target database: HOTEST (DBID=982176707)
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-00554: initialization of internal recovery manager package failed
    RMAN-04004: error from recovery catalog database: ORA-01045: user RMAN lacks CRE
    ATE SESSION privilege; logon denied
    F:\Documents and Settings\deepali>sqlplus /nolog
    SQL*Plus: Release 9.2.0.4.0 - Production on Mon Apr 6 12:17:13 2009
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    SQL> conn sys/deepali as sysdba
    Connected.
    SQL>  GRANT RECOVERY_CATALOG_OWNER TO rman;
    Grant succeeded.
    SQL> GRANT CONNECT, RESOURCE TO rman;
    Grant succeeded.
    SQL> exit
    Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.4.0 - Production
    F:\Documents and Settings\deepali>rman target rman/cat@hotest catalog rman/cat@t
    estho
    Recovery Manager: Release 9.2.0.4.0 - Production
    Copyright (c) 1995, 2002, Oracle Corporation.  All rights reserved.
    connected to target database: HOTEST (DBID=982176707)
    connected to recovery catalog database
    recovery catalog is not installed
    RMAN> register database;
    recovery catalog is not installed
    recovery catalog is not installed
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of register command at 04/06/2009 12:18:09
    RMAN-06429: RCVCAT database is not compatible with this version of RMAN
    RMAN> select * from rc_database;
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-00558: error encountered while parsing input commands
    RMAN-01005: syntax error: found "identifier": expecting one of: "allocate, alter
    , backup, beginline, blockrecover, catalog, change, connect, copy, create, cross
    check, configure, duplicate, debug, delete, drop, exit, endinline, host, {, libr
    ary, list, mount, open, print, quit, recover, register, release, replace, report
    , renormalize, reset, restore, resync, rman, run, rpctest, set, setlimit, sql, s
    pool, startup, shutdown, send, show, test, upgrade, validate"
    RMAN-01008: the bad identifier was: select
    RMAN-01007: at line 1 column 1 file: standard input
    RMAN>pls suggest me whether i am following the right path or not...

  • Creating Ejb link to another Weblogic server

    I am trying to create a EJB jndi link to another weblogic server from a weblogic
    server.
    Basically I have a web application that uses an EJB that is deploed on another
    weblogic server and I would like to connect to it.
    One way I can do is the remote lookup using the Hashtable and the context factory,
    something like this
    Hashtable props = new Hashtable();
    props.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
    props.put(Context.PROVIDER_URL, "t3://localhost:7001/");
    Context context = new InitialContext(props);
    I used a jndi-link in resin previously, that did not require me to do a remote
    lookup and rather created a link at the server level and allowed me to do a direct
    InitialContext() lookup.
    <jndi-link>
    <jndi-name>java:comp/env/ejb/test</jndi-name>
    <jndi-factory>weblogic.jndi.WLInitialContextFactory</jndi-factory>
    <init-param java.naming.provider.url="t3://xx.x.x.x:7001"/>
    <jndi-lookup>ejb.test</jndi-lookup>
    </jndi-link>
    Can I do something similar in Weblogic? If yes, how can I do it.
    Appreciate your help.
    Thanks,
    Varun

    "Varun Garg" <[email protected]> wrote:
    >
    I am trying to create a EJB jndi link to another weblogic server from
    a weblogic
    server.
    Basically I have a web application that uses an EJB that is deploed on
    another
    weblogic server and I would like to connect to it.
    One way I can do is the remote lookup using the Hashtable and the context
    factory,
    something like this
    Hashtable props = new Hashtable();
    props.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
    props.put(Context.PROVIDER_URL, "t3://localhost:7001/");
    Context context = new InitialContext(props);
    I used a jndi-link in resin previously, that did not require me to do
    a remote
    lookup and rather created a link at the server level and allowed me to
    do a direct
    InitialContext() lookup.
    <jndi-link>
    <jndi-name>java:comp/env/ejb/test</jndi-name>
    <jndi-factory>weblogic.jndi.WLInitialContextFactory</jndi-factory>
    <init-param java.naming.provider.url="t3://xx.x.x.x:7001"/>
    <jndi-lookup>ejb.test</jndi-lookup>
    </jndi-link>
    Can I do something similar in Weblogic? If yes, how can I do it.
    Appreciate your help.
    Thanks,
    Varun
    hi,
    Yes, it is possible in weblogic for more info visit this url,
    http://e-docs.bea.com/wls/docs70/ejb/reference.html#1221067
    u have the description of how to use the below tags
    <initial-context-factory>weblogic.jndi.WLInitialContextFactory</initial-context-factory>
    <provider-url>WeblogicURL:Port</provider-url>
    <indi-name>jndiweb</jndi-name>
    hope it help u
    regards,
    Elango TR

  • 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

  • How tom invoke an EJB from another EJB using the sun rmi protocl in Weblogi

    Hi,
    I am particularly new to EJB.
    My scenario is
    client invoking-->EJB-----invoking ----(Either a webService or an EJB)
    in WEBLOGIC
    Is it possible that a call from EJB to another EJB or WebService use Sun's RMI as underlying protocol instead of t3 or IIOP which are used in Weblogic ?
    Would be really a great help if you could provide me some sample on it on weblogic.

    Hi Stefan,
    You don't need to provide the InitialContextFactory for running a standalone client. The following should work just fine:
    Context initial = new InitialContext();
    System.out.println("Looking up ...");
    Object objref = initial.lookup(EJB);  //the lookup name should be a global JNDI name      //and not from the java:comp namespace
    System.out.println("Looked up EJB");The JNDI implementation looks for the jndi.properties file in your classpath. So make sure that you have the appserv-rt.jar from your <server_installation>/lib directory in your classpath.
    HTH,
    Sheetal

  • JNDI EJB Lookup fails on Remote Server

    Hi,
    I am having two different domain (domain1,domain2) respectvely. My ABC.ear j2eee application is deployed on domain2 and its iiop port is 33703.In domain1 i have xyz.war (web application) and it's IIOP port is 3700 .In xyz.war i am having CallEJB.jsp file.In this Jsp file i want to lookup an EJB Service called PaymentEJB(JNDI Name is ejb/PaymentEJB).
    The code is below
    InitialContext context=new InitialContext();
    Object objRef=context.lookup("corbaname:iiop:andaman:33703#ejb/PaymentEJB");
    I am getting the following error.
    [#|2005-12-14T16:42:03.422+0530|SEVERE|sun-appserver-pe8.1_02|javax.enterprise.resource.corba._DEFAULT_.rpc.transport|_ThreadID=11;|"IOP00410216: (COMM_FAILURE) Unable to create IIOP listener on the specified host/port: all interfaces/3700"
    org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 216 completed: No
    at com.sun.corba.ee.impl.logging.ORBUtilSystemException.createListenerFailed(ORBUtilSystemException.java:2661)
    My doubt is
    1.While starting domain1 and domain2 iiop listeners are started on the port 3700 and 33703.in that case why EJB lookup tries to create listener on one more time.
    2.I am looking the 33703 port only.but it tries to create port on 3700 why?
    3.It was working till JES2005Q1.Is there any patch i need to install? or i need to change anything in my code.
    I am frustrated with this error for past one week.I will be happy if some body will give me the peace of mind(thru some solution).

    http://docs.sun.com/source/819-0079/dgjndi.html
    This might help.

  • Can EJB method return another EJB?

    Hello,
    I am new to EJB technology. I am working with Sun Application Server bundled in Netbeans 4.1
    Is it po[b]ssible a method of a session bean to return another EJB which is instantiated with arguments depended on the method?
    If no, is there an alternative way?
    thank you in advance, Kostas

    Is it possible within the SessionBean method to
    call another Session Bean, create it using the
    local interface, pass some parameters using setter
    methods, then cast it from local interface to
    remote and send it to the user?I think it's not possible casing Local Interface into Remote Intrface, because they inherit from different classes.
    Remote interface extends EJBObject and Local interface extends EJBLocalObject
    Fil

  • Can anyone help me with the commands to import and restore  backup from  another administrative server

    Dear all.
                         Can anyone help me with the commands to import and restore  backup from  another administrative server

    I tried, even with code tags it looks the same since the 2500 character limit is exceeded.
    Please post just the relevant parts inside tags as mentioned, and choose a descriptive subject line.
    I'm locking this thread.
    Thomas

  • How to call an EJB from another EJB

    Hi
    I have a problem here. I need to execute a second EJB which has to get the input from the first EJB as data for execution. So when I call the first EJB, the first EJB should give the data to the second EJB and execute it and provide the result.
    Cheers,
    Raj

    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

  • EJB lookup from Tomcat deployed on J2ee Engine

    Hello  All,
                            I have a jsf application which runs on tomcat, Now I developed a EJB (stateless) in NWDS and deployed on SAP j2ee engine, when I run a plain java calss I am able to access it but not  through my web-app. Can anybody throw some light on why this is happening?
    Thanks in Advance
    Somil

    Hello  All,
                            I have a jsf application which runs on tomcat, Now I developed a EJB (stateless) in NWDS and deployed on SAP j2ee engine, when I run a plain java calss I am able to access it but not  through my web-app. Can anybody throw some light on why this is happening?
    Thanks in Advance
    Somil

  • Problem in extracting data from another BW server

    Hello Experts
    I have two BW servers in landscape. One is used as stagins server and second server exctracts data form this server and is used as reporting server.
    I can see data in DSOs in stagins server, also checked export datasources in RSA3 in staging server and works fine.
    In reporting server delta infopackage runs fine but extracts 0 records. i tryied deleting and redoing init still dosent help. its not throwing any error.
    what could be problem and how can i troubleshoot and correct it?
    Thanks in advance
    Regards
    Sudeep

    Try these Steps:
    1.Replicate and activate the datasource(if BI 7) else activate Transfer Rules.
    2.Create an infopackage without selections as Full update and run..
    3.If no records are still coming (0)  then check the RFC connection b/n Staging & Reporting BI.
    Go to SM59 ,first in Reporting BI and chk the :authorizaiton test & rfc test
    again go to Staging BI and test for RFC connection to Reporting BI -->authorization test & rfc test
    Sometimes password etc are changed just be careful and chk them properly.
    4.create a Dummy DSO and load data to it from flat file on staging server.Now replicate its export datasource to Reporting BI.
    If you can load data to PSA of this dummy datasource then there is some other problem.If there is no record comign then definately you need to go through step-1 to 3.
    Regards,
    RK

Maybe you are looking for

  • Initial Load of contract from ISU to CRM

    Hi All, We are working on the replication of contract from ISU to CRM. We have done all the necessary setting,like assigning default product,running ecrm_generate_everh report etc When we are running initial load on SI_CONTRACT,only single BDOC is ge

  • Itunes will not show individual songs

    When I go on itunes, the individual songs will not display to be purchased. Suggestions?

  • Style

    hi How can we find the  style assigned to standard text. Regards, Praneeth

  • HT4914 How can I attach a song to an email to send to someone?  Thank you.

    When I switch to an android will I lose all the songs I purchased on iTunes ?

  • Insert a PDF?

    Post Author: MaCook CA Forum: Crystal Reports I want to know if it is possible to insert a pdf document into CR XI. I see there are other ways to get the image into the report but they are not as legible as I would like them to be. Any thoughts or su