How can i execute ejb method in a servlet?

hi
I am using a IBM HTTP Server and Weblogic Server.
I could execute below source in a main method of application but i could not that in a init method of servlet because of ClassCastException.
(a classpath of weblogic contains client's classpath)
// source code
Hashtable props = new Hashtable();
props.pu(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
props.put(Context.PROVIDER_URL,
"t3://192.168.1.5:7001");
Context ctx = new InitialContext(props);
Object obj = ctx.lookup("session.LigerSessionHome");
LigerSessionHome home = (LigerSessionHome) PortableRemoteObject.narrow (obj, LigerSessionHome.class);
// error code
Exception : session.LigerSessionBeanHomeImpl_ServiceStub
java.lang.ClassCastException: session.LigerSessionBeanHomeImpl_ServiceStub
at com.ibm.rmi.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:253)
at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:136)
at credit.getCreditResearch(credit.java:41)
at creditResearchClient.doGet(creditResearchClient.java:122)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
thanks

Have your stubs somehow got out of sync? So that your Servlet engine is pointing to a different jar than that of your jvm on which you were running your client application
hi
I am using a IBM HTTP Server and Weblogic Server.
I could execute below source in a main method of
application but i could not that in a init method of
servlet because of ClassCastException.
(a classpath of weblogic contains client's classpath)
// source code
Hashtable props = new Hashtable();
props.pu(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
props.put(Context.PROVIDER_URL,
"t3://192.168.1.5:7001");
Context ctx = new InitialContext(props);
Object obj = ctx.lookup("session.LigerSessionHome");
LigerSessionHome home = (LigerSessionHome)
PortableRemoteObject.narrow (obj,
LigerSessionHome.class);
// error code
Exception :
session.LigerSessionBeanHomeImpl_ServiceStub
java.lang.ClassCastException:
session.LigerSessionBeanHomeImpl_ServiceStub
at
com.ibm.rmi.javax.rmi.PortableRemoteObject.narrow(Porta
leRemoteObject.java:253)
at
javax.rmi.PortableRemoteObject.narrow(PortableRemoteObj
ct.java:136)
at credit.getCreditResearch(credit.java:41)
at
creditResearchClient.doGet(creditResearchClient.java:12
at
javax.servlet.http.HttpServlet.service(HttpServlet.java
740)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java
865)
thanks

Similar Messages

  • How can I execute a method on a specified time?

    How can I execute a method on a specified time such as method1() will be executed on 1:00 p.m and the method2() will be executed in 1:00 a.m?

    BilgeTonyukuk99 wrote:
    How can I execute a method on a specified time such as method1() will be executed on 1:00 p.m and the method2() will be executed in 1:00 a.m?As a simple example, take a look at http://www.javapractices.com/topic/TopicAction.do?Id=54.
    As an alternative (and looks like better approach), you could use the ScheduledThreadPoolExecutor.

  • How can I execute method of Component for name

    Hello,
    My program has JInternalFrame with some components. Write me please - how can I execute method of Component for name of Component ?
    Like this:
    ... findObject("jTextArea1").cut();
    Thank you in advance.

    just cycle through the container's components until
    you find one where getName equals "jTextArea1"Thank you for your answer.
    I'm creating components in runtime (I add panel+JTextArea in JTabbedPane) and I don't know how many components will be in JTabbedPane.
    I know only it's names.
    I wan't to execute metod JTextaRea_n_.cut() via using JTextaRea_n_.Name.
    How ?

  • How can I use EJB component on Weblogic 8.1 server ?

    hi,dear sir:
    How can I use EJB component on Weblogic 8.1 server ?
    It need client jar to invoke ejb,but what will I to do for this jar file? what does it contain? format ?
    If my EJB module contain 100 session bean and 50 Entity bean,but I want invoke 20 session beans in my module, how can I to do?
    thank you...

    Hi,
    This forum is exclusively for Creator. please post this on appropriate forum
    regards
    CreatorTeam

  • How can I create a method with throws  instruction

    Hello Everybody!
    How can I create this method inside WebDynpro.
    I enter "throws CloneNotSupportedException" manually an it removes always.
    What is wrong ?
    public java.lang.Object clone( ) throws CloneNotSupportedException{
        //@@begin clone()
         __Tdag__Is_Charactconfig that= (__Tdag__Is_Charactconfig)super.clone();
           return that;
        //@@end
    Regards
    sas

    I only checked in my 7.1 IDE and there this section exists.
    If it does not exist in your IDE, just create the method manually in the //@@begin others ... //@@end user-coding-area at the end of the controller class. This solves the issue for methods that are called from inside the controller. For public methods to be called from other controllers, this will not help.
    Armin

  • How can I execute a Procedure with OUT variable is %ROWTYPE on SQL Prompt

    Hi,
    I have a procedure with OUT variable is %ROWTYPE
    How can I execute the following procedure on SQL prompt.
    (without creating anonymous block)
    CREATE OR REPLACE PROCEDURE zz_sp_EMP(VEMPNO IN EMP.EMPNO%TYPE,
    V_REC IN OUT EMP%ROWTYPE)
    AS
    BEGIN
    SELECT * INTO V_REC FROM EMP WHERE EMPNO = VEMPNO;
    END;
    Thanks & Regards,
    Naresh

    as previous posters said: it's not possible to do this without declaring a variable in the anonymous block.
    With anonymous block it would look like this (had to change it a bit, since i'm using hr-schema on oracle XE):
    declare
    l_rec EMPLOYEES%ROWTYPE;
    begin
    zz_sp_EMP(VEMPNO => 100, V_REC => l_rec);
    DBMS_OUTPUT.PUT_LINE ( 'first_name = ' || l_rec.first_name );
    DBMS_OUTPUT.PUT_LINE ( 'last_name = ' || l_rec.last_name );
    end;
    first_name = Steven
    last_name = King

  • How can i execute vb scripts in java program

    hi
    how can i execute any batch files or any other exe files (vb scripts) from java programs
    thanks

    Hi,
    You use Runtime.exec to execute commands / exe-files. See the documentation (and remember that it will only work on windows):
    http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Runtime.html
    /Kaj

  • How can I execute Stored Procedures in PARALLEL and DYNAMICALLY ?

    Hi 
    I have a stored procedure. It can be executed like this
    exec test @p = 1;
    exec test @p = 2
    exec test @p = n;
    n can be hundred.
    I want the sp being executed in parallel, not sequence. It means the 3 examples above can be run at the same time.
    If I know the number in advance, say 3, I can create 3 different Execution SQL Tasks. They can be run in parallel.
    However, the n is not static. It is coming from a table. 
    How can I execute Stored Procedures in PARALLEL and DYNAMICALLY ?
    I think about using script task. In the script, I get the value of n, and the list of p, from the table, then running a loop with. In the loop, I create a threat and in the threat, I execute the sp like : exec test @p = p. So the exec test may
    be run parallel. But I am not sure if it works.
    Any idea is really appreciated.

    Hi nam_man,
    According to your description, you want to call stored procedures in parallel, right?
    In SSIS, we can create separate jobs with different stored procedures, then set the same schedule to kick the jobs off at the same time. In this way, we should be careful to monitor blocking and deadlocking depending on what the jobs are doing.
    We can also put all stored procedures in SSIS Sequence container, then they will be run in parallel.
    For more information about SSIS job and Sequence container, please refer to the following documents:
    http://www.mssqltips.com/sqlservertutorial/220/scheduling-ssis-packages-with-sql-server-agent/
    https://msdn.microsoft.com/en-us/library/ms139855(v=sql.110).aspx
    If you have any more questions, please feel free to ask.
    Thanks,
    Wendy Fu
    Wendy Fu
    TechNet Community Support

  • How can I execute program after using F4_Filename function?

    Hi all,
    I'm a new user on the forum. I've been working with ABAP and SAP for a few weeks. I wrote a program for importing data from excel file to SAP using BDC. During searching this forum I found information about F4_Filename function which allows users to browse the disc for a file. I'd like to add this function to my program. I have a parameter for a file name but this is an ordinary static string field. When I added the code which I found in the message on this forum the rest of program doesn't execute.
    This is simple program for example:
    REPORT  Z_TEST8_AB.
    DATA f_name TYPE STRING.
    PARAMETERS p_file like rlgrap-filename DEFAULT 'c:\test.xls'.
    f_name = p_file.
    write:/ f_name.
    This program works correctly. There is a field for parameter. I can change the default name for a file.
    After all, I can run the program (F8) and rest of the code is executed. The field for parameter dissapears from the screen and the file name is displayed. ( command write)
    Now I added a function F4_Filename
    REPORT  Z_TEST8_AB.
    DATA f_name TYPE STRING.
    PARAMETERS p_file like rlgrap-filename DEFAULT 'c:\test.xls'.
    at selection-screen on value-request for p_file.
      call function 'F4_FILENAME'
           exporting
                program_name  = syst-repid
                dynpro_number = syst-dynnr
                field_name    = 'p_file'
           importing
                file_name     = p_file.
    f_name = p_file.
    write:/ f_name.
    I can browse a computer for a file now but after selecting the file I can't run the rest of the code. When I click on the icon or press key F8 the field for parameter doesn't dissapier and the command write is not executed.
    What do I do wrong?
    Could anyone suggest me a solution? How can I executed the code after using this function?
    Thanks in advance.
    Regards,
    Arek.

    Hi arkadiusz,
    1. simple
    2.
    <b>start-of-selection.</b>
    f_name = p_file.
    write:/ f_name.
    regards,
    amit m.

  • How can I execute external application?

    Hi friends I want printing my barcodes a laser printer (Kyocera) it isn't a barcode printer. So I think (and I look kyocera web page my model doesn't support barcode printing in sap) print my barcodes using an external system. Before SAP we are using JollyPrint application for printing barcodes. It is using an Excel file.
    I can create a excel file for this application. I must execute this (JollyPrint-it is a label application) application when I press a button. How can I execute this application?
    Thanks
    Mehmet
    P.S. I have been writing this message with details may be somebody can give me a simple way for this

    Well, I can suggest you following steps. May be it works for you .
    -Create an external OS command in SM69
    -Test OS command in SM49 ( <u><i>about OS command if you search in SDN you’ll get lot of material</i></u> )
    -Create a Script at your OS level, I’m assuming you might have some UNIX flavor or Sun solaria’s.
    -Create a Shell script , which execute the printer job from OS .
    -Shell script will have parameters . ( e.g. printer name, destination etc )
    -set the path of shell script directory in SM69 ( the command you just created )
    -Execute shell script using your ABAP program ( use FM "SXPG_COMMAND_EXECUTE" )
    In the ABAP  program you can pass the parameters and execute the command from ABAP as a result your job will start printing on the required destination. Moreover, you can also capture the spool at OS level .
    FYI
    For UNIX script, if you search in www.google.com ( UNIX forums) . you’ll get shell script .
    Hope this’ll give you idea!!
    <b>P.S award the points.</b>
    Good luck
    Thanks
    Saquib Khan
    "Some are wise and some are otherwise"

  • How can I execute an .app remotely in a server via internet?

    Hi,
    Using PHP, or something like it,  how can I execute a MAC OSX app but have it run remotely in the server?
    I know this may sound like a simple question but I have almost no experience with Web apps.
    Thanks,
    Juan Dent

    All you need is a trigger that starts the execution. A simple HTML link to the file will do.

  • How can i access the methods if i only got the java class file?

    just like what the topic said...i would like to ask if i only got the class file of java without API documentation. how can i know what method is included ?
    thanks a lot.
    my email address is : [email protected]

    Class.getMethods()
    throws SecurityException
    Returns an array containing Method objects reflecting all the public member methods of the class or interface represented by this Class object, including those declared by the class or interface and and those inherited from superclasses and superinterfaces. The elements in the array returned are not sorted and are not in any particular order. This method returns an array of length 0 if this Class object represents a class or interface that has no public member methods, or if this Class object represents an array class, primitive type, or void.

  • How can I execute a statement before a VO is running

    JDEVADF_11.1.1.3.PS2_GENERIC_100408.2356.5660
    I use ADF BC
    how can I execute a statement before a VO is running

    thanks for the answer
    i use a logon function before I run a VO
    after a certain time will be disconnected
    and I have to call the function again
    sorry for my English
    public String logon(String username, String password){
    CallableStatement st = null;
    this.username = username;
    this.password = password;
    try {
    st = getDBTransaction().createCallableStatement("begin ep_security.LogOn(?,?); end;",0);
    st.setObject(1, username);
    st.setObject(2, password);
    st.executeUpdate();
    this.getDBTransaction().commit();
    } catch (SQLException e) {
    System.out.println("ERROR "+e.getMessage());
    this.addWarning(new JboWarning("Quote retrieved successfully"));
    System.out.println("...RETURN ERROR");
    return "error";
    } finally {
    if (st != null) {
    try {
    // 7. Close the statement
    st.close();
    } catch (SQLException e) {
    e.printStackTrace();
    }

  • How can I execute a batch file from my java program

    Hi,
    Can someone help me or direct me to a link,
    How can I execute a DOS batch file from my java program?
    Thanks

    You will need to grab a handle to the process's
    outputstream so u can see its output.The OP didn't mention any output from any batch file;
    nor any input for that
    matter,so lets not complicate matters here for now
    ok?Actually I think this is essential to see whether it works or not. It's either that or do some manual check to see whether it ran, which is not exactly elegant, and in some cases this may not be easier than simply writing the output stream code, or in fact it may be impossible to check manually.
    I'm sure it wasn't intentional that your post appeared to be bristling with attitude.

  • How can I execute a bash script by double clicking in finder

    Hello!
    How can I execute a bash script using finder? Or better: How can I create an alias, which executes my bash script?
    Thanks Johann

    Add the suffix command in your script name. E.g. Script.command.

Maybe you are looking for