Any example of dynamic proxy with RMI?

Hi, are there any good example of dynamic proxy with RMI, using the new RemoteObjectInvocationHandler class?
I am currently implementing a Registry, and want to use dynamic proxy to wrap around the registry stub, to pass extra information to the client.
I've tried it, but the program will hang and get this exception:
Exception in thread "RMI TCP Connection(1616)-192.168.1.23" java.lang.OutOfMemoryError: Java heap space
My implementation looks like this:
public RegistryImpl extends RemoteServer Implements Registry {
    public RegistryImpl(int port, Properties... properties) throws RemoteException, ChannelException {
         // Create a reference for the registry.
     LiveRef liveref = new LiveRef(id, port);
        ref = new UnicastServerRef(liveref);
         Registry proxy = (Registry)RegistryProxy.newProxyInstance(
              this.getClass().getClassLoader(),
              this.getClass().getInterfaces(),
              new RemoteObjectInvocationHandler(this.getRef()));
         /* Using dynamic proxy */
         usref.exportObject(proxy, null, true);
public class RegistryProxy extends Proxy implements Registry {
     private InvocationHandler handler;
     public RegistryProxy(InvocationHandler handler) {
          super(handler);
          this.handler = handler;
     public Remote lookup(String name) throws RemoteException, NotBoundException, AccessException {
          Remote result;
          try {
               Method m = Registry.class.getMethod("lookup", new Class[]{String.class});
               result = (Remote)handler.invoke(this, m, new Object[]{name});
          } catch (SecurityException e) {
               throw new UndeclaredThrowableException(e);
          } catch (NoSuchMethodException e) {
               throw new UndeclaredThrowableException(e);
          } catch (Throwable e) {
               throw new UndeclaredThrowableException(e);
          return result;
     public void bind(String name, Remote remoteObj) throws RemoteException, AlreadyBoundException, AccessException {
     public void unbind(String name) throws RemoteException, NotBoundException, AccessException {
     public void rebind(String name, Remote remoteObj) throws RemoteException, AccessException {
     public String[] list() throws RemoteException, AccessException {
}I am new to Java programming, any help is appriciated.
Regards
Eddie

Hi Eddie,
Perhaps you might like this one:
http://wiki.java.net/bin/view/Communications/TransparentProxy
it uses dynamic proxies to achieve complete RMI transparency.
Something to consider, good luck.
John

Similar Messages

  • Any Examples of using ActiveCollectionModelDecorator with POJO data control

    Are there any Examples of using ActiveCollectionModelDecorator with POJO data control in any of the sample packs?

    OK, here's an quick example. Create a new Windows Forms application and add a ScatterGraph and a Label to the form. Add a cursor to the ScatterGraph, then add the code below to the form. This generates 50 random data points when the form is loaded and plots them, then uses the cursor's AfterMove event to display the current X and Y positions in the label. Here's the code:
    Private Sub OnFormLoad(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Const dataLength As Integer = 50
    Dim xData(dataLength - 1) As Double
    Dim yData(dataLength - 1) As Double
    Dim rnd As Random = New Random
    For i As Integer = 0 To dataLength - 1
    xData(i) = i
    yData(i) = rnd.NextDouble() * 10
    Next
    ScatterGraph1.PlotXY(xData, yData)
    End Sub
    Private Sub OnAfterMoveXYCursor(ByVal sender As Object, ByVal e As NationalInstruments.UI.AfterMoveXYCursorEventArgs) Handles XyCursor1.AfterMove
    Label1.Text = String.Format("({0}, {1})", e.XPosition, e.YPosition)
    End Sub
    Hope this helps.
    - Elton

  • Dynamic proxy, several instances, same name, diff ids?

    I'm using a dynamic proxy with a simple invocation handler. Using the proxy for several instances of the target object should yield multiple instances of the proxy. In the debugger, each proxy instance is named $proxy0 with different ids. Can someone please elaborate on this? Specifically, the Proxy instance is created using the target object. Thus, how can each proxy instance have the same name, when different target objects (of the same type though) are used to construct the Proxy object? Is the Proxy instance the same regardless of the target object?
    I : interface
    T: target class
    pseudo thing:
    <code>
    T t1, t2, t3 ... new ...
    I i1 = (I) Proxy.newInst...(..., ..., t1)
    I i2 = (I) Proxy.newInst...(..., ..., t2)
    I i3 = (I) Proxy.newInst...(..., ..., t3)
    Each i has name $proxy0 with different id. For instance: i1-> $proxy0 id=68, i2 ->$proxy0 id= 32, etc.
    </code>
    Insight is appreciated!

    is it the same proxy that is instantiated three times (obviously)?It is the same proxy class that is instantiated three times. Obviously. Because that is the only meaning for 'instantiate' in Java.
    But how can that be when the target object for each Proxy instance is different?Because they are three different instances of the same class, each with a different target object.
    What's the problem here?

  • Any example for ENQUEUE_ARRAY for JMS compatible messages?

    Is there any examples of using ENQUEUE_ARRAY with messages that are compatible with JMS? either a VARRAY or NESTED TABLE of JMS content?
    I have an after insert trigger that propagates to JMS and in the for each row loop I'd much rather enqueue as a batch than for each individual message.
    It's hard enough getting JMS compatible content working where you are enqueuing just a single message but just what's involved to get this working with batches of JMS compatible messages?

    Hi prajithparan,
    Thanks for the response. I already looked at the link and a few other links in this forum that are related to array inserts/updates. However, I could not find answers to my specific questions. I am specifically concerned with the setup of parameters to the API calls (OCIBindByName and OCIBindArrayOfStruct) that fully reflects the two-dimensional nature of the array of structs that I am trying to insert.
    Moreover, I need to set the data type of the columns to be inserted as SQLT_STR. I think this data type requires the programmer to supply the length of the null terminated C strings as well. If we are inserting just one column, we can provide the length of each of the strings to be inserted into a VARCHAR2 column as part of a OCIBind call, for each of those columns.
    Since in an array insert, we are supplying multiple rows at the same time, how do we supply the lengths of strings to be inserted ? Should it be some form of two-dimensional array ?
    I could not get clear answers to these questions from either the Oracle documentation or the links on this forum. May be the answers are there and I am just missing them ?

  • Wrap Stub with dynamic proxy?

    Hi All,
    I am looking for the answer of this question from couple of days.
    I want to create an Interceptor chains on RMI level for an EJB client communicating with an Application server.
    This client can communicate using RMI/JRMP or RMI/IIOP, nevertheless the semantics is RMI.
    I want to wrap the stub on client side (Maybe static stub already placed on classpath / dynamic downloaded stub) with dynamic proxy and
    want to apply some interceptors on it before actual invocation of method.
    Is there anyway to wrap stubs with dynamic proxy in any existing client(with no source code only binary form)?

    EJP wrote:
    But you're not doing that. You are casting String to Comparable.Why do you think so?
    System.out.print("Proxy is instance of Comparable? ");
    System.out.println(Proxy.newProxyInstance(Comparable.class.getClassLoader(), new Class[] { Comparable.class },new Proxer(new String("String1"))) instanceof Comparable);
    System.out.print("Proxy is instance of String? ");
    System.out.println(Proxy.newProxyInstance(Comparable.class.getClassLoader(), new Class[] { Comparable.class },new Proxer(new String("String1"))) instanceof String);
    System.out.print("Proxy is instance of Object? ");
    System.out.println(Proxy.newProxyInstance(Comparable.class.getClassLoader(), new Class[] { Comparable.class },new Proxer(new String("String1"))) instanceof Object);
    Output:
    Proxy is instance of Comparable? true
    Proxy is instance of String? false
    Proxy is instance of Object? true

  • RMI Dynamic Proxy

    I have run across a couple of ways to create an RMI server that is a dynamic proxy but, I was wondering if there was a Sun sanctioned way to do this? I have also seen some hints that maybe this would be in the 1.4 JDK but, I can't find it in the 1.4 JDK anywhere.
    Any help would be appreciated.

    I think they were planning to eliminate rmic in JDK 1.4 and use dynamic proxies for stubs instead. There are ways to export a dynamic proxy object but as far as I remember you have to use (or even tweak?) Sun code to do it, to associate the correct stub with the object.

  • Web Service Proxy with Dynamic IP and Port

    hi,
    I am currently looking at the Web Service Proxy generation in JDev 11g. I can generate proxies fine, but the proxies are generated with static host and port. I want to substitute the host and port during runtime if required, for instance read the values from a database. I need to do this to avoid compiling the application for every deployment we make dev, test and production. Is there an easy way to set the generated proxy host and port? Are there any examples?
    Thanks in advance!
    Stephen

    Hi,
    Maybe you should have a look on XML Catalogs feature, but I am not sure if JDeveloper support it and how to support it.
    -LJ

  • Why cannot execute DB operation at client side with dynamic proxy?

    I want to execute a DB operation at client side with dynamic proxy. that is bypass EJBs to execute DB operation. And there is a data source in weblogic server, and I get an EJB instance using dynamic proxy, get connection using this instance, then invoke executeQuery method. But it is failed, and throw exception when execute "conn.setAutoCommit(false)" as below:
    <Caused by: weblogic.rmi.extensions.RemoteRuntimeException: Unexpected Exception - with nested exception:
    [java.rmi.UnmarshalException: Could not unmarshal method ID; nested exception is:
    java.rmi.UnmarshalException: Method not found: 'newArrayDataResultSet(Loracle.sql.ARRAY;JILjava.util.Map;)']
    at weblogic.jdbc.rmi.internal.ConnectionImpl_weblogic_jdbc_wrapper_PoolConnection_oracle_jdbc_driver_OracleConnection_813_WLStub.setAutoCommit(Unknown Source)
    at weblogic.jdbc.rmi.SerialConnection_weblogic_jdbc_rmi_internal_ConnectionImpl_weblogic_jdbc_wrapper_PoolConnection_oracle_jdbc_driver_OracleConnection_813_WLStub.setAutoCommit(Unknown Source)>
    but it is no exception and run well using EJB, who can tell me why? if it is a weblogic limitation? and my version of WLS is 8.1 sp3

    Hi,
    Do you create the connection object on the server and pass it over to the client, we do not allow passing the connection object over the wire.

  • Any example for Timed ShellScript Discovery with PowerShell Discovery Probe?

    Hi all,
    Kris Bash provided a unix authoring library with many examples for dynamic discoveries for Unix/Linux (Unix/Linux Authoring
    Library). What I am missing here is a timed shell script discovery, using a powershell discovery probe for creating discovery data. There is only a PropertyBag Discovery available.
    Maybe one of you has already implemented such a discovery and can provide this as an example? I tried some things but so far it is not working.
    The idea behind this is to execute a shell script on a linux host that returns several lines. The output should then be parsed by a powershell script that - depending on the output - creates different class instances. Any ideas?
    Regards,
    Holger

    Holger,
    See the blog post here (http://operatingquadrant.com/2011/03/24/operations-manager-%e2%80%93-extending-unixlinux-monitoring-with-mp-authoring-%e2%80%93-part-iii/)
    for an example of using the PowerShellDiscoveryProbe.  It doesn't matter whether this follows a Shell Command or a Shell Script probe, as in both cases you are passing the StdOut output as a parameter to the PowerShell script.  You would parse StdOut
    just as you do in the PropertyBag examples, but use the MOMApi calls to create and return the class instances and properties.
    I hope this helps,
    Kris
    www.operatingquadrant.com

  • Req any examples of how to use a USB midi controller​/keyboards with Labview TIA

    Req any examples of how to use a USB midi controller/keyboards with Labview TIA

    Hi,
    To access the MIDI ports you will need to call the Windows SDK. To send MIDI commands is relatively easy, here is an example that shows you how to send data to a MIDI controller or keyboard.
    As far as input goes, this is the hard part. There are a series of functions that you need to call to open up the device, set some buffers and and possibly a callback to get notifications on the incoming data.
    Reading MIDI data will not be an easy task, your best bet will be to implement this in a DLL and call that DLL in LabVIEW, there should be some code available o the web.
    = "http://msdn.microsoft.com/library/default.asp?url​=/library/en-us/multimed/htm/_win32_multimedia_... is a link to the Windows multimedia functions that you could use for MIDI input.
    Let me know if you have any further questions.
    Regards,
    Juan Carlos
    N.I.

  • Req any examples of high to use midi controller/keyboards with Labview TIA

    Req any examples of high to use midi controller/keyboards with Labview TIA

    [email protected];
    Check the following:
    Communicating with a Windows MIDI Device in LabVIEW
    Regards;
    Enrique
    www.vartortech.com

  • In Data Quality transform please explain Associate transform with the help of any example.

    In Data Quality transform please explain Associate transform with the help of any example.

    Hi Neha,
    If we are using multiple match transforms and consolidate the final output we will use associate transform .
    Let me explain with one example based on data quality blue prints for USA .
    We have customer/vendor data .     We need to find the duplicates .
    1. First  we will find the duplicates  on   Name and Address
    2. Second  we will find the duplicates on Name and Email
    3. Third we will find the duplicates on Name and Phone
    Here why we need to find the duplicates in multiple stages . If we are finding the duplicates on combination of  Name, Address, Email and Phone  we may not get proper duplicates   as we are finding the potential duplicates . That's why we are finding the duplicates on different combinations .
    In this case we will get the different group numbers for each match combination . Each combination name is there .
    We want to consolidate and give the group number to the whole set of duplicates . We will pass these  3 match groups to associative transform and generate the  consolidated match group for the input data.
    I hope you understand the concept .
    Thanks & Regards,
    Ramana.

  • How can I use the ni-6024-e with the real time of matlab/simulink. Where can I find any example?

    I am doing the final project and I need to control the ni-6024-e with the RTW (real time) of matlab/simulink.
    Does anyone know or have any example?.
    Thanks

    Rafelmor,
    Have you contacted The MathWorks yet? They probably have the best information.
    However, I did a quick search and found some information on The MathWorks' site. For Data Acquisition Toolbox examples: http://www.mathworks.com/access/helpdesk/help/toolbox/daq/daq_example_index.shtml.
    For RTW information: http://www.mathworks.com/support/product/RT/.
    Good luck with your application.

  • Are there any DAQmx examples available for use with pci 6229 M series card?

    I have been searching around for examples which work with the pci 6229 M series DAQ card. Most examples do not list this card as applicable and the one I have found gives an error. Is there anywhere specifically available, what I am particularly interested in is seeing an analogue channel being triggered by another analogue channel reaching a certain value.
    Thanks
    Kevin

    Hi Kejoglo,
    You are right in the fact that the M-Series card is newer than LabVIEW (and therefore the examples that are shipped with it) and therefore the example finder doesn't list the M-Series cards in the list of available hardware.
    Basically though, the M-Series cards work with DAQmx and not Traditional DAQ so if you just go into the example finder and search under Hardware Input and Output>>DAQmx and choose an example from that folder to run on your M-Series card. As long as you don't try to do anything outside of the specifications of your card (which I doubt you will do) then you shouldn't have any trouble running any of the DAQmx examples on an M-Series card.
    Hope this helps, if you still have problems then please feel free to write back.
    Best regards,
    Peter H
    Applications Engineer
    National Instruments UK

  • Problem using CORBA clients with RMI/EJB servers..!!!???

    Hi,
    I have a question on using EJB / or RMI servers with CORBA clients using
    RMI-IIOP transport, which in theory should work, but in practice has few
    glitches.
    Basically, I have implemented a very simple server, StockTreader, which
    looks up for a symbol and returns a 'Stock' object. In the first example, I
    simplified the 'Stock' object to be a mere java.lang.String, so that lookup
    would simply return the 'synbol'.
    Then I have implemented the above, as an RMI-IIOP server (case 1) and a
    CORBA server (case 2) with respective clients, and the pair of
    client-servers work fine as long as they are CORBA-to-CORBA and RMI-to-RMI.
    But the problem arises when I tried using the RMI server (via IIOP) with the
    CORBA client, when the client tries to narrow the object ref obtained from
    the naming service into the CORBA idl defined type (StockTrader) it ends up
    with a class cast exception.
    This is what I did to achieve the above results:
    [1] Define an RMI interface StockTrader.java (extending java.rmi.Remote)
    with the method,
    public String lookup( String symbol) throws RMIException;
    [2] Implement the StorckTrader interface (on a PortableRemoteObject derived
    class, to make it IIOP compliant), and then the server to register the stock
    trader with COS Naming service as follows:
    String homeName =....
    StockTraderImpl trader =new StockTraderImpl();
    System.out.println("binding obj <" homeName ">...");
    java.util.Hashtable ht =new java.util.Hashtable();
    ht.put("java.naming.factory.initial", args[2]);
    ht.put("java.naming.provider.url", args[3]);
    Context ctx =new InitialContext(ht);
    ctx.rebind(homeName, trader);
    [3] Generate the RMI-IIOP skeletons for the Implementation class,
    rmic -iiop stock.StockTraderImpl
    [4] generate the IDL for the RMI interface,
    rmic -idl stock.StockTraderImpl
    [5] Generate IDL stubs for the CORBA client,
    idlj -v -fclient -emitAll StockTraderImpl.idl
    [6] Write the client to use the IDL-defined stock trader,
    String serverName =args[0];
    String symList =args[1];
    StockClient client =new StockClient();
    System.out.println("init orb...");
    ORB orb =ORB.init(args, null);
    System.out.println("resolve init name service...");
    org.omg.CORBA.Object objRef
    =orb.resolve_initial_references("NameService");
    NamingContext naming =NamingContextHelper.narrow(objRef);
    ... define a naming component etc...
    org.omg.CORBA.Object obj =naming.resolve(...);
    System.out.println("narrow objRef: " obj.getClass() ": " +obj);
    StockTrader trader =StockTraderHelper.narrow(obj);
    [7] Compile all the classes using Java 1.2.2
    [8] start tnameserv (naming service), then the server to register the RMI
    server obj
    [9] Run the CORBA client, passing it the COSNaming service ref name (with
    which the server obj is registered)
    The CORBA client successfully finds the server obj ref in the naming
    service, the operation StockTraderHelper.narrow() fails in the segment
    below, with a class cast exception:
    org.omg.CORBA.Object obj =naming.resolve(...);
    StockTrader trader =StockTraderHelper.narrow(obj);
    The <obj> returned by naming service turns out to be of the type;
    class com.sun.rmi.iiop.CDRInputStream$1
    This is of the same type when stock trader object is registered in a CORBA
    server (as opposed to an RMI server), but works correctly with no casting
    excpetions..
    Any ideas / hints very welcome.
    thanks in advance,
    -hari

    On the contrary... all that is being said is that we needed to provide clearer examples/documentation in the 5.1.0 release. There will be no difference between the product as found in the service pack and the product found in the 5.1.1. That is, the only substantive will be that 5.1.1 will also
    include the examples.
    "<=one way=>" wrote:
    With reference to your and other messages, it appears that one should not
    expect that WLS RMI-IIOP will work in a complex real-life system, at least
    not now. In other words, support for real-life CORBA clients is not an
    option in the current release of WLS.
    TIA
    "Eduardo Ceballos" <[email protected]> wrote in message
    news:[email protected]...
    We currently publish an IDL example, even though the IDL programmingmodel in Java is completely non-functional, in anticipation of the support
    needs for uses who need to use IDL to talk to the Weblogic server,
    generically. This example illustrates the simplest connectivity; it does not
    address how
    to integrate CORBA and EJB, a broad topic, fraught with peril, imo. I'llnote in passing that, to my knowledge, none of the other vendors attempt
    this topic either, a point which is telling if all the less happy to hear.
    For the record then, what is missing from our distribution wrt RMI-IIOPare a RMI-IIOP example, an EJB-IIOP example, an EJB-C++. In this you are
    correct; better examples are forth coming.
    Still, I would not call our RMI-IIOP implementation fragile. I would saythat customers have an understandably hard time accepting that the IDL
    programming model is busted; busted in the sense that there are no C++
    libraries to support the EJB model, and busted in the sense that there is
    simply no
    support in Java for an IDL interface to an EJB. Weblogic has nothing to doit being busted, although we are trying to help our customers deal with it
    in productive ways.
    For the moment, what there is is a RMI (over IIOP) programming model, aninherently Java to Java programming model, and true to that, we accept and
    dispatch IIOP request into RMI server objects. The way I look at it is this:
    it's just a protocol, like HTTP, or JRMP; it's not IDL and it has
    practically nothing to do with CORBA.
    ST wrote:
    Eduardo,
    Can you give us more details about the comment below:
    I fear that as soon as the call to narrow succeeds, the remainingapplication will fail to work correctly because it is too difficult ot
    use an idl client in java to work.It seems to me that Weblogic's RMI-IIOP is a very fragile
    implementation. We
    don't need a "HelloWorld" example, we need a concrete serious example(fully
    tested and seriously documented) that works so that we can get a betteridea
    on how to integrate CORBA and EJB.
    Thanks,
    Said
    "Eduardo Ceballos" <[email protected]> wrote in message
    news:[email protected]...
    Please post request to the news group...
    As I said, you must separate the idl related classes (class files and
    java
    files) from the rmi classes... in the rmic step, you must set a newtarget
    (as you did), emit the java files into that directory (it's not clearyou
    did this), then remove all the rmi class files from the class path... ifyou
    need to compile more classes at that point, copy the java files to theidl
    directly is you must, but you can not share the types in any way.
    I fear that as soon as the call to narrow succeeds, the remainingapplication will fail to work correctly because it is too difficult otuse
    an idl client in java to work.
    Harindra Rajapakshe wrote:
    Hi Eduardo,
    Thanks for the help. That is the way I compiled my CORBA client, by
    separating the IDL-generated stubs from the RMI ones, but still I
    get a
    CORBA.BAD_PARAM upon narrowing the client proxy to the interfacetype.
    Here's what I did;
    + Define the RMI interfaces, in this case a StockTrader interface.
    + Implement RMI interface by extendingjavax.rmi.PortableRemoteObject
    making
    it IIOP compliant
    + Implemnnt an RMI server, and compile using JDK1.2.2
    + use the RMI implementation to generate CORBA idl, using RMI-IIOPplugin
    utility rmic;
    rmic -idl -noValueMethods -always -d idl stock.StockTraderImpl
    + generate Java mappings to the IDL generated above, using RMI-IIOPplugin
    util,
    idlj -v -fclient -emitAll -tf src stocks\StockTrader.idl
    This creates source for the package stock and also
    org.omg.CORBA.*
    package, presumably IIOP type marshalling
    + compile all classes generated above using JDK1.2.2
    + Implement client (CORBA) using the classes generated above, NOTthe
    RMI
    proxies.
    + start RMI server, with stockTrader server obj
    + start tnameserv
    + start CORBA client
    Then the client errors when trying to narrow the obj ref from the
    naming
    service, into the CORBA IDL defined interface using,
    org.omg.CORBA.Object obj =naming.resolve(nn);
    StockTrader trader =StockTraderHelper.narrow(obj); // THIS
    ERRORS..!!!
    throwing a CORBA.BAD_PARAM exception.
    any ideas..?
    Thanks in advance,
    -hari
    ----- Original Message -----
    From: Eduardo Ceballos <[email protected]>
    Newsgroups: weblogic.developer.interest.rmi-iiop
    To: Hari Rajapakshe <[email protected]>
    Sent: Wednesday, July 26, 2000 4:38 AM
    Subject: Re: problem using CORBA clients with RMI/EJBservers..!!!???
    Please see the post on june 26, re Errors compiling... somewherein
    there,
    I suspect, you are referring to the rmi class file when you are
    obliged
    to
    completely segregate these from the idl class files.
    Hari Rajapakshe wrote:
    Hi,
    I have a question on using EJB / or RMI servers with CORBA
    clients
    using
    RMI-IIOP transport, which in theory should work, but in practice
    has
    few
    glitches.
    Basically, I have implemented a very simple server,
    StockTreader,
    which
    looks up for a symbol and returns a 'Stock' object. In the firstexample, I
    simplified the 'Stock' object to be a mere java.lang.String, so
    that
    lookup
    would simply return the 'synbol'.
    Then I have implemented the above, as an RMI-IIOP server (case
    1)
    and a
    CORBA server (case 2) with respective clients, and the pair of
    client-servers work fine as long as they are CORBA-to-CORBA andRMI-to-RMI.
    But the problem arises when I tried using the RMI server (via
    IIOP)
    with
    the
    CORBA client, when the client tries to narrow the object ref
    obtained
    from
    the naming service into the CORBA idl defined type (StockTrader)
    it
    ends
    up
    with a class cast exception.
    This is what I did to achieve the above results:
    [1] Define an RMI interface StockTrader.java (extending
    java.rmi.Remote)
    with the method,
    public String lookup( String symbol) throws RMIException;
    [2] Implement the StorckTrader interface (on a
    PortableRemoteObject
    derived
    class, to make it IIOP compliant), and then the server to
    register
    the
    stock
    trader with COS Naming service as follows:
    String homeName =....
    StockTraderImpl trader =new StockTraderImpl();
    System.out.println("binding obj <" homeName ">...");
    java.util.Hashtable ht =new java.util.Hashtable();
    ht.put("java.naming.factory.initial", args[2]);
    ht.put("java.naming.provider.url", args[3]);
    Context ctx =new InitialContext(ht);
    ctx.rebind(homeName, trader);
    [3] Generate the RMI-IIOP skeletons for the Implementation
    class,
    rmic -iiop stock.StockTraderImpl
    [4] generate the IDL for the RMI interface,
    rmic -idl stock.StockTraderImpl
    [5] Generate IDL stubs for the CORBA client,
    idlj -v -fclient -emitAll StockTraderImpl.idl
    [6] Write the client to use the IDL-defined stock trader,
    String serverName =args[0];
    String symList =args[1];
    StockClient client =new StockClient();
    System.out.println("init orb...");
    ORB orb =ORB.init(args, null);
    System.out.println("resolve init name service...");
    org.omg.CORBA.Object objRef
    =orb.resolve_initial_references("NameService");
    NamingContext naming=NamingContextHelper.narrow(objRef);
    ... define a naming component etc...
    org.omg.CORBA.Object obj =naming.resolve(...);
    System.out.println("narrow objRef: " obj.getClass() ":"
    +obj);
    StockTrader trader =StockTraderHelper.narrow(obj);
    [7] Compile all the classes using Java 1.2.2
    [8] start tnameserv (naming service), then the server to
    register
    the
    RMI
    server obj
    [9] Run the CORBA client, passing it the COSNaming service ref
    name
    (with
    which the server obj is registered)
    The CORBA client successfully finds the server obj ref in the
    naming
    service, the operation StockTraderHelper.narrow() fails in thesegment
    below, with a class cast exception:
    org.omg.CORBA.Object obj =naming.resolve(...);
    StockTrader trader =StockTraderHelper.narrow(obj);
    The <obj> returned by naming service turns out to be of the
    type;
    class com.sun.rmi.iiop.CDRInputStream$1
    This is of the same type when stock trader object is registeredin a
    CORBA
    server (as opposed to an RMI server), but works correctly with
    no
    casting
    excpetions..
    Any ideas / hints very welcome.
    thanks in advance,
    -hari

Maybe you are looking for

  • Questions on the Wireless Installation.

    Experts, We have a good number of wireless access point installed on our network and I want to make sure that these AP's are not conflicting with each other. Why do all the wireless access points show me the channel as 1(for 2.4 GHz)? and channel 36(

  • How to open dvd on iMac. will not open

    I am not able to play a dvd on my imac. please help.

  • EAP Authentication Configuration for EAP-FAST and PEAP

    Hi Everyone, I pretty much got EAP working, however using LEAP  When I get to EAP-FAST and PEAP, I just can't seem to get it to work What am I missing, I do know that EAP-FAST and PEAP involve certificates. However, how do i set them up on the client

  • Calendar, messages, mail all quit after installing OS 10.9.4

    I just purchased a macbook air 11" early 2014 on July 6.  When I set it up, a senior apple advisor helped me move the backup from my old macbook air onto the new one.  No problems.  Then we installed the 10.9.4 update and over the course of 3 days, w

  • T key dodgy

    Hi, Has anyone else experienced intermittent problems with the t key on their macbook pro. When I type the t in the word "type", for example the t does not appear but then when I go back to correct it it works fine. It's like it doesn't detect the fi