Interesting RMI question

It's been a while since I've visited this forum, and I'd like to pose a question.
The focus is on serailised arguments, and mobile code:
Can a 32-bit JVM interact with a 64-bit one?
It would seem the RMI libs could "translate on-the-fly" between architectures, but I understand that would be a substantial undertaking.
Any definitive answer?
Thanks,
John

Can a 32-bit JVM interact with a 64-bit one?What's stopping them? Java datatypes are identical, Serialization is identical, TCP is identical.
It's not a problem.

Similar Messages

  • An interesting synchronization question

    hey all, I have an interesting synchronization question to ask you.
    Suppose that I have 20 tasks and 8 worker threads, each worker is assigned a task by the main thread, and then main thread suspends until one worker has finished its task. Then main thread create another task and handles to a new worker thread until all tasks are finished.
    so code in main thread is something like this.
    boolean has_more_task, has_more_worker;
    do {
                  if (has_more_task && has_more_worker)
                               *  create new thread and assign it a new task
                  else if ( has_more_task && !has_more_worker)
                            wait();
                   else if ( !has_more_task && has_more_worker)
                              wait();
    } while (has_more_task || has_more_worker)the problem is that I don't quite familiar with synchronized key word. so I don't know how to share a synchronized vaiable between main thread and worker thread. can anybody do me a help?
    Remember that main thread should be waken up by either of the 8 worker threads !!

    you can follow producer consumer conept
    create a queue. main thread will push task in queue.
    and worker threads will consumer task from queue.
    you just need to synchronize operation on queue.
    when there is no task in queue then worker thread will notify to main thread and
    will call wait().
    then main thread again put the more task in queue and send notification signal to worker thread and then call wait().
    Class JobQueue
    //should be called by worker thread
    public synchronized getNextTask()
    //shoule be invoked by main thread
    public synchronized addMoreTask()
    }

  • Simple  RMI question

    I have completed reading tutorial...... i have understood How to code in RMI ?
    How you can interact with other JVM and call remote methods....basically you need to write code for RMIServer { //  it will have interface and classes which implemets those interfaces } and also a RMIClient .
    Client will look for rmiregistry and from the naming look up it will find out the remote object and then it calls the remote method.
    I have got some question after reading the tutorial
    Question 1:
    in the binding
    // implemented class in RMI server
    public class PowerServiceServer extends UnicastRemoteObject
    implements PowerService
    // blah blah
    Naming.bind ("PowerService", svr);   //  can i give  any name instead of  the Server  name  "PowerService"  ? 
    bcoz  i saw  another tutorial where  they have coded  like  below ....
    Naming.bind ("rmi://john/ServerName", svr);    //  note   "rmi :// "  ?  its different than above. why  "rmi://"  ?  Ho  many convention !!so It is misleading to me ......... can i give any name whatever i wish ( may not be SERVER name as well ) for Naming.bind ? like below
    Naming.bind ("abcdefghijklmnop", svr); // IS IT LEGAL ?
    or is there any convention or standard to follow ?
    OR do i need to write the path localtion of my server in that string ?
    like below...
    Naming.bind ("c:/packagename/RMIServer", svr); ?
    Plz correct me
    thank you

    You can use any name.yea......freedommmmmm............i like.
    //host:port/namewell , if i use this convention then it will be like...
    //CompName:1099/AnythingULike......right ?
    thanks ?kaj i am happy .
    I have some more queries.
    Question 2 :
    If you noticed my earlier post on "Stub and Skeleton" where ceil has given a fantastic explanation of what does this phrase means in programming point of view.
    In fact while reading RMI tutorial i came across these two words . But after reading the tutorial it seems to me Author is misusing these 2 words.
    see a comment from A CBT . i copied it in a notebook
    The server generates the stub and the skeleton. THE STUB resides on the client side and the skeleton on the server. In the recent version the generating skeleton are not required unless compatibality is required.
    To Generate stub and skeleton you can follow the command
    rmic myserver ( ???)
    plz note the statements which starts Capitalized . Its confusing .
    THE STUB resides on the client side and the skeleton on the server.No.
    Interfaces are there in the server code to make happy the compiler. so those are stubs and skeletons ( group of stubs) in the server.
    there is NO STUB in the client side. its wrong.
    To Generate stub and skeleton you can follow the command
    rmic myserver ( ???)wow ...what is this ? some tutorials dont tell about this at all !!
    i read a tutorial where they said the shortcut tips
    (compile all source files + start rmiregistry + run server + run client )....thats it !!
    tutorials are varryingggggggg.

  • RMI question

    Hi all,
    I am planning a client/server application, in which I want the server to accept multiple connections form clients each running in a its own separate thread.
    I plan to maintain each client connection object for the duration of the session.
    From my (limited) understanding of RMI, I need this conection class to implement an interface (also implemented by the client application) and have stubs for each of these objects on each machine the separate programs are running on.
    How (at a high level) do I go about creating each client connection on the fly and registering it? I can only find examples (so far) of cleint/server apps where the remote object already exist and the client simply looks it up.
    Thanks for any help provided - and sorry for any stupid mistakes , but I am new to this.
    cheers
    Jim

    What about registering? Obvisiously there would be
    only 1 FooFactory object, and this would be
    registered at start up, but what about the instances
    of Foo? You're getting a fully initialized stub back from the method call, so you shouldn't need to do anything special. You don't have to "find" it, because you already know where it came from!
    Give it a test and you should find it works. Drop another message here if you encounter problems.
    Dave.

  • A RMI question

    I try to write a distributed program using Java RMI technology to generate first 1000 numbers in the (sorted) sequence of numbers described below:
    a)1 is in the sequence
    b) If number X is in the sequence then so are the numbers 3*X, 5*X and 7*X
    c) No number appears more than once in the sequence, and
    d)No other number is in the sequence.
    Thus, first few numbers in the sequence are:
    1,3,5,7,9,15,21,25,27,35,45,49,63,75,81,105...
    I guess that i need to have 3 helper(remote server) objects to multiply the numbers by constants 3, 5 and 7, ie one helper object for each multiplier constant. The client process initially sends 1 - the first number in the sequence - to each helper(multiplier). A helper, at each stage, keeps the multiplication of the next number in its "input" sequence ready for the client to request. The client needs to perform a simple merge of numbers being generated by the helpers. At each step in the merge process, the client looks at the next number received from each helper. It selects the smallest of these numbers and includes it into the output sequence -- the number is displayed on screen for the user to read.
    Can anyone give me any idea on how to do this program? I'm sorry to write so long. If you are unclear, please inform me and i'll try to explain what the problem is. Thanks!

    That rule simply generates a sequence containing all numbers that have no prime divisors except 3, 5, and 7. So my approach would be to consider each integer in sequence and apply that test. I don't know why you'd want to use RMI for this problem.

  • Weblogic RMI question

    I am trying to implement a basic RMI class, using the example in "Programming Weblogic RMI" book. I used java rmic instead of wls rmic.
    The only difference from the book example is that I am tyring to bind remote object implementation from within a servlet GET/init. I am getting the following exception stack:
    java.security.AccessControlException: access denied (java.io.FilePermission <path>\user_projects\domains\my_domain\servers\my_ms1\tmp\_WL_user\MyApp\6210pw\war\WEB-INF\lib\_wl_cls_gen.jar read)
    at java.security.AccessControlContext.checkPermission(AccessControlConte
    xt.java:323)
    at java.security.AccessController.checkPermission(AccessController.java:
    546)
    I am not using a securitymanager explicitlty in my code, as adviced in the book.
    Please advise, what's going wrong here.

    I am trying to implement a basic RMI class, using the example in "Programming Weblogic RMI" book. I used java rmic instead of wls rmic.
    The only difference from the book example is that I am tyring to bind remote object implementation from within a servlet GET/init. I am getting the following exception stack:
    java.security.AccessControlException: access denied (java.io.FilePermission <path>\user_projects\domains\my_domain\servers\my_ms1\tmp\_WL_user\MyApp\6210pw\war\WEB-INF\lib\_wl_cls_gen.jar read)
    at java.security.AccessControlContext.checkPermission(AccessControlConte
    xt.java:323)
    at java.security.AccessController.checkPermission(AccessController.java:
    546)
    I am not using a securitymanager explicitlty in my code, as adviced in the book.
    Please advise, what's going wrong here.

  • Very basic RMI questions

    I am having troubles finding technical information about how RMI works, exactly. Specifically, I can't find out how the JVM and RMI is working on the remote machine.
    Say you have the server app running and 2 clients invoke the same method at the same time. Does the JVM create a new thread per request? Do these threads exist within the same JVM? (I believe both answers to be "yes"...)
    Basically, I have a program which causes the server to write a serialized objects to disk, and numerous clients are occasionally requesting these serialized objects from the server for remote processing. I want to be sure that the same file can't be served to more than one client.
    If someone can point to me a resource, I'd be delighted.
    Tony

    Your instincts are correct - the remote jvm will spawn separate threads for each incoming request, so you will have to provide some locking mechanism to ensure your serialized objects' state

  • Carmax Score Question and Interest Rate Question...

      So I have decided that I think I want to purchase my car at carmax and I wanted to see if someone with a similar credit profile had purchased from them and what was your interest rate I would like to try and get 3.49 or less on a 72 month loan My credit is as follows: 99k total credit92k available18k autol oan on time500 POLbk discharged May 2009 ...all on time since then29 inq My scores are around 685-710  income 195k (if they ask for stubs I will have a little problem because a chunk of my income comes from farmland and I have not received a K1 for 2015 yet, however I could show them a copy of a check over 100k if you think that would work)  I want to get a 70k car with tax,title, license and I want to put down 25k So I will finance 45k.... do you think I can get a lower interest rate with my bk on my file ? BTW Penfed gave me 1.99 on 60 months on my 18 autoloan Not sure if carmax lenders, since they are not a CU, will give me the best interest rate What do you think ?  Do you think they can give me a low rate (3.49 or lower)   Thank you!!

    mynameainttracy wrote:
    Our car was included in our payment plan and the trustee got our interest rate down. That wasn't anything we had any input on. The trustee got the interest rate on his own with no input or request from us. Makes sense... creditors have little choice in the matter when it comes to decisions made by the trustee and/or the judge. I was mainly talking about if you went to the lender and asked them to lower your interest rate because you were filing... as said I doubt they'd agree on a secured debt. 

  • Interesting G3 question.

    I recently purchased a 2610SA sata raid controller. Its a 64bit PCI card. I also have a b&w 400mhz G3 that I got from work because it has 3 64-bit PCI slots. I was wondering if there was any way at all to use aforementioned raid card in the G3. Its running OSX. I'm not sure what version as its password locked and I'm in the middle of tracking down an install disk to boot up and remove the password.
    This brings up a few other questions. Firstly, I know you have to hold C to boot off of a CD, however, does it have to be an Apple brand keyboard? I only have USB keyboards built for windows (windows key on them), is that an issue?
    Additionally, if it was not possible to use the raid controller with OSX, would it be possible to use it if I installed some flavor of Linux on it?
    I don't know much about Macs and thought this would be a great opportunity to not only learn more about them, but to also get a nice file server running on my network.

    The Blue & White G3 uses its ADB keyboard as its "native" keyboard. The USB keyboard driver loads too late to allow the use of keyboard startup codes from a USB keyboard, but most of the rest of it should work once the Mac is up and running. Keyboard shortcuts and macros may be a problem.
    So pressing the C key at startup will not cause it to boot from a CD, because the key will not be seen until the USB driver loads off the Hard Drive.
    That SATA controller may work, but unless it is a Mac-specific controller, it will not be bootable. The software to boot the Mac must be present in the firmware of the controller card to be bootable on a Mac. Loading Linux or any other Operating System will not change that.
    You will need a "regular" drive on a Mac Controller (such as the built-in IDE Controller) to boot it up.

  • Interesting Java Questions. Need answers Pls

    Hi All,
    I have come accross few java question, could any one please provide best answers please?
    1. Why the wait() method is there in the Object class? Not in the Threads?
    2. Why JDBC has all interfaces & not classes?
    3. Which type of collection do u prefer to make the incoming objects in sort order?
    4. Why the hasCode() method should be implemented if we are overiding the equals(0 method?
    Please provide me best answers ASAP.
    Girish.K

    do u prefer tohttp://www.catb.org/~esr/faqs/smart-questions.html#writewell
    How To Ask Questions The Smart Way
    Eric Steven Raymond
    Rick Moen
    Write in clear, grammatical, correctly-spelled language
    We've found by experience that people who are careless and sloppy writers are usually also careless and sloppy at thinking and coding (often enough to bet on, anyway). Answering questions for careless and sloppy thinkers is not rewarding; we'd rather spend our time elsewhere.
    So expressing your question clearly and well is important. If you can't be bothered to do that, we can't be bothered to pay attention. Spend the extra effort to polish your language. It doesn't have to be stiff or formal - in fact, hacker culture values informal, slangy and humorous language used with precision. But it has to be precise; there has to be some indication that you're thinking and paying attention.
    Spell, punctuate, and capitalize correctly. Don't confuse "its" with "it's", "loose" with "lose", or "discrete" with "discreet". Don't TYPE IN ALL CAPS; this is read as shouting and considered rude. (All-smalls is only slightly less annoying, as it's difficult to read. Alan Cox can get away with it, but you can't.)
    More generally, if you write like a semi-literate b o o b you will very likely be ignored. So don't use instant-messaging shortcuts. Spelling "you" as "u" makes you look like a semi-literate b o o b to save two entire keystrokes.

  • 2 RMI Questions:"RMI and Marshalling" and...........

    Hi,
    Its not a programming Q. but its a conceptual Q. In all most all the websites related to RMI, I have seen refrence of Marshalling in the context of data encoding. In socket programming, we also do data transfer but there is no Marshalling? What is the reason of Marshalling in RMI? Is it because of Java to Java communication and for socket we use TCP/IP so we leave the Marshalling to the Network Interface Card??
    Zulfi.

    Thanks for your reply. Ok Marshalling is clear but I have to run a program and then we will discuss more about Marshalling. However after reading the doc specially about stubs
    The caller invokes a method on the local stub which is responsible for carrying out the method call on the remote object.
    In one other doc, I read the samething about dispatcher. Each machine has a local dispatcher . The client communicates with local dispatcher which then communicates with remote dispatcher and then returns a communication channel back to client via local dispatcher. So is it that these stubs and skeletons are basically the dispatcher component?
    In one other doc., http://cs.gmu.edu/~setia/cs571/slides/rmi-proj.pdf , I found that there is no dispatcher component on the client side? Which is correct?
    Zulfi.

  • Trying to understand threads; interesting synchronize question

    Ladies and Gentlemen,
    what would happen if:
    class c {
    public synchronized void a() {
    //do some stuff
    b();
    public synchronized void b() {
    // do some stuff
    this should cause a deadlock situation, should it not? The compiler doesnt complain when I try this.
    Can someone confirm if this is correct:
    any class method can be synchronized; it doesnt have to be a method in a thread you ahve created. Presumable, this method and its object are being manipulated by threads, so synchronization of data is necessary. I have a program that has multiple threads. Each thread get a reference to manager object (there is one object for all the threads, not one for each). Each thread has its own instance of an analysis object. The analysis object takes teh reference to the manager object in its constructor, so the end result is mulitple threads each have their own analysis object, and all of these objects point to one manager object. I want the methods of the manager object to be synchronized to avoid read/write conflicts and inconsistencies.
    Thank you in advance

    You are right it is not officially deadlock. but it
    is a situation that will produce an error if one is
    not careful. b is called in a, and they both require
    a lock, so the processing in b cant be done while a is
    running. No, I'm telling you that is not the case. You can call b() from a() because if a thread is in a() it already has the lock needed to call b(). There is no possiblity of deadlock with the code you have written.
    In order for a deadlock to be possible, you'd need to do something like this:
    class Example
       final lockObjectA = new Object();
       final lockObjectB = new Object();
       void a()
          synchronized(lockObjectA)
              b();
       void b()
          synchronized(lockObjectB)
              a();
    }

  • Interesting SQL Question

    I have a SQL query problem. I need expert's advice on this.
    I have following Table (Retail) in the Database.
    Retailer_id Number (36)
    HighNo char (10)
    LowNo char (10)
    HighNo and LowNo columns can have digits and regular characters. Sample Data: 48A, 100, 10021.
    My query supposed to get retailer_ids in a certain range of High and Lownos.
    For example, between 1000 and 1020 or between 28A and 48B.
    Only way to do this is
    Select Retailer_id
    from Retail
    where LowNo <= :mylow
    AND HighNo>= :myhigh
    AND LENGTH (RTRIM(LowNo) ) = LENGTH (:mylow)
    AND LENGTH (RTRIM (HighNo) ) = LENGTH (:myHigh)
    Is there any better way?
    Thanks in advance
    null

    I have a SQL query problem. I need expert's advice on this.
    I have following Table (Retail) in the Database.
    Retailer_id Number (36)
    HighNo char (10)
    LowNo char (10)
    HighNo and LowNo columns can have digits and regular characters. Sample Data: 48A, 100, 10021.
    My query supposed to get retailer_ids in a certain range of High and Lownos.
    For example, between 1000 and 1020 or between 28A and 48B.
    Only way to do this is
    Select Retailer_id
    from Retail
    where LowNo <= :mylow
    AND HighNo>= :myhigh
    AND LENGTH (RTRIM(LowNo) ) = LENGTH (:mylow)
    AND LENGTH (RTRIM (HighNo) ) = LENGTH (:myHigh)
    Is there any better way?
    Thanks in advance
    null

  • Interesting naming question-Keyword: Factory, Instance

    Although I have written Java for a year, I still can't find this answer. What exactly means Factory, Instance in Java?
    Why use these two words in some classes, say SAX, JCE KeyGeneratorFactory, KeyGenerator? What implies relation between two class from naming?

    Factory relates to the Factory design pattern as described by the Gang of Four (GOF). Check out any design patterns resource for this pattern to get a more complete answer.
    Essentially, though, a Factory constructs an instance of a class for you. The exact class returned is determined by the factory (for example, DocumentBuilderFactory uses a system property to get the name of the class to instantiate).
    Another example is javax.swing.BorderFactory which simply instantiates TitledBorder, EmptyBorder etc instances based on the method you called.
    Hope this helps.

  • 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

  • Missing table entries: BSEG

    hie gurus after altering a field structure for BSEG i have noticed that some transactions went missing however i was able to get some of them from tables BKPF(document header) BSIS(2ndry index for G/L accounts) and BSAS(2ndry index for cleared items)

  • How to remove a favorite on Home Page

    We have a favorite listed on that we would like to remove from Yahoo Home Page. This is in Favorites NOT bookmarks.

  • Dynamic select list as APEX plug-in custom attribute?

    I'm developing a region plug-in in APEX 4.0.1. I wanted to make one of the custom attributes a select list where the options offered were the current application list templates (queried from the <tt>apex_application_temp_list</tt> view: the rendered

  • Simple offset - syntax error

    I get a syntax error doing this. calmoyr1 = request->get_form_field( 'calmoyr' ). calyr = calmoyr1+0(4). calmo = calmoyr1+4(2) - 2. concatenate calyr calmo into calmoyr1. I tried to declare calmo and calyr as N but it still gives me error.

  • Create a Room in Collaboration

    Hi Everybody, my purpose is to create a room which can be shown within the standard page Department Info Pages of the workset Company. I have create an own Template which is based on the workset SAP_Information_Site. After creating a new room based o