Announcement Announcement Module
No announcement yet.
Deserialize remote object to the narrowest accessible class Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Deserialize remote object to the narrowest accessible class

    In shared.jar I have:

    abstract class MyParent {

    abstract class MyClass {
    MyParent getFoo();

    server.jar contains

    abstract class MyChild extends MyParent {

    abstract class MyClassConcrete {
    MyParent getFoo() {return new MyChild();}


    MyParent foo = myClass.getFoo();

    If all 3 jars are in one classloader everything works well.

    But client and server are in different JVMs while:
    • JVM-1 contains: server.jar, shared.jar
    • JVM-2 contains: client.jar, shared.jar

    Client makes call to server. Server returns MyConcreteClass and Java fails to deserialize it (ClassNotFoundException).

    What I wanna do:
    • Server serializes class and sends data and set of class's ancestors
    • Client finds the narrowest ancestor it may deserialize.

    And everything is ok: we have instance of MyParent on the client and that is what we need.

    I can't believe there is no such engines. Do you know one? I am sure remote call should be as similar to local calls as possible.


  • #2
    I found soltion: