Simple rmi-ejb question

Hi all!
I'm a new to ejb, just started, for the beginning got an exception:
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial
     at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:640)
     at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
     at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:280)
     at javax.naming.InitialContext.lookup(InitialContext.java:347)
     at SimpleEjbTest.main(SimpleEjbTest.java:19)when trying to
  private static Context getInitialContext(String url, String user, String password) throws
      NamingException {
    Hashtable h = new Hashtable();
//    h.put(Context.INITIAL_CONTEXT_FACTORY,
//          "WHAT IS HERE?????");
    h.put(Context.PROVIDER_URL, url);
    h.put(Context.SECURITY_PRINCIPAL, user);
    h.put(Context.SECURITY_CREDENTIALS, password);
    return new InitialContext(h);
  }What to put into INITIAL_CONTEXT_FACTORY?
Or you know easier way to make an InitialContext?
Using jndi.properties? But what should it be then??
Please help!
Thanks a lot to alL!!
Best regards, Boris.

well, since you don't specify your app server, how's this?
weblogic.jndi.WLInitialContextFactory
if that doesn't work, try this
com.inprise.j2ee.jndi.CtxFactory
if that doesn't work, try this
com.evermind.server.rmi.RMIInitialContextFactory
if that doesn't work, try this
org.jnp.interfaces.NamingContextFactory
if that doesn't work, try this
com.ibm.websphere.naming.WsnInitialContextFactory
And if that doesn't work, look through your docs again, or maybe try google. Note that whatever you do, you have to have the appropriate jars on your classpath.
Good Luck
Lee

