How to use application to call a remote EJB?

this is my code:
package test;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import java.util.*;
import test.HelloWorldHome;
import test.HelloWorld;
public class callremoteEjb{
     public String callejb(){
          try{
               Properties env = new Properties();
               System.setProperty("org.omg.CORBA.ORBInitialHost", "202.120.80.219");
          System.setProperty("org.omg.CORBA.ORBInitialPort", "7001");
          env.put(Context.INITIAL_CONTEXT_FACTORY,
                         "com.sun.enterprise.naming.SerialInitContextFactory");
          env.put(Context.PROVIDER_URL, "t3://202.120.80.219:7001");
               Context initial = new InitialContext(env);
               Object objref = initial.lookup("HelloWorldBean");
               HelloWorldHome home = (HelloWorldHome)PortableRemoteObject.narrow(
                                                  objref,HelloWorldHome.class);
               HelloWorld helloBean = home.create();
               return helloBean.sayHello();
          }catch(Exception ex){
               ex.printStackTrace();
          return "aaa";          
     public static void main(String[] args){
          callremoteEjb testejb = new callremoteEjb();
          System.out.println(testejb.callejb());     
i ' ve success deploy the EJB in the remote server.
but it run error : " Can't find SerialContextProvider "
how should i do?

There is a sample called rmi-iiop. It has a Java applicationclient that talks to a remote ejb. Pl have a look at that.
Sahoo

Similar Messages

  • How to use application managed entity manager in EJB?

    I finish reading The EntityManager Interface in JEE tutorial.
    I know I can use container manager entity manager in EJB, but I want to explore how to use application managed entity manager in EJB.
    Can I use application managed entity manager in EJB (container management JTA transaction is used)? Where do I should close entity manager if can?
    The following is an example from JEE tutorial, but didn't find where to calose entity manager. and can I create mutiple EntityManagerFactory objects and Entity Manager objects to use them in a JTA transaction?
    @PersistenceUnit
    EntityManagerFactory emf;
    EntityManager em;
    @Resource
    UserTransaction utx;
    em = emf.createEntityManager();
    try {
      utx.begin();
      em.persist(SomeEntity);
      em.merge(AnotherEntity);
      em.remove(ThirdEntity);
      utx.commit();
    } catch (Exception e) {
      utx.rollback();

    Seems like a very poor example, the whole power of EJBs is to use Container Managed Transactions so you don't NEED to manage the transaction and the entity manager yourself. What you posted is code I would expect in a non-JEE application, or in a piece of code which requires fine-tuned transaction boundaries such as batched data importing logic.
    If I were you I'd research JPA in steps.
    a) learn about JPA as an API outside of the scope of EJBs (recommended reading: the book 'Pro JPA 2')
    b) learn about Container Managed Transactions in EJBs
    c) learn about Bean Managed Transactions in EJBs
    Right now you're rushing into c). I can understand that it raises many question marks at this point.

  • How to use "Set Enterprise Call Info" step in the script ?

    Hi all
    Can anyone please suggest how to use "Set Enterprise Call Info" step in the script.
    Does anyone has any example script with the same (a complete example script) ?

    Hi
    go to this guide
    http://www.cisco.com/c/dam/en/us/td/docs/voice_ip_comm/cust_contact/contact_center/crs/express_7_0/user/guide/uccx70edgs.pdf
    and see the chapter
    "Designing Scripts for use with the Cisco Application Gateway"

  • How to use a fixed port for remote assistance in windows 8.1 behind a nat router freebox?

    Hello,
    Before to use remote assistance in windows 8.1, i need to configure my nat router freebox.
    But remote assistance ( msra.exe ) use a dynamique port and never the same.
    How to use a fixed port for remote assistance ini windows 8.1 ?
    And why i can't use easy connect ?
    i read that the router must implement the PNRP protocol. I think it's a propriatary microsoft's protocol unknow on my router.
    Thanks

    Hello,
    Very good. It's a big range ( 255 mini from 49152 )  for a single port but if it's the only one possibility...
    You are very helpfull ( i don't know if it's a good english but you make me very happy )
    Merci beaucoup

  • How to use Stored Procedure Call in Sender JDBC adapter

    Hi All,
             Could someone send me a blog on how to use Stored Procedure call in Sender JDBC adapter?
    Xier

    Hi Xler
    refer these links
    /people/yining.mao/blog/2006/09/13/tips-and-tutorial-for-sender-jdbc-adapter
    http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm
    Also, you can check Sriram's blog for executing Stored Procedures,
    /people/sriram.vasudevan3/blog/2005/02/14/calling-stored-procs-in-maxdb-using-sap-xi
    /people/jegathees.waran/blog/2007/03/02/oracle-table-functions-and-jdbc-sender-adapter
    This blog might be helpfull on stored procedures for JDBC
    JDBC Stored Procedures
    /people/siva.maranani/blog/2005/05/21/jdbc-stored-procedures
    Please go through these threads and see if it helps...
    Re: How to execute Stored Procedure?
    Re: Problem with JDBC stored procedure
    Thnaks !!

  • How to use @jws:sql call Stored Procedure from Workshop

    Is there anyone know how to use @jws tag call Sybase stored procedure within
    Workshop,
    Thanks,

    Anurag,
    Do you know is there any plan to add this feature in future release? and
    when?
    Thanks,
    David
    "Anurag Pareek" <[email protected]> wrote in message
    news:[email protected]..
    David,
    In the current release, we do not support calling stored procedures from a
    database control. You will have to write JDBC code in the JWS file to call
    stored procedures.
    Regards,
    Anurag
    Workshop Support
    "David Yuan" <[email protected]> wrote in message
    news:[email protected]..
    Anurag,
    I know how to use DB connection pool and create a db control with it. In
    fact, we have created a Web Service with the db control using plain SQL
    in
    @jws:sql. However, my question here is how to use @jws tag in Weblogic
    Workshop to create a Web Services based on Sybase stored procedure orany
    Stored Proc not plain SQL.
    Thanks,
    David
    "Anurag Pareek" <[email protected]> wrote in message
    news:[email protected]..
    David,
    You can use a database control to obtain a connection from any JDBC
    Connection Pool configured in the config.xml file. The JDBC Connectionpool
    could be connecting to any database, the database control is
    independent
    of
    that.
    Regards,
    Anurag
    Workshop Support
    "David Yuan" <[email protected]> wrote in message
    news:[email protected]..
    Is there anyone know how to use @jws tag call Sybase stored
    procedure
    within
    Workshop,
    Thanks,

  • How to use application item in the page template

    How to use application item in the page template.
    Thanks,
    rajendra

    Hi,
    You can refer application item value in template like &MY_ITEM. (note period at end)
    http://docs.oracle.com/cd/E37097_01/doc/doc.42/e35125/concept_sub.htm
    Regards,
    Jari

  • In SQLScript, how to use EXEC to call another procedure with parameters in procedure?

    Hi experts,
    In SQLScript, How to use EXEC to call another procedure with input and output parameters in procedure?thanks very much

    Hi Sagar,
    thank you! I generate another procedure with an input parameter and an output parameter in a procedure. Then i need to call the generated procedure using EXEC. Here is my code:
    create procedure ftest1(out sum_num bigint)
    as
    begin
    declare fa_output bigint;
    declare v_sql_drop varchar(200);
    declare v_sql varchar(500);
    declare cursor c_cursor1 for select num from TABLE1;
    --v_sql_drop := 'drop procedure fe';
    --exec v_sql_drop;
    v_sql := 'create procedure fe(in i_num bigint,out o_num bigint) as begin';
    v_sql := :v_sql || ' o_num := :i_num * 2 + :i_num * :i_num;';
    v_sql := :v_sql || ' end';
    exec v_sql;
    open c_cursor1;
    for c_item as c_cursor1 do
    exec 'call fe(c_item.num,o_num=>fa_output)';
    if sum_num is null then
    sum_num := fa_output;
    else
    sum_num := :sum_num + fa_output;
    end if;
    end for;
    close c_cursor1;
    end;
    The underline code is using exec to call the generated procedure. But this method cannot work. Any suggestion? thanks again!

  • How to use the program called ZSAPLINK to import Function Name

    How to use the program called ZSAPLINK to import Function Name

    Not sure why you posted into this forum?
    Note the header for this forum:
    This forum is dedicated to all other development-related questions which are not directly addressed by other forums. This includes Business Objects SDKs, products, or technologies which do not fall under BusinessObjects Enterprise, BusinessObjects Edge, Crystal Reports Server, or Crystal Reports (for example Desktop Intelligence SDK, Universe Designer SDK, Portal Integration Kits, Java User Function Libraries, and other third party technologies or development languages).
    Ludek

  • How to use application.getRealPath()

    Hi all,
    I need to retrieve a document which is external to .war file and with in the same server location. I dont want to hard code the file location path in my jsp. Is there any other alternative by using getRealPath() method. Pl let me know how to use application.getRealPath() if it makes any sense.
    Hoping to hear from you soon :)

