IIOP dynamic stub downloading

Hi,
While working with EJB's (1.1 to 2.0) on different projects, I've never been able to setup dynamic downloading of EJB IIOP stubs. I had to include the stubs in the client's classpath everytime.
I am now wondering :
Is dynamic stub downloading possible with RMI-IIOP ?
Is it a server specific issue (working with weblogic 6.1/7.0) ?
Any experience or comments welcome...
Ian

Is dynamic stub downloading possible with RMI-IIOP ?I doubt it : RMI-IIOP ensures compatibility with plain-IIOP servers. Those server might not be written in Java at all, and have no idea what stub code you might want.
I had to include the stubs in the client's classpath everytime.Not only that, but that's also the reason why you can't genuinely downcast a stub obtained through IIOP : you have to narrow() it (see javax.rmi.PortableRemoteObject), since the stub instance was instantiated by the client ORB (I mean, RMI-IIOP engine) on the grounds of the client-side information only, which doesn't know the server-side subtype.

Similar Messages

  • Dynamic stub downloading question.

    It turned out that I've been killing time over and over again when setting up dynamic stubs downloading for RMI implementations.
    Wouldn't be it simple if RMI isolates developer from all those steps by
    a) creating stubs on the fly when the remote object gets bound and
    b) upload them to the client as a part of Naming.lookup() call?
    No need to rmic, http-/ftp-/file--server, additional security, etc. Can somebody explain me this or I am missing something here??
    Thanks.

    It turned out that I've been killing time No, you havent been killing time.
    over and
    over again when setting up dynamic stubs downloading
    for RMI implementations.
    Wouldn't be it simple if RMI isolates developer from
    all those steps by
    a) creating stubs on the fly when the remote object
    gets boundDo you know what this will ultimately mean? It means that some PROCESS, either the registry or something else, will NEED TO LOOK AT THE OBJECT THAT IT HAS ACCEPTED TO BE BOUND, OR IS JUST ABOUT TO ACCEPT TO BE BOUND and then check to see if it REALLY does extend the proper superclasses (UnicastRemoteObject for plain RMI, or PortableRemoteObject for all those RMI-IIOP lovers out there), THEN check if the service object REALLY DOES implement the remote interface TO THE LETTER, ........THEN check to see if the proper exceptions are going to be thrown if something goes wrong!!
    (i'm panting right now.....)
    That's simply madness. Do you have any idea how often an object can be:
    1: Bound to the registry
    2. REBOUND under a different name
    3. Removed and later REBOUND
    ?????? Its sick. The JVM/registry overhead will hit the roof!!!
    ok, lets go on....
    and
    b) upload them to the client as a part of
    Naming.lookup() call?What?? IS IT FOR THE CLIENT TO TRY AND CONNECT TO THE SERVER USING STUBS IT ALREADY HAS .......or is it for the server to somehow keep TABS on its client and SEND the stubs to it, just so it can talk to the server???????
    Doesnt make sense at all.
    >
    No need to rmic, http-/ftp-/file--server, additional
    security, etc. Can somebody explain me this or I am
    missing something here?Oh, buddy: you ARE missing something.

  • Dynamic implementation download for return values from EJB

    I try the following exemplary scenario regarding dynamic implementation download. Let's say there is a statless EJB deployed (e.g. OrderHandler) with a method getSomeOrder() returning Order object; where Order is actually an interface extending java.io.Serializable. For Order there is implementation class OrderImpl. Within the getSomeOrder() the EJB creates a new OrderImpl, populates it and returns as interface. The client looks up OrderHandler and calls getSomeOrder() method. Then, on Order a dummy: String getName() method is called.
    Now, the problem is various behavior with implementation dynamic download. I receive different behavior from 2 clients (1st being launched from within LAN with the server, 2nd from outside server's LAN). When I put OrderImpl in clients' classpaths, obviously they both work the same. When I leave only Order interface (!!the very goal of the test - dynamic impl. download!!), only the 1st client still works. I measured times in milis, and it looks that the OrderImpl is really downloaded, as the first getSomeOrder() call lasts around 10 times as long as further calls.
    The 2nd client hangs a while on the getSomeOrder() call and then throws UnmarshallException, stating that it has failed to unmarshal the returned object, which basically means no implementation got downloaded.
    Can anyone help?

    You can try putting the Impl classes on a webserver.
    while starting the server set the property
    -Djava.rmi.server.codebase=http://mywebserver:8080
    While running the client if the impl classes are not available in the classpath, it would download it from the webserver

  • Dynamic Class Downloading difficulty

    Hi RMI Specialists,
    I am experiencing a possible dynamic class loading issue when attempting to separate the client & server codes across 2 separate Windows (XP & 2000) systems. This exercise (from ch13 of Oreilly�s Learning Java) is made up
    of the following interfaces and classes:
    On the Server side:
    package LearningJavaServer;
    import java.rmi.*;
    import java.util.*;
    public interface RemoteServer extends Remote {
        Date getDate(  ) throws RemoteException;
        Object execute( WorkRequest work ) throws RemoteException;
    package LearningJavaServer;
    import java.rmi.*;
    import java.util.*;
    public class MyServer extends java.rmi.server.UnicastRemoteObject
        implements RemoteServer {
        public MyServer(  ) throws RemoteException { }
        // implement the RemoteServer interface
        public Date getDate(  ) throws RemoteException {
            return new Date(  );
        public Object execute( WorkRequest work ) throws RemoteException {
            return work.execute(  );
        public static void main(String args[]) {
            try {
                RemoteServer server = new MyServer(  );
                Naming.rebind("NiftyServer", server);
            } catch (java.io.IOException e) {
                // problem registering server
    package LearningJavaServer;
    import java.io.*;
    public class Request implements java.io.Serializable {}
    package LearningJavaServer;
    public abstract class WorkRequest extends Request {
        public abstract Object execute(  );
    }On the Client side:
    package LearningJavaClient;
    import java.rmi.*;
    import java.rmi.registry.LocateRegistry;
    import java.rmi.registry.Registry;
    public class MyClient {
        public static void main(String [] args)
          throws RemoteException {
            new MyClient( args[0] );
        public MyClient(String host) {
            try {
                RemoteServer server = (RemoteServer)
                    Naming.lookup("rmi://"+host+"/NiftyServer");
                System.out.println( server.getDate(  ) );
                System.out.println(
                  server.execute( new MyCalculation(2) ) );
            } catch (java.io.IOException e) {
                  // I/O Error or bad URL
                     System.out.println( e );
            } catch (NotBoundException e) {
                  // NiftyServer isn't registered
               System.out.println( e );
    package LearningJavaClient;
    import java.rmi.*;
    import java.util.*;
    public interface RemoteServer extends Remote {
        Date getDate(  ) throws RemoteException;
        Object execute( WorkRequest work ) throws RemoteException;
    package LearningJavaClient;
    public class MyCalculation extends WorkRequest {
        int n;
        public MyCalculation( int n ) {
            this.n = n;
        public Object execute(  ) {
            return new Integer( n * n );
    package LearningJavaClient;
    import java.io.*;
    public class Request implements java.io.Serializable {}
    package LearningJavaClient;
    public abstract class WorkRequest extends Request {
        public abstract Object execute(  );
    }Steps to invoke all services on the server side:
    cd C:\Documents and Settings\htran\JavaRMI\build\classes on both systems;
    ( i ) start rmiregistry.
    ( ii ) java -Djava.rmi.server.codebase='http://serverhostname/LearningJavaServer/' -Djava.security.policy="C:\Documents and Settings\htran\.java.policy" -cp . LearningJavaServer.MyServer
    Steps to invoke all services on the client side:
    ( i ) java -Djava.security.policy="C:\Documents and Settings\htran\.java.policy" -cp . LearningJavaClient.MyClient serverhostname
    java.rmi.NotBoundException: NiftyServer
    Or
    ( ii ) java -Djava.rmi.server.codebase='http://clienthostname/LearningJavaClient/' -Djava.security.policy="C:\Documents and Settings\htran\.java.policy" -cp . LearningJavaClient.MyClient serverhostname
    java.rmi.UnmarshalException: Error unmarshaling return; nested exception is:
    java.net.MalformedURLException: no protocol: 'http://clienthostname/LearningJavaClient/'
    Is it possible that this issue could have been caused by either the Request/WorkRequest classes which are present on both system? Likewise, is the location of invoking RMI registry on the server correct?
    Both systems have got their own web servers (http://serverhostname/LearningJavaServer & http://clienthostname/LearningJavaClient).
    No firewalls between the two systems and the security files (C:\Document Settings\htran\.java.policy) are made up of the following 2 lines:
        grant codeBase "file:/home/jones/src/" {
            permission java.security.AllPermission;
        };Another issue that I am having is that the server process below is that it keeps on dropping off after a minute or two:
    C:\Documents and Settings\htran\JavaRMI\build\classes>java -Djava.rmi.se
    rver.codebase='http://clienthostname/LearningJavaClient/' -Djava.security.policy="C:\
    Documents and Settings\htran\.java.policy" -cp . LearningJavaClient.MyClient serverhostname
    This exercise has worked fine when running all the codes on the same host.
    I am running Netbeans 5.5, JDK1.5.0_11 on Windows 2000 (Server) & XP (Client).
    Any assistance would be appreciated.
    Many thanks,
    Henry

    Hi Esmond,
    You still have an empty catch block for the IOException. Fix that first. I >can't possibly tell what's going on until you can at least bind the >service.OK. MyServer.java below no longer throws RemoteExceptions in both of its methods and added the print stacktrace to catch the empty IOException earlier.
    public class MyServer extends java.rmi.server.UnicastRemoteObject
        implements RemoteServer {
        public MyServer(  ) throws RemoteException { }
        public Date getDate(  ) {
            return new Date(  );
        public Object execute( WorkRequest work ) {
            return work.execute(  );
        public static void main(String args[]) {
            System.setSecurityManager(new RMISecurityManager());
            try {
                RemoteServer server = new MyServer(  );
                Naming.rebind("NiftyServer", server);
            } catch (java.io.IOException e) {
                // problem registering server
               System.out.println("IOexception from MyServer");
                e.printStackTrace();
            } catch (Exception e) {
                System.out.println("General Exception from MyServer");
                e.printStackTrace();
    }The following error messages were produced when launching MyServer.class. I have broken it into 2 separate attempts. One with Dynamic Class Downloading & one without.
    Use CodeBase when launches MyServer.
    C:\Documents and Settings\abc\JavaRMI\build\classes>java -Djava.rmi.server.codebase='http://clienthostname/LearningJava/' -Djava.security.policy="C:\Documents and
    Settings\abc\.java.policy" -cp . LearningJava.MyServer
    IOexception from MyServer
    java.rmi.UnmarshalException: Error unmarshaling return; nested exception is: java.net.MalformedURLException: no protocol: 'http://clienthostname/LearningJava/'
    at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
    at sun.rmi.server.UnicastRef.invoke(Unknown Source)
    at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
    at java.rmi.Naming.rebind(Unknown Source)
    at LearningJava.MyServer.main(MyServer.java:28)
    Caused by: java.net.MalformedURLException: no protocol: 'http://clienthostname/LearningJava/'
    at java.net.URL.<init>(Unknown Source)
    at java.net.URL.<init>(Unknown Source)
    at java.net.URL.<init>(Unknown Source)
    at sun.rmi.server.LoaderHandler.pathToURLs(Unknown Source)
    at sun.rmi.server.LoaderHandler.getDefaultCodebaseURLs(Unknown Source)
    at sun.rmi.server.LoaderHandler.loadClass(Unknown Source)
    at java.rmi.server.RMIClassLoader$2.loadClass(Unknown Source)
    at java.rmi.server.RMIClassLoader.loadClass(Unknown Source)
    at sun.rmi.server.MarshalInputStream.resolveClass(Unknown Source)
    at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
    at java.io.ObjectInputStream.readClassDesc(Unknown Source)
    at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Unknown Source)
    at java.io.ObjectInputStream.readObject(Unknown Source)
    ... 5 more
    Does NOT use CodeBase when launches MyServer
    C:\Documents and Settings\abc\JavaRMI\build\classes>java -Djava.security.policy="C:\Documents and Settings\abc\.java.policy" -cp . LearningJava.MyServer
    IOexception from MyServer
    java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
    java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
    java.lang.ClassNotFoundException: LearningJava.RemoteServer
    at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:385)
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:240)
    at sun.rmi.transport.Transport$1.run(Transport.java:153)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
    at java.lang.Thread.run(Thread.java:595)
    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 sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
    at java.rmi.Naming.rebind(Unknown Source)
    at LearningJava.MyServer.main(MyServer.java:28)
    Caused by: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
    java.lang.ClassNotFoundException: LearningJava.RemoteServer
    at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
    at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:375
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:240)
    at sun.rmi.transport.Transport$1.run(Transport.java:153)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
    at java.lang.Thread.run(Thread.java:595)
    Caused by: java.lang.ClassNotFoundException: LearningJava.RemoteServer
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:242)
    at sun.rmi.server.LoaderHandler.loadProxyInterfaces(LoaderHandler.java:707)
    at sun.rmi.server.LoaderHandler.loadProxyClass(LoaderHandler.java:651)
    at sun.rmi.server.LoaderHandler.loadProxyClass(LoaderHandler.java:588)
    at java.rmi.server.RMIClassLoader$2.loadProxyClass(RMIClassLoader.java:628)
    at java.rmi.server.RMIClassLoader.loadProxyClass(RMIClassLoader.java:294
    at sun.rmi.server.MarshalInputStream.resolveProxyClass(MarshalInputStream.java:238)
    at java.io.ObjectInputStream.readProxyDesc(ObjectInputStream.java:1500)
    at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1463)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1699)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
    ... 9 more
    I now understand that you do want to use dynamic class loading, and >moreover that you want to do it from the client to the server, in which >case you do need java.rmi.server.codebase at the client and you do >also need a codebase server. However the client and server can both >use the same codebase server, and indeed in this situation I don't >see why the server needs a codebase server or setting at all actually. I >don't really see why you want to use it from the client either, if this is a >closed system but that's your problem not mine.I now use only one codebase server. ie the one on the Client side where MyCalculation.class resides. You are right it is not necessary to use codebase when launching MyServer since the Client side does not need to download any additional classes over to the client side. Nevertheless, neither of the above startups (with/without) codebase worked even though the error messages were slightly different.
    Btw, can you explain what you mean by a "close system" compared to an "opened system"?
    java.net.MalformedURLException: no >protocol: 'http://clienthostname/LearningJava/'
    That doesn't make sense. Are you sure you're transcribing it correctly? >Also what line of code is throwing it?Here is the code for MyClient which explains that the line java.net.MalformedURLException: came from line 32, the printStackTrace() from IOException.
    public class MyClient {
        public static void main(String [] args)
          throws RemoteException {
          System.setSecurityManager(new RMISecurityManager());
            new MyClient( args[0] );
        public MyClient(String host) {
            try {
                RemoteServer server = (RemoteServer)
                    Naming.lookup("rmi://"+host+"/NiftyServer");
                System.out.println( server.getDate(  ) );
                System.out.println(
                server.execute( new MyCalculation(2) ) );    // line 28
            } catch (java.io.IOException e) {
                  // I/O Error or bad URL
                  System.out.println("IOException from MyClient");
               e.printStackTrace();
            }  catch (NotBoundException e) {
                  // NiftyServer isn't registered
                  System.out.println("NotBoundException from MyClient");
               e.printStackTrace();
            } catch (Exception e) {
                  System.out.println("General Exception from MyClient");
                  e.printStackTrace();
    }I wouldn't pay much attention to this message since the MyServer has difficulty registering itself to RMI registry. As a result, MyClient could not
    locate MyServer via RemoteServer interface before giving up altogether.
    Unfortunately, I have not being able to create an interface (e.g. >MyCalculation.class as an interface, MyCalculationImpl.class as the >actual implementation of MyCalculation) since WorkRequest is an >abstract class, which does not allow MyClient to instanciates >MyCalculation on line 28.
    I don't see why not. What error messages/exceptions are you getting?
    Are you referring to the execute() method on line 13 in >RemoteServer.classNo, I am referring to line 28 of MyClient.class above after the following failed attempts to create an interface for MyCalculation.java:
    public interface MyCalculation extends WorkRequest { // Got a syntax error: interface expected here in Netbeans.
    } Or
    public interface MyCalculation {}
    public class MyCalculation extends WorkRequest extends MyCalculation { ... # Obviously cannot extend more than one class.Any suggestion?
    No. I said the remote method implementation (i.e. in your xxxImpl >class) doesn't need to be declared to throw RemoteException. The >remote method definition in the remote interface certainly does. I have taken out the RemoteException from 2 methods in MyServer.java. ie implementation of the RemoteServer.java.
    In short, I have used only one codebase server but puzzled whether MyCalculation.class (have split it up into interface & implementation) will be passed over to the
    server side by referenced, value or Dynamic Class Downloading. I do not want it to use Dynamic Class Downloading to do this.
    Thanks,
    Henry

  • Dynamic Class Downloading and EJBs

    Hi all,
    I have one session EJB with business method getObject returning a serializable object which class implements MyObject interface.
    This object's class, named MyObjectImpl, is in only deployed on server within my EAR file.
    I would like my client classpath not containing MyObjectImpl class but only MyObject class (the implemented interface).
    Could you suggest a way to do this, by dynamically downloading implementation class at runtime so I can correcly get casting?
    Thanks in advance
    Fil

    Hi Fil,
    There's no portable way to accomplish this in the Java EE plaform. Java EE requires that all dependent classes needed by a component be packaged with that component at deployment time. Applications are not permitted to dynamically load classes, as this would be both a security issue and a correctness issue. This is true even for clent components, which is why the Java EE platform has a first-class client component called an Application Client. You can find out more about the difference between an Application Client and a stand-alone client in our EJB FAQ.
    https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html
    --ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Dynamic code downloading using RMI

    Hi,
    Can somebody please explain what are the nesesary steps to set up a class server.
    I have made a ClassServer.
    It is running...
    Another RMI server is running on this machine which has method to return object of an Interface
    Client code has an instruction - System.setProperty("java.rmi.server.codebase", "http://127.0.0.1:2020");
    When this client requests Interfeace from server I get following exception
    $ java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
            java.lang.ClassNotFoundException: com.rasa.interface.InterfaceImpl1
    java.lang.ClassNotFoundException: com.rasa.interface.InterfaceImpl1
            at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
            at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
            at java.lang.Class.forName0(Native Method)
            at java.lang.Class.forName(Class.java:195)
            at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:367)
            at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:88)
            at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:145)
            at java.io.ObjectInputStream.inputClassDescriptor(ObjectInputStream.java:918)
            at java.io.ObjectInputStream.readObject(ObjectInputStream.java:366)
            at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
            at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1186)
            at java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)
            at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
            at sun.rmi.server.UnicastRef.unmarshalValue(UnicastRef.java:300)
            at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:134)
            at com.rasa.server.MainServer_Stub.getInterface(Unknown Source)
            at com.rasa.client.ProgramImpl.run(Unknown Source)can someone please explain why this is happning.
    note Interface implementation also implements Serializable
    Thank you

    sorry I thought you were trying to download the stubs
    only...
    try this:
    http://java.sun.com/j2se/1.4.1/docs/guide/rmi/codebase.
    tmlyes followed everystep from there, but no luck

  • Dynamic code downloading

    Could java interpreter execute ANY classes /or maybe automatically download it first/ remotely from network via HTTP, and not only from local disk? If yes, how this could be done?

    You could certainly download code dynamically, compile and run it with java. There's no problem there.

  • Can any SAP.LTD experts do a dynamic pdf download tutorial?

    Hi,SAP experts,
      I have tried to impletmente a dynmaic pdf download project ,say I have got pdf data like xstring type and try to download them at web dynpro side,but unluckly failed. Because the data I got are all dynmacly generated and could not easily used interactive form to display. So I tried to use xsting format and bin_file to transfer them to web dynpro side(Because some experts have implemented this successfully using this method),hoping that can work.But I did't get the good result. And I think this pdf download functionality without interactiveform  is quite importtant to many users.So I really hope anyone of SAP.LTD can produce an official turtorial about this topic!
       Thanks in advance!

    I think he's just asking how to do that?  Not really Flex related so much as web-service, but since this is a Flex forum I'll steal code from the very Flex-related AlivePDF:
    Sorry these crap forums trashed the formatting.  Now, I've never done what you're talking about via a web service (not a big fan) so this may not help at all, but hopefully - do you have access to an HttpServletResponse object to stream back your data?  If you do this should get you started I think.  If not you may need to do some web-service specific research.
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class CreatePDFServlet extends HttpServlet {
    public void doPost(HttpServletRequest req, HttpServletResponse resp)
    throws ServletException, IOException
    doGet(req, resp);
    public void doGet(HttpServletRequest req, HttpServletResponse resp)
    throws ServletException, IOException
    int i = 0;
    int k = 0;
    int maxLength = req.getContentLength();
    byte[] bytes = new byte[maxLength];
    String method = req.getParameter("method");
    String name = req.getParameter("name");
    ServletInputStream si = req.getInputStream();
    while (true)
    k = si.read(bytes,i,maxLength);
    i += k;
    if (k &lt;= 0)
    break;
    if (bytes != null)
    { //Check out this part here
    ServletOutputStream stream = resp.getOutputStream();
    resp.setContentType("application/pdf");
    resp.setContentLength(bytes.length);
    resp.setHeader("Content-Disposition",method + ";filename=" + name);
    stream.write(bytes);
    stream.flush();
    stream.close();
    else
    resp.setContentType("text");
    resp.getWriter().write("bytes is null");

  • WLS 6 EJB making calls to an CORBA ORBIX 2000 Server

    My WLS 6 EJB needs to use the ORBIX 2000 Naming Service to find a
    ORBIX 2000 C++ Server.
    How do I initialize Weblogic Orb. I need to to tell the ORB where the Naming
    Service is located on the network. There are probably System Properties or Command
    line arguments that the ORB will recognize. What are there names?
    Thanks
    Al

    Andy,
    Thanks for your reply!
    I also noticed IBM JDK1.3 is still at GIOP1.1 level. But Sun'd JDK ORB
    is just a toy.
    The new JDK1.4 will include a POA, so basically I will see much better
    ORB interoperability at that level. Especially the Portable
    Interceptor will help the ORB to plug into JDK.
    The ORB in IBM JDK doesn't support the COSNaming fully, it uses
    resolve_initial_references_remote() to resolve create InitialContext.
    While Sun JDK doesn't support it at all(coz it is not part of OMG's
    standard).
    EJB2.0 spec is to address the INS issue, so hopefully it will not be
    an issue in the long run.
    How about JRockit JVM? It is certified for WLS, but it contains which
    ORB? If it just uses JavaIDL, I bet the RMI-IIOP performance won't be
    good as IBM JDK.
    And someone from Borland has proposed to use IDL type mapping for
    RMI-IIOP protocol, I think that will be a cool proposal and if any
    RMI-IIOP implementation will do the conversion under transfer that
    will be the fastest way.
    Last question, any plan to support Dynamic Stub download over RMI-IIOP
    for WLS? EJB2.0 spec talks about this possibility, but don't see any
    vendor do it yet.
    Thanks!
    Simon Song
    On 11 Feb 2002 16:42:28 -0800, Andy Piper <[email protected]> wrote:
    [email protected] (Simon Song) writes:
    Does this mean, WLS can plug into any ORB? For example, IBM JDK embedsYes.
    IBM ComponentBroker ORB, which is incomptabible with Sun JDK ORB. So
    to WebSphere EJB client, it must run on IBM JDK not on Sun JDK.
    If we run WLS on IBM JDK, does this imply the WLS client must run on
    IBM JDK now? For 6.1? No. 6.1 basically supports RMI-IIOP conformant Orbs and the
    JDK (note that this implies that the JDK is not an RMI-IIOP compliant
    Orb). So in general this means that the IBM client orb will work
    against an instance of WLS running on the Sun JDK.
    The place where this may break down is with valuetype chunking. This
    is required by custom marshaled datatypes and both the JDK 1.3.1 and
    the IBM JDK do it wrongly. We support the "wrong way" if the client is
    using GIOP 1.0 or 1.1, we do it the "right" way for GIOP 1.2. JDK 1.4
    does it the right way and uses GIOP 1.2. The IBM JDK does it the wrong
    way and uses GIOP 1.1, the JDK 1.3.1 does it the wrong way and uses
    GIOP 1.0.
    IBM provides comptabile EJB client package, which contains IBM ORB to
    replace any other JDK's ORB.
    WLS has no real ORB embedded? IBM JDK ORB IIOP performs much better
    than JDK1.3's JavaIDL. Right, and although we don't use an Orb, we do use the ValueHandler
    out of the JDK and I suspect this works much faster in the IBM JDK
    than the normal JDK.
    andy

  • RMI Clustering in Weblogic 7.0

    Hi !
    I am trying to use RMI Clustering in Weblogic 7.0. I followed the samples in the
    documentation and it doesnt work for me. I could successfully bing my RMi Server
    object to the JNDI tree and could view it via the weblogic JNDI tree. Even the
    lookup is fine, but when I invoke a method on the remote object via the client,
    I get the following error. Clearly there is something wrong with the Dynamic stub
    downloaded from the JNDI tree.
    Any Clues please...
    Thanks
    Sanjay
    class examples.rmi.hello.HelloImpl_WLStub
    java.rmi.ConnectException: Couldn't connect to weblogic.rjvm.RJVMImpl@3a0ab1 -
    id: '6003776402499002017C:15.10.45.93R:12
    46860412257523095S:15.10.45.93:[7001,7001,7002,7002,7001,7002,-1]:examples:examplesServer'
    connect time: 'Fri Sep 06 08:
    42:01 IST 2002'
    at weblogic.rjvm.ConnectionManager.getOutputStream(ConnectionManager.java:1559)
    at weblogic.rjvm.RJVMImpl.getRequestStream(RJVMImpl.java:363)
    at weblogic.rmi.internal.BasicRemoteRef.getOutboundRequest(BasicRemoteRef.java:88)
    at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:116)
    at examples.rmi.hello.HelloImpl_WLStub.sayHello(Unknown Source)
    at examples.rmi.hello.HelloClient.main(HelloClient.java:42)

    Hi !
    I am trying to use RMI Clustering in Weblogic 7.0. I followed the samples in the
    documentation and it doesnt work for me. I could successfully bing my RMi Server
    object to the JNDI tree and could view it via the weblogic JNDI tree. Even the
    lookup is fine, but when I invoke a method on the remote object via the client,
    I get the following error. Clearly there is something wrong with the Dynamic stub
    downloaded from the JNDI tree.
    Any Clues please...
    Thanks
    Sanjay
    class examples.rmi.hello.HelloImpl_WLStub
    java.rmi.ConnectException: Couldn't connect to weblogic.rjvm.RJVMImpl@3a0ab1 -
    id: '6003776402499002017C:15.10.45.93R:12
    46860412257523095S:15.10.45.93:[7001,7001,7002,7002,7001,7002,-1]:examples:examplesServer'
    connect time: 'Fri Sep 06 08:
    42:01 IST 2002'
    at weblogic.rjvm.ConnectionManager.getOutputStream(ConnectionManager.java:1559)
    at weblogic.rjvm.RJVMImpl.getRequestStream(RJVMImpl.java:363)
    at weblogic.rmi.internal.BasicRemoteRef.getOutboundRequest(BasicRemoteRef.java:88)
    at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:116)
    at examples.rmi.hello.HelloImpl_WLStub.sayHello(Unknown Source)
    at examples.rmi.hello.HelloClient.main(HelloClient.java:42)

  • Registring not working ???

    starting the rmiregistry in a directory that is not in the classpath, somehow prevents correct registring the remote object, since my client throws a java.rmi.NotBoundException when it looks it up.
    This is too odd as it seems contrary to the dynamic stub downloading setup.
    Does anyone have any ideas?
    Thanks
    ============ Exception Stack trace ===============
    java.rmi.NotBoundException: SInterface
    at sun.rmi.registry.RegistryImpl.lookup(RegistryImpl.java:106)
    at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
    at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:342
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:207)
    at sun.rmi.transport.Transport$1.run(Transport.java:148)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:4
    60)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport
    .java:701)
    at java.lang.Thread.run(Thread.java:536)
    at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Stream
    RemoteCall.java:247)
    at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:
    223)
    at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:350)
    at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
    at java.rmi.Naming.lookup(Naming.java:83)
    at Client.main(Client.java:9)
    ============ SInterfaceImpl =============
    import java.rmi.*;
    import java.rmi.server.*;
    public class SInterfaceImpl extends UnicastRemoteObject
    implements SInterface
    public SInterfaceImpl() throws RemoteException {
    super();
    public void method()
         public static void main(String args[])
              try
              {     SInterface s = new SInterfaceImpl();
                   Naming.rebind("rmi://localhost:1099/SInterface", s);
              catch (Exception e)
    =========== Client ===========
    import java.io.*;
    public class Client {
    public static void main(String[] args)
    try
         SInterface s = (SInterface)java.rmi.Naming.lookup("rmi://localhost/SInterface");
                   s.method();
    catch (Exception e)
    e.printStackTrace();
    ========================================

    If you are using a Windows platform, then you may experience strange errors if you are using a directory that has spaces in its name, for example:
    C:\Documents and SettingsHope this helps you.
    Good Luck,
    Avi.

  • RMI: Ensuring that classes/stubs are NOT dynamically downloaded.

    This is for my SCJD exam, which states, "You must provide all classes pre-installed so that no dynamic class downloading occurs."
    Due to my lack of experience with RMI, I decided to write a small test program to get comfortable with the technology. I would like to confirm that my RMI example does not use any "dynamic class downloading."
    My example program consists of three classes: DateService (an interface that extends Remote); DateServiceImpl (an implementation of DateService, which contains the code to create an RMI registry, export a DateService implementation instance, and bind it to the registry); and DateClient, which looks for the RMI registry, finds the DateService object, and calls one of its methods.
    I have used rmic to generate a DateServiceImpl_Stub.class file. I have left this file in the same directory as DateServiceImpl.class.
    Does it sound as if I have got this correct? I will post my code in the next post.
    Thanks in advance.

    DateService.javapackage date;
    import java.rmi.Remote;
    import java.rmi.RemoteException;
    public interface DateService extends Remote {
         * Returns an array containing data pertaining to the current date.
         * The first index of the array contains the year, the second has
         * the month, and the third contains the day.
         * @return  the current date in an array, separated into year, month, and day
         * @throws  RemoteException if the remote invocation fails
        public String[] currentDate() throws RemoteException;
    DateServiceImpl.javapackage server;
    import java.rmi.RemoteException;
    import java.rmi.registry.LocateRegistry;
    import java.rmi.registry.Registry;
    import java.rmi.server.UnicastRemoteObject;
    import java.util.Calendar;
    import date.DateService;
    public class DateServiceImpl implements DateService {
         * Returns an array containing data pertaining to the current date.
         * The first index of the array contains the year, the second has
         * the month, and the third contains the day.
         * @return  the current date in an array, separated into year, month, and day
         * @throws  RemoteException if the remote invocation fails
        public String[] currentDate() throws RemoteException {
            String[] ymd = new String[3];
            Calendar today = Calendar.getInstance();
            ymd[0] = Integer.toString(today.get(Calendar.YEAR));
            ymd[1] = Integer.toString(today.get(Calendar.MONTH) + 1);
            ymd[2] = Integer.toString(today.get(Calendar.DATE));
            for (int i = 0; i < ymd.length; i++) {
                if (ymd.length() < 2) {
    ymd[i] = "0" + ymd[i];
    return ymd;
    public static void main(String[] args) {
    try {
    String name = "DateService";
    int rmiPort = 1099;
    DateService service = new DateServiceImpl();
    System.out.println("DateServiceImpl instance created.");
    Registry registry = LocateRegistry.createRegistry(rmiPort);
    System.out.println("RMI registry created on port " + rmiPort);
    DateService stub =
    (DateService)UnicastRemoteObject.exportObject(service, 0);
    System.out.println(
    "Service object exported and able to receive method invocation calls.");
    registry.rebind(name, stub);
    System.out.println("DateServiceImpl bound to the name \"" + name + "\"");
    while (true) {
    try {
    Thread.sleep(100);
    } catch (InterruptedException e) {
    e.printStackTrace();
    } catch (Exception e) {
    System.err.println("DateServiceImpl exception:");
    e.printStackTrace();
    DateClient.javapackage client;
    import java.rmi.registry.LocateRegistry;
    import java.rmi.registry.Registry;
    import date.DateService;
    public class DateClient {
        public static void main(String args[]) {
            try {
                String name = "DateService";
                Registry registry = LocateRegistry.getRegistry();
                DateService service = (DateService)registry.lookup(name);
                String[] today = service.currentDate();
                for (int i = 0; i < today.length; i++) {
                    System.out.print((i == 0 ? "Today's date is " : "/") + today);
    System.out.println();
    } catch (Exception e) {
    System.err.println("DateClient exception:");
    e.printStackTrace();

  • Dynamic Class Loading and Stubs

    How Dynamic Class Loading is used on Java RMI, since stubs are generated on clients using Reflection API?
    I was reading Dynamic code downloading using JavaTM RMI (http://java.sun.com/javase/6/docs/technotes/guides/rmi/codebase.html), it seems to be out of date.
    For example, "The client requests the class definition from the codebase. The codebase the client uses is the URL that was annotated to the stub instance when the stub class was loaded by the registry. Back in step 1, the annotated stub for the exported object was then registered with the Java RMI registry bound to a name."

    "Enhancements in J2SETM 5.0
    Dynamic Generation of Stub Classes
    This release adds support for the dynamic generation of stub classes at runtime, obviating the need to use the Java(tm) Remote Method Invocation (Java RMI) stub compiler, rmic, to pregenerate stub classes for remote objects. *Note that rmic must still be used to pregenerate stub classes for remote objects that need to support clients running on _earlier versions_.*
    When an application exports a remote object (using the constructors or static exportObject methods(1) of the classes java.rmi.server.UnicastRemoteObject or java.rmi.activation.Activatable) and a pregenerated stub class for the remote object's class cannot be loaded, the remote object's stub will be a java.lang.reflect.Proxy instance (whose class is dynamically generated) with a java.rmi.server.RemoteObjectInvocationHandler as its invocation handler.
    An existing application can be deployed to use dynamically generated stub classes unconditionally (that is, whether or not pregenerated stub classes exist) by setting the system property java.rmi.server.ignoreStubClasses to "true". If this property is set to "true", pregenerated stub classes are never used.
    Notes:
    * If a remote object has pre-5.0 clients, that remote object should use a stub class pregenerated with rmic or the client will get an ClassNotFoundException deserializing the remote object's stub. Pre-5.0 clients will not be able to load an instance of a dynamically generated stub class, because such a class contains an instance of RemoteObjectInvocationHandler, which was not available prior to this release.
    * Prior to the J2SE 5.0 release, exporting a remote object would throw a java.rmi.StubNotFoundException if the pregenerated stub class for the remote object's class could not be loaded. With the added support for dynamically generated stub classes, exporting a remote object that has no pregenerated stub class will silently succeed instead. A user deploying a server application to support pre-5.0 clients must still make sure to pregenerate stub classes for the server's remote object classes, even though missing stub classes are no longer reported at export time. Such errors will instead be reported to a pre-5.0 client when it deserializes a dynamically generated stub class.
    (1) The static method UnicastRemoteObject.exportObject(Remote) is declared to return java.rmi.server.RemoteStub and therefore cannot be used to export a remote object to use a dynamically generated stub class for its stub. An instance of a dynamically generated stub class is a java.lang.reflect.Proxy instance which is not assignable to RemoteStub."
    http://java.sun.com/j2se/1.5.0/docs/guide/rmi/relnotes.html

  • Need urgent help on dynamic download of applets in smart card

    hi
    Can anyone help me on dynamic download of applets onto smartcard using javacard kit.
    I need to know : 1. how much memory it requires?
    2. how fast it is?
    3. the limitations?
    Regards
    Bharath

    Hi Joseph,
    I wanted to know the minimum memory requirements / constraints (if any). The size of the smallest capplet I have is around 10K . I dont want any extra features on the install method as of now. I am still not clear how to take up the scriptgen path of dynamic applet downloading. Can you please elaborate some initial steps to start with? I have already gone through the JCDK users guide, HC12 users guide and CW manuals. I have also successfully flashed and tested JCDK on HC12 for maskgen path.
    Regards
    Bharath

  • EJB download

    am presently working on a project which involves testing ejb components using junit. My question is there any site i can get ejb components on the online that can assist my project.Bearing in mind that the components must utilise Object oriented programming techniques.The intention is to mutate the components with mutants using mujava and using junit to track the mutants.It would be nice if i can be directed to where i can get the components.

    Hey, Alexis!
    grandemange wrote:
    Hi,
    we have a EJB client (running without WLS code, only JDK1.3 and J2sdkee1.2)
    that invokes a WLS EJB server using IIOP. It uses the WLS generated stubs.By, uses WLS generated stubs, do you mean the T3 protocol stub (xxx_WLStub) or the IIOP protocol stub (_xxx_Stub)? I presume you mean the IIOP protocol stub as the T3 protocol stub should have been served to the client auto-magically.
    >
    We would like to dynamic download the stub and parameter classes.
    The client can run in another application server, so it is not an applet.
    Is it possible and how?We are working on this... for the moment, you must install the stubs and parameter classes in the client.
    >
    >
    Regards
    Alexis

Maybe you are looking for

  • Problem with my MacBook 7,1 after Memory Upgrade

    Hello, I have a MacBook (7,1 late 2010 model with the Intel process) and I just tried upgrading the original 2 GB ram (2 - 1 GB chips) with 2 - 2 GB chips (Total of 4 GB of Ram). It boots up fine, allows me to log in then when I went to the Apple Ico

  • Editing from from two macs

    How to edit iweb site in two computers? OS 10.8 Mountain Lion Using Dropbox I couldn't make it work. Maybe because both macs are Moutain Lion and all I read online is old. Seems to be logical and easy, but Dropbox doesn't update the files. Any other

  • Default warehouse not setting to only defined warehouse

    When you do not auto add new warehouses to all items and have strict warehouse controls on the items. if only one warehouse is defined on an item it is not automatically the default on documents instead it is warehouse 01 even if 01 has been deleted.

  • CS6 Photoshop fails to print selected area

    PS fails to Print Selected Area, instead it prints an area smaller than the one selected, and it does not center the image on the paper. How can I fix this? The details: image size is 20x24 in. and my selected area is 10x12 in. I am printing to a 13x

  • Unable to update OSX NSURLErrorDomain error -1012

    It's a lot of weeks that I'm trying to update my OSX installation. I have a list of suggested software updates: - Safari 6.0.2 - Canon software update 2.11 - iTunes 11.1 But everytime I try to update, I receive the following error: NSURLErrorDomain e