RMI client side callbacks

Hi all,
I have an RMI server and a number of clients that run on different machines. What I need to do is, implement the "observer" pattern. i.e.
in my case, not only the clients call the server, but also the server
must notify the registered clients when its state changes.
For that purpose, I suppose, that my clients must also be RMI servers.
My first question is, is that true what I suppose? Is there any other
way to implement asynchron client side callbacks with RMI?
My second question is, if it must be done so (clients are also RMI servers), how can I implement this? Server needs client interface jar
file, ans client needs server interface jar file at compile time.
(Important: I do not use any HTTP server from which I can load _Stub
classes at runtime)
I don't like this architecture at all and therefore think that there
may be better solutions. One solution may be to poll the state of the
server from the clients periodically, so that there is no need for
callbacks. But that is also not the perfect solution for me.
Can someone suggest anything else?
Any idea will be greatly appreciated!
Thank you

Hello guvener
Some time ago, I did exactly what you are thinking about. Here was the strategy.
1. There was a server program, sitting (obviously) on the server machine, where rmiserver was running. The server class had only a single public method for the calling routines to call.
2. That public method took, as a parameter, a transaction request. One possible transaction was, "Here is a message for another client." Another possible transaction was, "Listen out for a message for me." For example, a client would call the server with the "listen" transaction or with a "here's a message" transaction.
3. When the calling method requested a "listen" transaction, the server would enter a "wait" state until it received a message for that particular client.
4. To prevent blocking, there were three specific strategies:
(a) The client would call the server with a "listen" transaction in a separate thread.
(b) There was a "cancel" transaction that would allow a client to cancel its "listen" transaction with the server.
(c) There was a "close-down" transaction that would allow the server to tell the clients their "listen" transactions had been cancelled, as it was closing down.
This requires thorough and careful planning. However, once the classes are correctly planned, this strategy is elegant and simple and leads to only a small amount of coding. It's also flexible, without any restrictions on how many transactions a client could request at a time.
Do be careful to synchronize where applicable!
I hope this helps.

Similar Messages

  • RMI client-side - how to encrypt,decrypt  in client-side

    I write javacard RMI style. My problem is...
    Source code below is work when it write in applet (card - side)
    but in client-side (reader -side) I copy it to client - side code and test to run, if fail --> throw exception 0x3 - javacard.security.CryptoException.NO_SUCH_ALGORITHM
    It seem to be "javacardx.crypto" and "javacard.security" is make for use in applet in card only. Did I misunderstand?
    if it make for use in applet only, how is possible to do like this " card use privatekey to sign message and send to reader , reader use card's publickey to verify that card sign this signature or not."
    or
    "card use reader's publickey to encrypt message and send to reader, then reader use privatekey to decrypt message (reader authencate itself) "
    because I can't do any of cipher , keybuilder in RMI-client side(reader)
    Cipher.getInstance(Cipher.ALG_RSA_PKCS1,false);
    it will throw nullPointerException
    and if (change false to true)
    Cipher.getInstance(Cipher.ALG_RSA_PKCS1,true);
    throw exception 0x3 - javacard.security.CryptoException.NO_SUCH_ALGORITHM
    after that I swap this line with
    pri_key = (RSAPrivateKey) KeyBuilder.buildKey(KeyBuilder.TYPE_RSA_PRIVATE,KeyBuilder.LENGTH_RSA_512, false);
    since it will do this first (i swap the line already) it also throw exception 0x3 - javacard.security.CryptoException.NO_SUCH_ALGORITHM
    also be the same result with swap
    kp = new KeyPair(KeyPair.ALG_RSA,(short)KeyBuilder.LENGTH_RSA_512 );
    to a first line
    it throw exception 0x3 - javacard.security.CryptoException.NO_SUCH_ALGORITHM
    Please help me
    RSAPrivateKey pri_key;
    RSAPublicKey pub_key;
    KeyPair kp;
    Cipher RSAcipher;
    RSAcipher = Cipher.getInstance(Cipher.ALG_RSA_PKCS1,false);
    pri_key = (RSAPrivateKey) KeyBuilder.buildKey(KeyBuilder.TYPE_RSA_PRIVATE,KeyBuilder.LENGTH_RSA_512, false);
    pub_key =(RSAPublicKey) KeyBuilder.buildKey(KeyBuilder.TYPE_RSA_PUBLIC,KeyBuilder.LENGTH_RSA_512, false);
    kp = new KeyPair(KeyPair.ALG_RSA,(short)KeyBuilder.LENGTH_RSA_512 );
    kp.genKeyPair();
              pri_key = (RSAPrivateKey) kp.getPrivate();
              pub_key = (RSAPublicKey) kp.getPublic();
    //ENCRYPT
    RSAcipher.init(pri_key, Cipher.MODE_ENCRYPT);
    t_cipherLengthRSA = RSAcipher.doFinal(plaintxt,(short)0, (short)plaintxt.length, t_cipherText, (short)0);
    //DECRYPT
    RSAcipher.init(pub_key, Cipher.MODE_DECRYPT);
    RSAcipher.doFinal(ciphertxt,(short)0,(short) t_cipherLengthRSA, temp1, (short)0);

    I write javacard RMI style. My problem is...
    Source code below is work when it write in applet (card - side)
    but in client-side (reader -side) I copy it to client - side code and test to run, if fail --> throw
    exception 0x3 - javacard.security.CryptoException.NO_SUCH_ALGORITHMYou can not share code between card and client. On the card use the classes of javacardx.crypto and on the client side those of javax.crypto and java.security.
    It seem to be "javacardx.crypto" and "javacard.security" is make for use in applet in card only. That is right.
    if it make for use in applet only, how is possible to
    do like this " card use privatekey to sign message
    and send to reader , reader use card's publickey to
    verify that card sign this signature or not." or
    "card use reader's publickey to encrypt message and
    send to reader, then reader use privatekey to decrypt
    message (reader authencate itself) "On each platform you have classes that provide the same cryptographic operations but the interface of these classes is different (because of the limitations of the java card platform).
    because I can't do any of cipher , keybuilder in
    RMI-client side(reader)Use the java.security.KeyFactory instead.
    Cipher.getInstance(Cipher.ALG_RSA_PKCS1,false);
    it will throw nullPointerException
    and if (change false to true)
    Cipher.getInstance(Cipher.ALG_RSA_PKCS1,true);
    throw exception 0x3 -
    javacard.security.CryptoException.NO_SUCH_ALGORITHMCryptographic support on java cards is optional. Not every card supports every algorithm. Try to use another algo.
    Jan

  • Possible to use RMI to upload client side image files?

    Is it possible to use RMI to upload client side image files? My intent is to allow remote clients to upload a number of small image files (jpg & gif) to a central server DBMS, by modifying a "Customer" object (eg adding a new Image object to a vector of Images?) Is this possible? Any suggestions greatly appreciated :))

    Is it possible to use RMI to upload client side image
    files? One possibility is to implement a serializable image object that you can upload to the server as any other object. When your server receives this serialized image object, just generate a new gif/jpg from it.
    But if your client-program is an applet, the situation is different: how can applet read image-file from users harddrive?
    krera

  • Java.rmi.server.codebase=file:(?????); at client side: classnotfounexceptio

    I'm trying to run an RMI application (under Windows XP, one machine for client and server) like this:
    at server side:
    java -Djava.rmi.server.codebase=file://\..\..\..\j\ -Djava.security.policy=file:.\polityka.txt sss
    - and it works fine, but at client side:
    java -Djava.security.policy=file:.\polityka.txt -Djava.rmi.server.codebase=file://\..\..\..\j\ kkk
    results in:
    Exception in thread "main" java.lang.NoClassDefFoundError: PrzykladowaKlasa
    at kkk.main(kkk.java:31)
    when I'm listing directory (at client side) got with System.getProperty("java.rmi.server.codebase") i get this
    file://\..\..\..\j\
    OdleglaKlasa_Stub.class
    PrzykladowaKlasa.class
    Folder Structure is:
    |------j\
    | |------(*_Stub.class, and ClassNeededByClient.class)
    |------2\
    | |------Server\
    | | |------(serwer files)
    | |------Klient\
    | | |------(klient files)
    I'm fresh in RMI and Codebase poperty, but with some exp with Java...
    (policy files are allright - grant {permission java.security.AllPermission;};)
    Any help will be appreciated.

    I've come back to this issue again (since I am moving code around to different systems again). Using linux I can use -Djava.rmi.server.codebase=file://$PWD/build/
    Presumably there is a similar command in WIndows.

  • What is Client-Side API for RMI on the Java Card Platform

    What is Client-Side API for RMI on the Java Card Platform ?
    And what is host software ?

    Your post is weird: you seem not to agree with yourself O_o
    OF COURSE sim cards have CPUs, otherwise how would you run an OS or a java vm on them?
    to drive the wifi there will be a proprietary api, just like mifare access on normal cards.
    the OS should manage the wiki stack in C/asm and expose javacard entry points. only "should" because this is only a press release.

  • Configure client side security polise for RMI

    Hi all!
    How to configure client side security if I want to use applet and RMI on the single
    computer.
    I was editing . java.policy file:
    grant {
    // added to allow RMI/JMS
    permission java.io.SerializablePermission "enableSubstitution";
    permission java.lang.RuntimePermission "setContextClassLoader";
    But I have MarshalException if I want to make a call from one
    Java VM to another.
    Regards,
    Pavel.

    Which version WLS are you using? In the latest versions of WLS 6.0 you need
    not give these extra permissions for the applets.This is taken care in the
    server itself. You can contact support for the patch.
    ..maruthi
    "Pavel" <[email protected]> wrote in message
    news:3bc7d744$[email protected]..
    >
    Hi all!
    How to configure client side security if I want to use applet and RMI onthe single
    computer.
    I was editing . java.policy file:
    grant {
    // added to allow RMI/JMS
    permission java.io.SerializablePermission "enableSubstitution";
    permission java.lang.RuntimePermission "setContextClassLoader";
    But I have MarshalException if I want to make a call from one
    Java VM to another.
    Regards,
    Pavel.

  • Send Message from RMI Server to RMI Client

    Hi,
    I want to send message to RMI Client throw RMI server to refresh client's data object as it is database application. I guessed i could implement an interface on client side and i can register my client to the server by sending object to the server. It is not helping it is throwing NULL Pointer exception on server side and it is not refreshing. It seems like it is not passing by reference.
    Can any one please guide me with how to send messages to clinet. What is the best way to do it?
    -A Thakkar.

    You need to elaborate the object model of your client. When you run into this situiation where you might have to sublass two different objects, then you should take a look at breaking the client itself into more than one object.
    Let me put it another way: A JFrame is a GUI object; why would you ever try to callback a GUI object? Can't you create - say - a CallbackHandler, and let it initiate further action in the client?

  • How can i look up a EJB residing in different machine from client side?

    hai ,
    How can i look up a EJB residing in different machine from client side?
    this is my code...........i don't know what should i use as Initial Context Factory...................i am using a sun appserver 8............
    package com.parx.lms.lmsdelegate;
    import com.parx.lms.exception.LMSException;
    import javax.naming.Context;
    import javax .ejb.CreateException;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import javax.rmi.PortableRemoteObject;
    import java.rmi.RemoteException;
    import com.parx.lms.controller.*;
    import com.parx.lms.vo.UserVo;
    import com.parx.lms.exception.BusinessException;
    import java.util.Hashtable;
    import java.lang.*;
    public class LmsDelegate{
    private final static String JNDI_NAME="LmsBean";
    private static String url="http://localhost:4848";
    public static Lms lms = null;
    public void getController() throws CreateException,
    NamingException,RemoteException{
    if(lms == null){
    Hashtable h=new Hashtable();
    h.put(Context.INITIAL_CONTEXT_FACTORY," ********what should i use here???????*************************");
    h.put(Context.PROVIDER_URL,url);
    System.out.println("Before Loading Context in Delegate");
    Context ctx=new InitialContext(h);
    System.out.println("Loaded Context in Delegate");
    Object obj=ctx.lookup(JNDI_NAME);
    System.out.println("Loaded Object in Delegate");
    System.out.println("Before Loading Home in Delegate");
    LmsHome home = (LmsHome )PortableRemoteObject.narrow(obj,com.parx.lms.controller.LmsHome.class);
    System.out.println("Loaded Home in Delegate");
    lms = home.create();
    System.out.println("Loaded remote in Delegate");
    public void addUserDelegate(UserVo vo) throws BusinessException{
    try{
    getController();
    System.out.println("Before calling the addUser of Session");
    lms.addUser(vo);
    }catch(CreateException e){
    System.out.println("Create Exception in Delegate due to--->"+e);
    e.printStackTrace();
    throw new BusinessException(e);
    }catch(NamingException e){
    System.out.println("Naming Exception in Delegate due to--->"+e);
    e.printStackTrace();
    throw new BusinessException(e);
    catch(RemoteException e){
    System.out.println("Remote Exception in Delegate due to--->"+e);
    e.printStackTrace();
    throw new BusinessException(e);
    }catch(LMSException e){
    System.out.println("duplicate user name--->"+e);
    e.printStackTrace();
    throw new BusinessException(e);
    pls help me..........

    h.put(Context.INITIAL_CONTEXT_FACTORY," ********what should i use here???????*************************")
    Each app server provides their own jndi factory class. For ex for weblogic it is weblogic.jndi.WLInitialContextFactory. SInce you are using sun app server, check if there are any examples to find out or the docs.
    private static String url="http://localhost:4848
    Since the client is in a different machine the localhost is not going to work here. provide the url or the machine name of the system in which ur sunapp server is running. In addition u will need to have the stubs of the remote interfaces in ur client machine.

  • How to implement server side methods in client side player from main.asc?

    Hi,
    I am developing video player using RTMP NetConnection and NetStream object but it is giving me below Error. Can you please tell me how can I handle this. I have main.asc file form FMS server side but I don't know how to use it. 
    Async Error found = <br>Error #2095: flash.net.NetConnection was unable to invoke callback setUserID.
    Async Error found = <br>Error #2095: flash.net.NetConnection was unable to invoke callback syncChat.
    Async Error found = <br>Error #2095: flash.net.NetConnection was unable to invoke callback playingNotComplete.
    Async Error found = <br>Error #2095: flash.net.NetConnection was unable to invoke callback nowPlaying.
    Can anyone please help me ot solve this issue?
    Best regards,
    Sunil kumar

    javascript are run on the client side.. but i think what you actually mean is getting some validation to your database without submitting the form?. yes it doesn't consumes time and memory of server.. why not use ajax so you can only submit a little request.. rather than submitting the whole page..

  • Rmi Cliaent-side Exceptions

    Hi,
    I'm trying a Rmi implementation. The server side classes-interface look to work properly, but when I try to refer to remote objects from my client, it throws the following exception:
    java.rmi.UnmarshalException: error unmarshalling return; nested
    exception is:
    java.lang.ClassNotFoundException:
    RmiImplementation.RiceviFileImp_Stub
    I run the client with the command:
    java
    - Djava.rmi.server.codebase=file:/d:\RmiImplementation/ RmiClient.RmiClient
    The server run on a NT 4.0 workstation, and the stub calss is
    d:\RmiImplementation\RiceviFileImp_Stub.class
    Thanks in advance
    Fabio

    Of course, the class is downloadble frm a server!!!
    The matter is that on the su. web site, they write an example using an applet, that's a little different, since it's compiled on the server machine and just excecuted on the client side.
    Do I have to do something different if I'm not implementing an Applet?

  • RMI Client Issue

    Hello,
    Here is my client side RMI program:
    import java.rmi.*;
    public class MyRemoteClient {
    public static void main(String args[]) {
         MyRemoteClient mm = new MyRemoteClient();
         mm.go();
    public void go(){
         try{
              MyRemote service2 = (MyRemote) Naming.lookup("rmi://xxx.xxx.xx.xx/Hello");
              String s = service2.sayHello();
              System.out.println(s);
         } catch(Exception ex){ex.printStackTrace();}
    Having started RMI Registry and Service Implementor code on the server, if I try to run the above code on the client it fire the following error:
    java.rmi.ConnectException: Connection refused to host: 127.0.1.1; nested exception is:
         java.net.ConnectException: Connection refused: connect
         at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source)
         at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source)
         at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source)
         at sun.rmi.server.UnicastRef.invoke(Unknown Source)
         at MyRemoteImpl_Stub.sayHello(Unknown Source)
         at MyRemoteClient.go(MyRemoteClient.java:11)
         at MyRemoteClient.main(MyRemoteClient.java:6)
    Caused by: java.net.ConnectException: Connection refused: connect
         at java.net.PlainSocketImpl.socketConnect(Native Method)
         at java.net.PlainSocketImpl.doConnect(Unknown Source)
         at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
         at java.net.PlainSocketImpl.connect(Unknown Source)
         at java.net.SocksSocketImpl.connect(Unknown Source)
         at java.net.Socket.connect(Unknown Source)
         at java.net.Socket.connect(Unknown Source)
         at java.net.Socket.<init>(Unknown Source)
         at java.net.Socket.<init>(Unknown Source)
         at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown Source)
         at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown Source)
         ... 7 more
    I am wondering as to why is it trying to connect to a local host 127.0.1.1 instead of the IP Address specified at by"xxx.xx.xx.xx" in the program?
    I have the stub class and the service interface classes on my client-side.
    Thanks.

    Crossposted and answered in the RMI forum.

  • RMI Client Code Issue

    Hello,
    Here is my client side RMI program:
    import java.rmi.*;
    public class MyRemoteClient {
    public static void main(String args[]) {
    MyRemoteClient mm = new MyRemoteClient();
    mm.go();
    public void go(){
    try{
    MyRemote service2 = (MyRemote) Naming.lookup("rmi://xxx.xxx.xx.xx/Hello");
    String s = service2.sayHello();
    System.out.println(s);
    } catch(Exception ex){ex.printStackTrace();}
    }Having started RMI Registry and Service Implementor code on the server, if I try to run the above code on the client it fire the following error:
    java.rmi.ConnectException: Connection refused to host: 127.0.1.1; nested exception is:
    java.net.ConnectException: Connection refused: connect
    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source)
    at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source)
    at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source)
    at sun.rmi.server.UnicastRef.invoke(Unknown Source)
    at MyRemoteImpl_Stub.sayHello(Unknown Source)
    at MyRemoteClient.go(MyRemoteClient.java:11)
    at MyRemoteClient.main(MyRemoteClient.java:6)
    Caused by: java.net.ConnectException: Connection refused: connect
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(Unknown Source)
    at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
    at java.net.PlainSocketImpl.connect(Unknown Source)
    at java.net.SocksSocketImpl.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at java.net.Socket.<init>(Unknown Source)
    at java.net.Socket.<init>(Unknown Source)
    at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown Source)
    at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown Source)
    ... 7 more
    I am wondering as to why is it trying to connect to a local host 127.0.1.1 instead of the IP Address specified at by"xxx.xx.xx.xx" in the program?
    I have the stub class and the service interface classes on my client-side.
    Thanks.

    I am wondering as to why is it trying to connect to a
    local host 127.0.1.1 instead of the IP Address
    specified at by"xxx.xx.xx.xx" in the program?Because that only specifies where the lookup should be done, i.e. where the Registry is. This lookup() returns a stub to your remote object which has its own IP address and port embedded into it, and that's where 127.0.0.1 is coming from - you're not doing Registry.lookup at this point, you're calling your remote method.
    This indicates a DNS or /etc/hosts misconfiguration - your primary IP address is coming up as 127.0.0.1 instead of whatever your public IP address is. Famous Linux issue. You should really fix it in your DNS or /etc/hosts, but you can work around it by setting -Djava.rmi.server.hostname=<public IP address> at the server JVM.

  • Client side weblogic.management jar

    Hi,
    Could you help me with the following issue?
    I am writing a simple mgmt application that uses Weblogic's JMX APIs remotely
    via JNDI/RMI either from another VM on the same or another box (no firewall issues).
    All is fine except that the weblogic.management interfaces, stubs, and skeletons
    are all part of the huge weblogic.jar.
    Do you know where I can find a client side classes for weblogic.management? I
    noticed that the Weblogic 8.1 distribution comes with client side jars for other
    APIS (e.g. JMS, Web services, EJB etc.) but cannot find one for JMX.
    Thanks a lot for any insight on this,
    Piotr

    Hi Piotr,
    I do not believe there is a client side jar for wl management. This is
    being considered for our next release.
    Thanks,
    -satya
    Piotr Krychniak wrote:
    Hi,
    Could you help me with the following issue?
    I am writing a simple mgmt application that uses Weblogic's JMX APIs remotely
    via JNDI/RMI either from another VM on the same or another box (no firewall issues).
    All is fine except that the weblogic.management interfaces, stubs, and skeletons
    are all part of the huge weblogic.jar.
    Do you know where I can find a client side classes for weblogic.management? I
    noticed that the Weblogic 8.1 distribution comes with client side jars for other
    APIS (e.g. JMS, Web services, EJB etc.) but cannot find one for JMX.
    Thanks a lot for any insight on this,
    Piotr

  • Good name (or maybe a pattern) for a client-side data accessor

    Hello,
    I am building a client/server app, the client is a Swing application.
    The client needs to read/write information to the server. I have a set of "DAO" classes that encapsulate remote acces:
    package myapp.client;
    public class OrderDAO {
        public OrderDTO getDaylyOrders();
        public void saveOrder(OrderDTO order);
    }The implementing class connects to an RMI server which exposes an OrderService interface with more technical methods (getOrdersForDate(Date), getPendingOrders(),...).
    I just feel the name DAO is misleading on the client side, because traditionnally it is a server-side pattern, and indeed in the myapp.server package, I have a set of classes named OrderDAO as well, which do what I think is the usual work of DAOs (mask the usage of the DB to the server logic).
    I'm wondering whether my client-side "DAO" actually follows the intent of the DAO pattern. Otherwise what is it, or how should it be named?
    Isn't it a BusinessDelegate instead, as it encapsulates the usage of the OrderService?
    Note that it is not just a Proxy to the server-side DAO class, because there is a bit of sever-side business logic (filtering and aggregation by the OrderService) between what the server side DAO returns (essentially Lists of entities mapped from the database tables) and what the client-side "DAO" returns.

    It has been a while for me, but when I designed
    applications I favored using some part of a design
    patttern name for the main class of the pattern. For
    Business Delegate objects, using the "Delegate" part
    is helpful if there will ever be other software
    develoeprs working with the code. Even if not, it
    will help you remember the design when/if you return
    to it in a few years or so.I see where you are coming from here but I think that this doesn't really hold up under scrutiny and from my paast experience. First of all, it's not feasible to rely the design with class names. You'll end up with something similar to Hungarian notation if you try. This means that you must have external design documents. It's tempting to think that classnames and JavaDocs will be enough but they aren't. They are necessary but not sufficient.
    When I talk about the 'users of the class' I'm talking about other developers. The 'users of the application' don't see the classes. My experience is that naming classes or anything else with notes about it's internal implementation seems like it would be helpful but is of limited usefulness to maintenance developers. For most work the developer is only going to care what the class does (e.g. retreieve business objects) not how it does it. If the developer need to know that, they can easily open the class documentation and even the source (assuming that's available.
    If you do end up doing this, you also need to think about what will happen if you change the design under the hood of the class. Do you change the name of the class? You really should, if it's name is based on the design. What I've seen happen too often is that it does not happen and the class is named as it if does one thing but acutally does something else entirely.
    OrderServiceDelegate would be an informative
    name because it would imply that the actual code for
    implementing the "order service" is in another class
    and that this class is for "delegating" only.That's easily determined by looking at the class documentation and like I said above, doesn't usually matter to other classes using it. That's one of the main tenets of OO design. Separation of concerns. The classes that use this shouldn't need to know how it does it's job (althought, this is not always feasible IMO.) If the classes depend on a BusinessDelegate, then what do you do if you move the class to an environment where they use the Facade directly, for example. You are in effect coupling related classes to a pattern. If I have a FooRetriever, I might want one that's a business delegate, one that's a DAO and one that is a stub. The idea of coupling an interface to a pattern is strange to me.
    For implementations of the Abstract Factory pattern,
    I typically would include the term "Factory" in the
    class name. Same goes for Facade and Proxy. Factory classes are the most likely misnamed. Often implementations of factories (I know that's not a GoF pattern) or abstract factories are named FooBarSingleton. So, if anything, don't name Singleton classes with the word Singleton.

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

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

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

Maybe you are looking for