    Say, doc1 is in webapps1 and you want to get its real path in webapps2. For that,
    in webapps2, you can use ServletContext.getContext("/webapps1") method , to get the context of webapps1. Then from this context, you can use context.getRealPath("/doc1") method to get the location of the document doc1.
    Hope this helps.

  • How to use three way calling

    How do you end a call after you've merged it for three way calling?

    Hi there, there is no star function to activate the three-way calling feature.  Here is a very helpful link that will explain on how to use three-way calling with Verizon. 
    http://www22.verizon.com/ResidentialHelp/Phone/Calling+Features/Three-Way+Calling/Questions+and+Answ...
    --James
    --James
    Verizon Support
    Notice: Content posted by Verizon employees is meant to be informational and does not supersede or change the Verizon Forums User Guidelines or Terms or Service, or your Customer Agreement Terms and Conditions or Plan.

  • How to Use synchronous RFC calls during test run for remote accesses

    there is a Setting for the usage of RFC accesses from a tested system
    using eCATT.
    'X' - Use asynchronous RFC calls during test run for remote accesses
    ' ' - Use synchronous RFC calls during test run for remote accesses
    I developed an eCATT as following :
      SAPGUI ( SAPGUI_1 , Target_system_1 ).
      SAPGUI ( SAPGUI_2 , Target_system_2 ).
    My question is how to run the eCATT in a synchronous RFC calls
    PS: I do not want to change the Target_system to the same one in the
    above script of ecatt.Because I need to run it in 2 different Target
    systems sometime.
    for example, I give a Target_system_3 when run this eCATT
    I want the SAPGUI_1 and SAPGUI_2 run the Target_system_3 but not the
    Target_system_1 or Target_system_2 .
    Could you please tell me how to make it without the changes in script?
    Edited by: Weitong Liu on Mar 24, 2011 9:44 AM

    Hi Liu,
    Weitong Liu wrote:
    > ' ' - Use synchronous RFC calls during test run for remote accesses
    This is the standard option value. Asynchronous are not the standard way and used only for very special purposes.
    Weitong Liu wrote:
    > I developed an eCATT as following :
    >   SAPGUI ( SAPGUI_1 , Target_system_1 ).
    >   SAPGUI ( SAPGUI_2 , Target_system_2 ).
    > My question is how to run the eCATT in a synchronous RFC calls
    The commands will be executed in sequence. So each call will be synchronously replayed against TS1 and TS2.
    What is you issue with this standard procedure?
    Kind regards,
    Christoph

  • How to use "Start synchronous Call" to run a subVi and keep timeout event in Main vi still running?

    Hi, All
    I have a application need periodically check an instrument status and I put it in the "Timeout Event" in main vi. I also need call some subVis for configuration etc. Somehow when I called those subvi, the Timeout event in my main vi was not running. Then I use " Start Asynchronous Call" function to call the subVis. Turns out it works fine with some subvis without return value, but not as expected with "return value-needed" subvis. 
    I attached a simple test, my main vi call two dlg subvis: AboutDlg.vi and SettingsDlg.vi. In the timeout event, I just use a counter for simulation. When you run it, you can see the counter keep counting when the AboutDlg.vi was called, but stopped when SettingsDlg.vi was called. 
    As I remembered, someone suggested to use Queue to pass return value, but I don't know how to implement it here. 
    Anyone has any suggestions about it? 
    Thank you very much. 
    CQ
    Solved!
    Go to Solution.
    Attachments:
    AsyCallTest.llb ‏108 KB

    Try playing with this - I have modified  your code to poke a Q in there.
    You will want to change the clusters to more useful datatypes (maybe enum and variant so you can unbundle variants depending on enum input), you will want to type def the clusters to make it easier to maintain and you will NEED to handle the sitaution where the called VI is left open on program close - i couldn't be bothered as this was not your immediate issue)
    Hope this give you some Ideas - totalyy untested but should work.
    James
    Attachments:
    AsyCallTest.llb ‏114 KB

  • How to use application class reference in the controller methods of BSP

    Hi,
    I have created a bsp application and also created an application class and assigned it to the application class. In the application class, I have created attribute TEXT type string(public and instance parameter).
    In the controller let's say main.do, I am trying to give a value to to the text by adding the following code.
    application->text = 'test'.
    I am getting syntax error saying field 'text' is unknown. It is not contained in one of the specified tables nor defined by DATA statement. 
    Please can someone let me know how to use the application class in the coding with an example. I couldn't find how exactly this has to be reference. Please help.
    Best regards
    Siva

    Hi,
    if you are having main controller and sub-controller then you may need to use below coding to use application class reference.
    *Data declaration
      DATA:  obj_cntrl        TYPE REF TO cl_bsp_controller2,
             obj_sub_cntrl   TYPE REF TO z_cl_sub_cntl,
             application TYPE REF TO z_cl_application.
    *Get the controller
      CALL METHOD obj_main_cntrl->get_controller   "obj_main_cntrl is the object of main controller
        EXPORTING
          controller_id       = 'SUB'   "Controller ID
        RECEIVING
          controller_instance = obj_cntrl  .
      obj_sub_cntrl ?= obj_cntrl  .
      application ?= obj_sub_cntrl ->application.
    or simply use below code in your controller method.
      application ?= me->application.
    Thnaks,
    Chandra

  • I can't figure out how to use coldfusion debugging on a remote server

    I can't figure out how to use coldfusion debugging on a CF
    installation on a remote server. Has anyone got experiance, I can't
    find any step by step instructions on how to do this using FLEX
    BUILDER 3

    Look at Chapter 13 of the iPad iOS4.3 User Guide

Maybe you are looking for

  • Documents open in reader XI, then go blank after 8 seconds. whether in IE 11, desktop file, or email

    Documents open in reader XI, then go blank after 8 seconds. whether in IE 11, desktop file, or email. This happens at home or at work.  I would expect that this is a common problem with a simple (to other eyes) answer

  • Support for Solaris 8 and 9

    I need a method of automatically installing patches from a local patch server ... for security reasons, we have no internet connectivity (absolutely no physical connection). Sun Patch Manager 2 seemed the perfect solution ... but have just found it i

  • XML Database HTTP Server Log files

    I'm using Oracle 10g Express with Apex 4.0 and need to take a look at what would be the Apache error and access logs. Does anyone know how to access them?

  • Mac OS X 10.6 Snow Leopart Reinstalling

    Hello, is there somebody who knows how can I solve this problem? I explain by parts: 1. The hard disk of my Macbook Pro burned (broke). So I went to an apple store to see if they can repair it. They told me that the starting sistem of the hard disk w

  • Import music from another program

    I have some music that I purchased from Sony to use with the crummy MP3 player that my grandma last year. Is it possible to transfer the music that I purchased from their online store into my iTunes library? The songs are all listed as OpenMG Audio F