Hazelcast: Does Portable Serialization needs objects to be shared between client and server? -


i getting below exception:

could not find portablefactory factory-id: 1 com.hazelcast.nio.serialization.hazelcastserializationexception: not find portablefactory factory-id: 1

on client side have following code:

public class clienttest {      public static void main(string[] args) {          list<string> nodes = new arraylist<string>();         nodes.add("localhost:5701");          clientconfig clientconfig = new clientconfig();         clientnetworkconfig networkconfig = new clientnetworkconfig();         networkconfig.setaddresses(nodes);         clientconfig.setnetworkconfig(networkconfig);          serializationconfig sercong = clientconfig.getserializationconfig();         sercong.addportablefactory(1, new userfactoryimpl());         sercong.setportableversion(1);          hazelcastinstance hzclient1 = hazelcastclient.newhazelcastclient(clientconfig);          imap<string, user> map = hzclient1.getmap("user");         system.out.println(map.size() + "hiten");         user user1 = new user();         user1.setfirstname("hiten");         user1.setlastname("singh");         map.put("1", user1);           //hz1.getlifecycleservice().terminate();         system.out.println(map.size() + "after");          user user2 = new user();         user2.setfirstname("hiten1");         user2.setlastname("singh1");         map.put("2", user2);          userentryprocessor entryproc = new userentryprocessor();         user userres = (user)map.executeonkey("1", entryproc);     }      static class userentryprocessor implements entryprocessor<string, user>, hazelcastinstanceaware {          private transient hazelcastinstance hazelcastinstance;          @override         public object process(entry<string, user> entry) {             user user = entry.getvalue();             if(user != null) {                 system.out.println(user.getfirstname());             }              return user;         }          @override         public entrybackupprocessor<string, user> getbackupprocessor() {             return null;         }          @override         public void sethazelcastinstance(hazelcastinstance hazelcastinstance) {             this.hazelcastinstance = hazelcastinstance;         }      }      static class userfactoryimpl implements portablefactory{          public final static int user_portable_id = 1;          public final static int factory_id = 1;          public portable create(int classid) {             switch (classid) {                 case user_portable_id:                     return new user();             }             return null;         }     }      static class user implements portable {          private string firstname;         private string lastname;          public string getlastname() {             return lastname;         }          public void setlastname(string lastname) {             this.lastname = lastname;         }          public string getfirstname() {             return firstname;         }          public void setfirstname(string firstname) {             this.firstname = firstname;         }          @override         public int getfactoryid() {             return userfactoryimpl.factory_id;         }          @override         public int getclassid() {             return userfactoryimpl.user_portable_id;         }          @override         public void writeportable(portablewriter writer) throws ioexception {             writer.writeutf("first_name", firstname);             writer.writeutf("last_name", lastname);         }          @override         public void readportable(portablereader reader) throws ioexception {             firstname = reader.readutf("first_name");             lastname = reader.readutf("last_name");         }     } } 

yes does, figured out factory , classes need available. there no built-in solution not share classes more sophisticated use cases simple gets / puts. have json support , other ideas cooking nothing done yet.