Similar Messages

  • Simple Java EJB question.

    When it comes to EJB v3 Remote and Local interfaces,
    (With JBoss EJB Container Software in mind, for this question,)
    -Does the Remote interface for the EJB include method signatures from the Bean class
    -that are to be seen
    -that are to be hidden?
    -Does the Local interface for the EJB include method signatures from the Bean class
    -that are to be seen
    -that are to be hidden?
    Which is which for
    -EJB 2.1 ?
    -EJB 3.x ?
    - is EJB 3.x reverse compatible in that it allows use of the javax.ejb.* interfaces,
    and would accept a EJB 2.1 approach, or does it force one to use Annotations
    exclusively?
    Edited by: Zac1234 on Jul 21, 2010 5:21 PM

    muiajc wrote:
    I know this is a simple question, but I can't search for the answer to this because it involves syntax that Google and the like don't seem to search for..
    I am trying to figure out some Java code that I have found. I would like to know what:
    a[--i] and a[++j] mean.
    It mean increase/decrease the int i/j by 1. This is done before it gets you the value of a[]. for example if i=5 and you said a[--i] it is really a[4] and i is now equal to 4;

  • Using JNI with RMI/EJB.

    Hi,
    I am using JNI to interface with a c application.
    The problem is that c application is thread safe.
    Since i need to use this interface from RMI/EJB,
    multiple calls will be made simultaneosly on the
    c application.
    Will anyone tell me how do i handle this scenario?
    Thanks in Advance.
    Robin

    Is the ejb expect immediate result from the c application?
    If yes, I don't know. Perhaps you need to redesign your business logic so it will not expect immediate result from c.
    If no, then make a layer between the ejb and c. The layer would be message queuer application with JMS receiver. EJB will send JMS to the JMS receiver when it needs to execute c. You can queue the message so c application is executed without overlap. If the EJB expect the result from c, then the queuer can send it back using JMS.

  • Simple RMI application

    Hi all
    I've wrote a simple RMI application; I've made a stub and a skeleton and I've started a rmiregistry; when I'm execute a server, I have this exception:
    java.rmi.UnmarshalException: error unmarshalling arguments; ecc.
    Where is the problem?

    Ok, but I'm a student and my teacher wants ....I'm 49 years old and have blond, long hair (other call it grey, but they are
    loonies) and I drive a Ford that doens't want to start when it's freezing
    but that's still no excuse for the RMI mechanism not to work properly ;-)
    Anyway, the problem was an sub-directory; now I catch a
    ConnectException: connection refused (to 127.0.0.1);
    any ideas?Yep, you have to start the server part first and then start your client. I also
    suspect that you don't have the 'rmiregistry' running ... (we can talk about
    that later).
    kind regards,
    Jos

  • SIMPLE RMI PROB

    I have created a very simple rmi test class passing a bk obkect to a remote library class - the code is below but i keep getting the oops error as specified in the client class - any ideas would be appreciated.
    public class bk{
    String st;
    public bk(String s){
    st=s;
    import java.rmi.*;
    public interface libint extends Remote{
    public void addbook(bk b)throws RemoteException;
    import java.rmi.*;
    import java.rmi.server.*;
    import java.util.*;
    public class lib extends UnicastRemoteObject implements libint{
    Vector v;
    public lib()throws RemoteException{
    Vector v = new Vector();
    System.out.println("lib created");
    public void addbook(bk b){
    v.add(b);
    System.out.println("BOOK ADDED");
    import java.rmi.Naming;
    public class Server{
    public static void main(String args[]){
    try{
    Naming.rebind("libs", new lib());
    System.out.println("System ready");
    catch(Exception e){}
    import java.rmi.Naming;
    public class client{
    public static void main(String args[]){
    try{
    bk b = new bk("john");
    libint li = (libint)Naming.lookup("//127.0.0.1/libs");
    li.addbook(b);
    }catch(Exception e){System.out.println("oops2");}

    I kind of guessed it was something to do with the addbook method but i have no idea why - any suggestions would again be welcome - cheers
    java.lang.NullPointerException
    at lib.addbook(lib.java:15)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
    at sun.rmi.transport.Transport$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Unknown Source)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
    at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
    at sun.rmi.server.UnicastRef.invoke(Unknown Source)
    at lib_Stub.addbook(Unknown Source)
    at client.main(client.java:8)

  • Simple X-fi Question, Please Help

    !Simple X-fi Question, Please HelpL I've been looking for an external sound card that is similar to the 2002 Creative Extigy and think I may found it in the Creative X-Fi. I have some questions about the X-fi though. Can the X-fi:
    1. Input sound from an optical port
    2. Output that sound to 5. surround- Front, surround, center/sub
    3. Is the X-Fi stand-alone, external, and powered by a USB or a wall outlet (you do not need a computer hooked up to it)
    Basically I want to connect a TosLink optical cable from my Xbox to the X-Fi. That will deli'ver the sound to the X-Fi. Then I want that sound to go to a 5. headset that is connected to the X-fi via 5. front, surround, and center/sub wires. The X-Fi has to be stand-alone and cannot be connected to a PC to do this.
    Thank you for your help.

    The connector must match, and the connector polarity (plus and minus voltage) must match.  Sorry, I don't know if the positive voltage goes on the inside of the connector or the outside.    Any wattage of 12 or more should be adequate.
    Message Edited by toomanydonuts on 01-10-2008 01:29 AM

  • Problem with a simple RMI program

    I'm trying to get a simple RMI program to work, by following the instructions in this link:
    http://developer.java.sun.com/developer/technicalArticles/RMI/CreatingApps/index.html#dro
    When it gets to this line:
    Lookup look_obj = (Lookup)Naming.lookup(name);this exception is generated:
    java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:1099 connect,resolve)
    What's wrong, eh?

    Canadian, eh?
    Looks like your security settings on you computer are set to not allow a socket connection.
    Specifically is is saying that access to port 1099 on your local machine (127.0.0.1 is the loopback address) is being denied.
    There are two main reasons this could happen (off the top of my head), though someone else might know from the message exaclty which one.
    1. Your java security permissions do not allow an out going socket connection (are you writing an applet?)
    2. Your computer protects access to port 1099.

  • Simple RMI error

    Hello,
    I'm trying to compile and execute a simple RMI example. The compilation is OK.
    The rmiregistry is running.
    I'm using windows and java 1.5
    I have the files:
    Server <== the Server
    myStudentImpl <== remote object
    myStudent <== interface
    myStudentImpl_Stub <== the Stub of myStudentImpl (generated by rmic)
    When I'm trying to execute the command from the Server file
    Naming.rebind("john",student);
    I'm getting an error.
    Error:RemoteException occurred in server thread; nested exception is:
    java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
    java.lang.ClassNotFoundException: myStudentImpl_Stub
    Then I executed
    C:\myrmi2>java -Djava.rmi.server.codebase=c:/myrmic2 Server
    .... and I got the below error
    Error:Error unmarshaling return; nested exception is:
    java.net.MalformedURLException: unknown protocol: c
    Probably, I have a mistake with the environment variables.
    Can anybody help me, please?
    Thanks

    Now I'm getting
    Error(2):error marshalling arguments; nested exception is:
         java.io.NotSerializableException: testprovider.DS.DS_TicketImpl
    This is my interface
    public interface DS_Ticket extends Remote
    public EncryptedTicket RequestTicket(RequestForTicket req) throws RemoteException;
    This is my return object
    public class EncryptedTicket implements java.io.Serializable
    public byte[] cipherToken2;
    public byte[] cipherSignToken2;
    public byte[] cipherSignature;
    public String Description;
    This is the parameter object
    public class RequestForTicket implements java.io.Serializable
    public PublicKey pubKey;
    public byte[] e_s_Token2;
    public byte[] e_Token2;
    public byte[] BeKey;
    public byte[] BeToken;
    public byte[] signature;
    Any idea what I'm doing wrong?
    Thank you very much

  • Simple Crop tool question... how do I save the crop section?

    Hi,
    I have a very simple crop tool question. I'm a photoshop girl usually... so Illustrator is new to me. When I select the crop section I want... how do I save it?... if I select another tool in the tool panel, the crop section disappears and I can't get it back when I re-select Crop tool. If I select Save as... it saves the whole document...and not just my crop section.
    Like I said, simple question...but I just don't know the secret to the Illustrator crop tool.
    Thanks!
    Yzza

    Either press the Tab key or F key.

  • How to deploy simple RMI server WLS 7

    Hi,
    I understand that if I write a simple RMI server - not
    extending UnicastRemoteObject, no clustering or IIOP
    issues - I don't need to run an rmic program. I'm not
    clear, however, on what then gets deployed. Does the
    client get the interface or implementation class? And, in
    this simple case, no deployment descriptor configuration
    for RMI is required, correct? I seem to be making this
    harder than it's supposed to be ...
    Thanks, Garry

    Garry, WLS itself is a server , you dont need an additional RMI server. All you need is create an RMI object and bind it to the server JNDI (from the server side) , then your clients can lookup the RMI object via the JNDI and they will get the stubs to make method invocations on the RMI object.
    Check out documentation at :
    http://e-docs.bea.com/wls/docs81/rmi/rmi_api.html#1000008693

  • A Simpler, More Direct Question About Merge Joins

    This thread is related to Merge Joins Should Be Faster and Merge Join but asks a simpler, more direct question:
    Why does merge sort join choose to sort data that is already sorted? Here are some Explain query plans to illustrate my point.
    SQL> EXPLAIN PLAN FOR
      2  SELECT * FROM spoTriples ORDER BY s;
    PLAN_TABLE_OUTPUT
    |   0 | SELECT STATEMENT |              |   998K|    35M|  5311   (1)| 00:01:04|
    |   1 |  INDEX FULL SCAN | PKSPOTRIPLES |   998K|    35M|  5311   (1)| 00:01:04|
    ---------------------------------------------------------------------------------Notice that the plan does not involve a SORT operation. This is because spoTriples is an Index-Organized Table on the primary key index of (s,p,o), which contains all of the columns in the table. This means the table is already sorted on s, which is the column in the ORDER BY clause. The optimizer is taking advantage of the fact that the table is already sorted, which it should.
    Now look at this plan:
    SQL> EXPLAIN PLAN FOR
      2  SELECT /*+ USE_MERGE(t1 t2) */ t1.s, t2.s
      3  FROM spoTriples t1, spoTriples t2
      4  WHERE t1.s = t2.s;
    Explained.
    PLAN_TABLE_OUTPUT
    |   0 | SELECT STATEMENT       |              |    11M|   297M|       | 13019 (6)| 00:02:37 |
    |   1 |  MERGE JOIN            |              |    11M|   297M|       | 13019 (6)| 00:02:37 |
    |   2 |   SORT JOIN            |              |   998K|    12M|    38M|  6389 (4)| 00:01:17 |
    |   3 |    INDEX FAST FULL SCAN| PKSPOTRIPLES |   998K|    12M|       |  1460 (3)| 00:00:18 |
    |*  4 |   SORT JOIN            |              |   998K|    12M|    38M|  6389 (4)| 00:01:17 |
    |   5 |    INDEX FAST FULL SCAN| PKSPOTRIPLES |   998K|    12M|       |  1460 (3)| 00:00:18 |
    Predicate Information (identified by operation id):
       4 - access("T1"."S"="T2"."S")
           filter("T1"."S"="T2"."S")I'm doing a self join on the column by which the table is sorted. I'm using a hint to force a merge join, but despite the data already being sorted, the optimizer insists on sorting each instance of spoTriples before doing the merge join. The sort should be unnecessary for the same reason that it is unnecessary in the case with the ORDER BY above.
    Is there anyway to make Oracle be aware of and take advantage of the fact that it doesn't have to sort this data before merge joining it?

    Licensing questions are best addressed by visiting the Oracle store, or contacting a salesrep in your area
    But I doubt you can redistribute the product if you aren't licensed yourself.
    Question 3 and 4 have obvious answers
    3: Even if you could this is illegal
    4: if tnsping is not included in the client, tnsping is not included in the client, and there will be no replacement.
    Tnsping only establishes whether a listener is running and shouldn't be called from an application
    Sybrand Bakker
    Senior Oracle DBA

  • 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.

  • Simple EJB Question

    Given the following example, what is the result of the System.out.println? MyBean is a stateless session bean and is deployed on a separate machine than the client code and the Customer class is deployed on both machines. Notice that MyBean modifies the Customer object by calling its setName() method.
    // Client code
    Customer cust = new Customer();
    cust.setName("Mickey Mouse");
    Context initial = new InitialContext();
    Object objref = initial.lookup("MyBean");
    MyBeanHome home = (MyBeanHome)PortableRemoteObject.narrow(objref, MyBeanHome.class);
    MyBean bean = home.create();
    bean.foo(cust);
    System.out.println("name=" + cust.getName());
    public class Customer implements java.io.Serializabale {
    ��private String name = null;
    ��public String getName() { return name; }
    ��public void setName(String aName) { name = aName; }
    public class MyBeanEJB implements SessionBean, SessionSynchronization {
    ��public void foo(Customer cust) {
    ����cust.setName("Donald Duck");
    ��}

    The value will be "Mickey Mouse".
    If you want to know the value in the EJB you'll need to code
    System.out.println("name=" + bean.getName());assuming that name is exposed on the EJB.
    Your Customer instance is passed to the EJB by value not by reference. So changing any value on the client or server is not going to affect the values on the server or client.
    Dave

  • 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

  • RMI direction question

    Hi All,
    I am new to Java and would like to write a robust multi-tier client server application and is not certain whether RMI is the
    best approach to use. As a result, here are the following questions on this topic:
    ( i ) Basically, I need to be able to initiate some native commands (e.g. ls -al > /tmp/junk...) on both client and server
    side and be able to retrieve the output back. There are numerous method to do this (e.g. SOAP, ORB, webservices, LipeRMI...). Nevertheless, my question is whether RMI is still the simplest or straight forward approach as opposed to having to learn another protocol (e.g. XML, webservices). If not, what is the best/latest method to achieving the same objective?
    ( ii ) One of the problem encountered when going through those RMI tutorial exercises were the requirements to have a
    webserver running on both client and server in order for dynamic class loading to work properly. I wonder whether there is a better way to do this without having both client server dependency?
    ( iii ) Could webservice or SOAP be able to do the same thing?
    ( iv ) Should I not be concerned with this low level communication since EJB will handle this part?
    ( v ) Are there any other RMI user forum, website, useful documents on this topic?
    Any suggests would be much appreciated.
    Many thanks,
    Netbeans Fan.

    i ) if your protocol is simple enough you can use plain sockets, maybe with combination of serialization.
    If you need object level protocol, RMI is the simplest to learn and use from the methods you mentioned.
    ( ii ) First, you can use any other shared storage (like NFS, SAMBA) for dynamic classloading.
    If you develop both the client and the server and the server does not change independelty of the clients (in terms of API) you can
    place all the files that are required by the client (stubs, etc) on client's classpath and avoid dynamic classloading altogether.
    ( iii ) yes.
    ( iv ) why do you plan to use ejb. what is the context of your application?
    ( v ) which topic? RMI in general?
    I've collected a list of some useful resources for the beginners at
    http://www.genady.net/rmi/v20/general-resources.html
    This forum is also a good place to ask questions.

Maybe you are looking for

  • How do i change the apple ID on my Imac

    I have two apple ID accounts. I want all of my apple devices signed into the same apple ID. How can I change the apple ID that I am signed into on my iMac?

  • Condition in 7.0 query not used when mapped to dropdownlist in 3.5 web temp

    Hi Experts I have a 7.0 query with a condition so that it only shows topN records for a given KF. The query is shown in a chart in a 3.5 web template and here is the condition working just fine. However in the same web template has I made a dropdownl

  • RCU (Repository Creation Utility) installation problem

    Hi...... my oracle version BANNER Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production PL/SQL Release 11.1.0.6.0 - Production CORE    11.1.0.6.0      Production TNS for 32-bit Windows: Version 11.1.0.6.0 - Production NLSRTL Version

  • Compilation error, no  /opt/SUNWspro/bin/cc on Solaris 10 64bit(x86)

    I was trying to compile Apache mod_jk on Solaris 10 64bit platform(x86) and I got the following error. I checked my system and I do not have /opt/SUNWspro/bin/cc. Any suggestions how to solve it? root@unknown >./configure --with-apxs=/usr/apache2/bin

  • Kde apps in gnome

    I'm not sure what I'm missing here.. When I try using kde apps in gnome they all fail to launch, I'm confused about what Arch needs to run them. I have tried installing ktorrent and rosegarden. I get the same error on both: /opt/kde/bin/ktorrent DCOP