How to call Sun server from Tomcat

Hi
I have EJB running on SUN J2EE server on different machine. I want to access EJB from Tomcat running on my machine through JSP page.
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");
     p.put(Context.PROVIDER_URL, "iiop://remote_machine:3700#ejb/ConnEJBBean");
Context ctx = new InitialContext(p);
Object objRef = ctx.lookup("ejb/ConnEJBBean");
%>
objRef type is: <%=objRef.getClass().getName()%>
<%
// Do something with object reference...
ConnEJBRemoteHome conEjbRemoteHome = (ConnEJBRemoteHome)PortableRemoteObject.narrow(objRef, ConnEJBRemoteHome.class);
ConnEJBRemote myConEjb = conEjbRemoteHome.create();
%>
This call rerurn an object of com.sun.corba.se.internal.iiop.CDRInputStream_1_0$1
althought I am expecting of conEjbRemoteHome Stub. Thus it throwas error on line:
ConnEJBRemoteHome conEjbRemoteHome = (ConnEJBRemoteHome)PortableRemoteObject.narrow(objRef, ConnEJBRemoteHome.class);
Which throuws an exception:
java.lang.ClassCastException at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:293) at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:134)
ANy help would be great...
Thanks in advance
Bhuwan

Couple of suggestions. First double-check that you actually have the RMI-IIOP stubs. Which version of SUN Appserver are you using. With versions 8.x or later, there are no RMI-IIOP stubs generated by default. You'd need to explicitly request that they be generated during deployment of the ejb app ( e.g. by setting the --generatermistubs option when running asadmin deploy).  
Also double-check that the stubs are indeed visible within the classpath of your web application. The most common reason for the ClassCastException during PortableRemoteObject.narrow is that the stubs were not found.
--ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • How to migrate application server from Tomcat to WebSphere?

    Hi,
    I installed BO XI 3.1 32 bit in environment:
    - AIX 5.3 64 bit
    - Deployed Tomcat 5.5 from installing BO
    - Oracle client 10G
    I need to migrate application server from Tomcat to WebSphere 6.1 and WebSphere 6.1 Server 32 bit in Windows platform.
    Could you someone give detail steps
    Many thanks in advance and best regards,

    I tried manually to deploy web applications, but not successful. This is my deployment step following:
    AIX 5.3: BOE XI 3.1 :
    Copy all <INSTALLDIR>/bobje/enterprise120/java/applications/  to Windows Websphere D:\BO_WAS
    WebSphere 6.1 location & IP (windows) :
    C:\Program Files\IBM\WebSphere\AppServer1\
    IP: 192.168.69.10
    Log in to WebSphere Applicaton Server Administrative http://192.168.69.10:9060/admin
    1. Under the Applications heading of the console navigation menu, click
    Enterprise Applications on the left navigational pane.
    2. Click the Install button and navigate to the location of the WAR file to
    deploy. If deploying from a remote file system, select the Remote File
    System option.
    3. Enter a context root for the WAR file (e.g. /CmcApp for CmcApp.war)
    (this format (/CmcApp) for Unix OS, have different in Windows ? Could you give me fully path?)
    and
    press the Next button, followed by Continue.
    4. In "Step 1", give a unique name for your web application and proceed to
    "Step 2".
    5. Highlight the server you created (or highlight server1 if you didn't create
    your own) from the Clusters and Servers and enable the Select
    checkbox. Proceed to "Step 3".
    6. Select the virtual host you created (or default_host if you didn't create
    your own) from the Virtual Host drop-down list. Proceed to "Step 4".
    7. Review the summary page, and press Finish when done.
    8. Click Save to Master Configuration.
    9. Click the Save link, then the Save button.
    Finally the output is not available.
    Many thanks in advance and best regards

  • How to change web server from inbuilt Tomcat to IIS in already configured Cold Fusion 10

    how to change web server from inbuilt Tomcat to IIS in already configured Cold Fusion 10

    You just need to run the Web Server Configuration Tool to connect ColdFusion to IIS.  It can be found in the ColdFusion program group off of the Start menu.  Be sure to run it "As Administrator".
    -Carl V.

  • How to call  java program from ABAP

    Hi Experts,
         My requirement is to call java programs from ABAP. For that i have set up SAP JCO connection by using this link http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/739. [original link is broken] [original link is broken] [original link is broken] Connection gets sucessfully. After this how to call java program from ABAP as per our requirement. Please help me out.
      Also i tried this way also.. but while executing the DOS Command line appear & disappear in few seconds. So couldnt see the JAVA output. Please help me out to call java programs in ABAP..
    DATA:command TYPE string VALUE 'D:Javajdk1.6.0_20 injavac',
    parameter TYPE string VALUE 'D:java MyFirstProgram'.
    CALL METHOD cl_gui_frontend_services=>execute
    EXPORTING
    application = command
    parameter = parameter
    OPERATION = 'OPEN'
    EXCEPTIONS
    cntl_error = 1
    error_no_gui = 2
    bad_parameter = 3
    file_not_found = 4
    path_not_found = 5
    file_extension_unknown = 6
    error_execute_failed = 7
    OTHERS = 8.
    Thanks.

    This depends on the version of your Netweaver Java AS. If you are running 7.0, you will have to use the Jco framework. The Jco framework is deprecated since 7.1 though. If you want to build a RFC server in 7.1 or higher, it is adviced that you set it up through JRA.
    Implement an RFC server in 7.0:
    http://help.sap.com/saphelp_nw04/helpdata/en/6a/82343ecc7f892ee10000000a114084/frameset.htm
    Implement an RFC server in 7.1 or higher:
    http://help.sap.com/saphelp_nwce72/helpdata/en/43/fd063b1f497063e10000000a1553f6/frameset.htm

  • How to call the RFC from R/3 to SRM, when we use webdynpro abap? (Urgent)

    Hello
    We use SRM Server 5.5 with classic scenario.
    We want to call RFC in R/3 from webdynpro ABAP.
    How can we do that?
    We are developing the web report using webdynpro abap.
    So we need some of R/3 data such like PR(EBAN)and PO(EKKO,EKPO).
    When user choose the search parameter, report diplay the Shopping cart, PR and PO data on webdynpro.  So we call the R/3 RFC to display the PR, PO data.
    But I tired to call the RFC in R/3, We could not call it.
    How to call the RFC from R/3 to SRM, when we use webdynpro abap?
    Thank you,
    Best Regards,
    SH.

    Hi
    <b>Please look at the following threads as well -></b>
    WebDynpro in SRM
    BAPI's /RFC's in SRM
    BAPI to Change Shopping Cart by RFC
    SRM60 and webdynpro
    Webdynpro Services Exception
    WebDynpro using BAPI has an error
    SRM60 and webdynpro...
    <b>SAP uses META Function modules in SRM to get data from R/3 back-end.</b>
    <u>For getting Purchase requistion data, use the function modules -></u>
    META_REQUISITION_CHANGE        Change purchase requisition              
    META_REQUISITION_CREATE        Create Requisition                       
    META_REQUISITION_DELETE        Delete/close purchase requisition        
    META_REQUISITION_GETDETAIL     Display requisition details              
    META_REQUISITION_GETITEMS      Display requisition items                
    META_REQUISITION_GETRELINFO    Get Releasease Info for requisitions
    <u>For getting Purchase order data, use the function modules -></u>
    META_PO_CREATE                 Create purchase order                    
    META_PO_DELETE                 Delete reservation                       
    META_PO_GETDETAIL              Display purchase order details           
    META_PO_GETITEMS               Display purchase order items             
    META_PO_GETRELINFO             Display purchase order release information
    Hope this will definitely help. Do let me know.
    Regards
    - Atul

  • How to call web services from HTML

    Hi All,
    Does anybody have an idea on how to call web services from HTML using axis and i am using jboss-4.0.5 as the application server.

    What did your Google search return?

  • HOW TO CALL A FORM FROM ANOTHER FORM

    HOW TO CALL A FORM FROM ANOTHER FORM [local machine]

    Balraj wrote:
    HOW TO CALL A FORM FROM ANOTHER FORM [local machine]The way you asked question is this bit of request or order?
    Secondly, you used capital latters which are being treated as Shouting Language. So, always try to switch off the Capslock of your keyboard.
    Thirdly, you are very lazy to serach on forum or google for your problem instead of waiting someone to anwer your question.
    Your should seriously have a look at FAQ.
    http://wikis.sun.com/display/Forums/Forums+FAQ
    Also here.
    http://www.catb.org/~esr/faqs/smart-questions.html
    Please read documentation for the initial questions.
    -Ammad

  • How to call Java API from BSP?

    I have a requirement to call Java API from BSP application.
    I have checked the forum and found that it is possible by using some ABAP codes.
    However there is no pointer on how this is done.
    Can someone explain the details on how to call Java API from BSP is done?
    I found class CL_EJB_JAVA_OBJECT_METHODS to call a method in EJB but can't find function or SAP class to call Java API.
    Actually is there any BSP extention which can used to call Java API?
    Thanks,
    Hendri

    check out these weblogs, it should give you an idea how to go about it.
    /people/ignacio.hernndez/blog/2006/12/04/speech-synthesis-listen-the-application-server-is-talking-to-you
    /people/puru.govind/blog/2006/12/20/let-abap-speak
    Regards
    Raja

  • How to call a function from asp

    Hi!, I'd like to know how to call a function from an asp page. I've written:
    set rs = server.createobject("Adodb.recordset")
    rs.open "call dbo.sf_Obt_Des_Producto ('0000161')",Conn
    if err.description <> "" then
    response.write ("No se pudo! :(")
    else
    response.write ("rs: " & rs(0))
    end if
    rs.close
    set rs = nothing
    but there is an error:
    ORA-06576: not a valid function or procedure name
    Please is very urgent!!!
    Thanks.
    Angie.

    You need to use the syntax "{call <procedure_name>}".
    The {call } syntax tells the OLE DB provider that it needs to translate the call into whatever the database's procedure calling syntax is. This means that even though different databases have different syntax for calling stored procedures, your OLE DB code can be run against any of them without changing.
    Justin

  • How to call a process from another project

    Hi;
    How to calling a process from another process in another project? Which activity that i need or web service, direct binding? I use 11g

    Hi Tulasi ;
    I have wsdl of the process i need to call. Also wsdl address on the server. But CALL activity can't use to service call. CALL activity can use only to reusable process call.
    I think, this operation must make on composite.xml. But I have a same problem with this method and it don't work.
    I create a base process that looking at below. It's include a direct binding. Is it include a direct binding?
    [Base Process|http://d1201.hizliresim.com/t/s/21wqu.png]
    Then i create a process that call to base process:
    [Caller Process|http://d1201.hizliresim.com/t/s/21wqx.png]
    I paste to base process' wsdl address on the server. Then i select port type (BaseProcessPortType) and a warning has occured that you see the picture above. Base Process contain Oracle SOA Composite Type. What's the wrong? It happened for Callback Port Type.
    And second question is what's the Address? (under Reference Binding Setails option).
    I think, i create the this direct binding correctly, i call to base process into my caller process via service activities.

  • How to call a form from report? in 6i

    How to call a Form from Report? In Developer 6i of oracle. Plz tell me tex.

    try this
    declare
       AppID PLS_INTEGER;
    begin
         AppID := DDE.App_Begin('ifrun60 module=myform.fmx userid=scott/tiger@mydb maximize=no', DDE.App_Mode_Maximized);
    exception when others then
          srw.message(1,'Errror');
    end;Baig
    [My Oracle Blog|http://baigsorcl.blogspot.com/]

  • How to call a package from the Report in Oracle Application Express

    How to call a package from the Report in Oracle Application Express

    Hello,
    What do you mean? Something like SELECT mypackage.function( par1, par2) from dual?
    Or do you want to execute a procedure when something happens on the page, like clicking a button?
    Greetings,
    Roel
    http://roelhartman.blogspot.com/
    You can reward this reply by marking it as either Helpful or Correct ;-)

  • How to call business service from xquery transformation in OSB ??

    Hi All,
    How to call business service from xquery transformation in OSB ??
    I need to assign the response variable of Business Service to a target element in XQuery Transformation Mapper file.
    It's urgent.
    Regards,
    Jyoti Nayak

    Transformation is to mapping the source and target of 2 different schemas.
    In your case you should have a XQuery transformation between, your Business Service output schema and the target schema.
    Thanks,
    Vijay

  • How to call javascript function from PL/SQL procedure

    Can anybody advice me how to call javascript function from PL/SQL procedure in APEX?

    Hi,
    I have a requirement to call Javascript function inside a After Submit Process.
    clear requirement below:
    1. User selects set of check boxes [ say user want to save 10 files and ticks 10 checkboxes]
    2. user clicks on "save files" button
    3. Inside a After submit process, in a loop, i want to call a javascript function for each of the file user want to save with the filename as a parameter.
    Hope this clarify U.
    Krishna.

  • How to call oracle function from ejb3

    i'm trying to call an oracle query-function from ejb3.
    The oracle function:
    create or replace FUNCTION getSecThreadCount(secId in NUMBER,avai in NUMBER)
    RETURN SYS_REFCURSOR is cur SYS_REFCURSOR;
    m_sql VARCHAR2(250);
    BEGIN
    m_sql:='select count(thrId) from thread where secId='|| secid||'
    and thrAvai='|| avai;
    open cur for m_sql;
    return cur;
    END;
    I'v tried several ways to call it,but all failed:
    1. the calling code:
    public Object getSectionThreadCount(int secId,int avai){
              Query query=manager.createNativeQuery("{call getSecThreadCount(?,?) }");     
              query.setParameter(1, secId);
              query.setParameter(2, avai);
              return query.getSingleResult();
    but i got the exception:
    Exception in thread "main" javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query; nested exception is: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
    javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
    Caused by: java.sql.SQLException: ORA-06550: row 1, col 7:
    PLS-00221: 'GETSECTHREADCOUNT' not procedure or not defined
    ORA-06550: row 1, col 7:
    PL/SQL: Statement ignored
    2. the calling code:
    @SqlResultSetMapping(name = "getSecThreadCount_Mapping")
    @NamedNativeQuery(name = "getSecThreadCount",
    query = "{?=call getSecThreadCount(:secId,:avai)}",
    resultSetMapping = "getSecThreadCount_Mapping",
    hints = {@QueryHint(name = "org.hibernate.callable", value = "true"),
              @QueryHint(name = "org.hibernate.readOnly", value = "true")})
    public Object getSectionThreadCount(int secId,int avai){
              Query query=manager.createNamedQuery("getSecThreadCount");     
              query.setParameter("secId", secId);
              query.setParameter("avai", avai);
              return query.getSingleResult();
    but i run into the exception:
    Exception in thread "main" javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query; nested exception is: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
    javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
    Caused by: java.sql.SQLException: lost in index IN or OUT parameter:: 3
    By the way, i have successfully called the function from hibernate. And i use oracle 11g, JBoss5 RC1.
    Could anyone tell me how to call the function from EJB3?
    Thanks.

    Here's a working model:
    package.procedure: (created in example schema scott)
    CREATE OR REPLACE package  body data_pkg as
      type c_refcursor is ref cursor;
      -- function that return all emps of a certain dept
      function getEmployees ( p_deptId in number
      return c_refcursor
      is
        l_refcursor c_refcursor;
      begin
         open l_refcursor
        for
              select e.empno as emp_id
              ,        e.ename as emp_name
              ,        e.job   as emp_job
              ,        e.hiredate as emp_hiredate
              from   emp e
              where  e.DEPTNO = p_deptId;
        return l_refcursor;
      end getEmployees;
    end data_pkg;
    /entity class:
    package net.app.entity;
    import java.io.Serializable;
    import java.util.Date;
    import javax.persistence.Column;
    import javax.persistence.Entity;
    import javax.persistence.GeneratedValue;
    import javax.persistence.GenerationType;
    import javax.persistence.Id;
    import javax.persistence.NamedNativeQuery;
    import javax.persistence.QueryHint;
    import javax.persistence.SequenceGenerator;
    import javax.persistence.Table;
    @SuppressWarnings("serial")
    @Entity
    @Table (name="emp")
    @SequenceGenerator(name = "EmployeeSequence", sequenceName = "emp_seq")
    @NamedNativeQuery( name = "getEmpsByDeptId"
                   , query = "{ ? = call data_pkg.getEmployees(?)}"
                   , resultClass = Employee.class
                   , hints = { @QueryHint(name = "org.hibernate.callable", value = "true")
                          , @QueryHint(name = "org.hibernate.readOnly", value = "true")
    public class Employee implements Serializable
        @Id
        @Column(name="emp_id")
        @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "EmployeeSequence")
        private int id;
        @Column(name="emp_name")
        private String name;
        @Column(name="emp_job")
        private String job;
        @Column(name="emp_hiredate")
        private Date hiredate;
        // constructor
        public Employee (){}
        // getters and setters
        public int getId()
         return id;
    etc...session bean:
    package net.app.entity;
    import java.util.ArrayList;
    import java.util.List;
    import javax.ejb.Stateless;
    import javax.persistence.EntityManager;
    import javax.persistence.PersistenceContext;
    import javax.persistence.Query;
    import net.app.entity.Employee;
    import net.app.iface.ScottAdmin;
    @Stateless
    public class ScottAdminImpl implements ScottAdmin
        @PersistenceContext
        private EntityManager entityManager;
        @SuppressWarnings("unchecked")
        public List<Employee> getEmployeesByDeptId(int deptId)
         ArrayList<Employee> empList;
         try
             Query query = entityManager.createNamedQuery("getEmpsByDeptId");
             query.setParameter(1, deptId);
             empList = (ArrayList<Employee>) query.getResultList();
             return empList;
         catch (Exception e)
             e.printStackTrace(System.out);
             return null;
    }client:
    package net.app.client;
    import java.util.List;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import net.app.entity.Employee;
    import net.app.iface.ScottAdmin;
    public class ScottClient
        public static void main(String[] args)
         try
             // create local interface
             InitialContext ctx = new InitialContext();
             ScottAdmin adminInterface = (ScottAdmin) ctx.lookup("ScottAdminImpl/remote");
             // select employees by deptno
             int deptno = 20;
             List<Employee> empList = adminInterface.getEmployeesByDeptId(deptno);
             // output
             System.out.println("Listing employees:");
             for (Employee emp : empList)
              System.out.println(emp.getId() + ": " + emp.getName() + ", " + emp.getJob() + ", " + emp.getHiredate());
         catch (NamingException e)
             e.printStackTrace(System.out);
    }Basically you just ignore the refcursor outbound parameter.
    This is a stored function, have yet to try outbound refcursor parameters in stored procedures...
    Edited by: _Locutus on Apr 2, 2009 2:37 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Maybe you are looking for

  • Programming for College with Windows Apps on bootcamp HELP?

    Hello everyone I come to you for help after a long search for the perfect laptop. Right now I am using a macbook late 2009 with multitouch. I love the features but after signing up for some programming classes for college I had to revise what laptop

  • Merging two complemental result sets... or OUTER JOINs not working?

    Dear experts! Again I have a very difficult problem for which I ask Your help, but this time I am better prepared than last time and can deliver sample data of my (hopefully not too much) simplified example: create table Subjects( pk_id          numb

  • Cursor in packages

    hi, what is the difference using cursor in body&specifications?  how do we separate both of them? regards kar

  • Break point in BADI

    Hi,   I am trying to keep a break point in BADI for PBEN0014 which I implemented using a method. But it does not stop at that point and gets the output directly. Is there any way to make the payroll stop at breakpoint in BADI. Thanks. Osacr

  • All connections lost after installing either bluetooth or USB Modem

    Hi There,  I have checked but did not find post related to my issue. I'm running AC 5, XP on a T60. Everything is ok as long as I'm using only my network internal card or the internal wireless adaptator. But each time I have tried to install either b