Re: Scan query ClassNotFoundException
Hello! Key/value classes need to be manually deployed to server node but the listener code itself may be peer loaded from client. Regards, -- Ilya Kasnacheev пт, 18 июн. 2021 г. в 10:31, ict.management.trexon < ict.management.tre...@gmail.com>: > If I were to do this, it would mean that peerClassLoading cannot work with > scan queries, as the class, POJO in this case, should be known on the > server > node side. > Instead, like this, it works: > @Override > public boolean apply(Integer e1, BinaryObject e2) { > SimplePojo sp = e2.deserialize(SimplePojo.class.getClassLoader()); > return sp.getId().equals(idToFind); > } > look this: > e2.deserialize(SimplePojo.class.getClassLoader()); > > > > -- > Sent from: http://apache-ignite-users.70518.x6.nabble.com/ >
Re: Scan query ClassNotFoundException
If I were to do this, it would mean that peerClassLoading cannot work with scan queries, as the class, POJO in this case, should be known on the server node side. Instead, like this, it works: @Override public boolean apply(Integer e1, BinaryObject e2) { SimplePojo sp = e2.deserialize(SimplePojo.class.getClassLoader()); return sp.getId().equals(idToFind); } look this: e2.deserialize(SimplePojo.class.getClassLoader()); -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: Scan query ClassNotFoundException
Hello! I guess that SimplePojo class is loaded in a different classloader which is not Ignite's classloader. You can start IgniteConfiguration with .setClassLoader(SimplePojo.class.getClassLoader()); Regards. -- Ilya Kasnacheev чт, 17 июн. 2021 г. в 16:48, ict.management.trexon < ict.management.tre...@gmail.com>: > NO, POJO only client side > YES, peerClassLoadingEnabled > > I think it has something to do with the classloader running the scan query > . > if in the signature of the "apply" method I pass the definition of the POJO > class, it gives a ClassNotFoundException error; > On the other hand, in the body of the "apply" method, if I pass the > definition of the class, it works. > > THIS WORK! > @Override > public boolean apply(Integer e1, BinaryObject e2) { > SimplePojo sp = > e2.deserialize(SimplePojo.class.getClassLoader()); > return sp.getId().equals(idToFind); > } > > THIS NOT WORK! > @Override > public boolean apply(Integer e1, SimplePojo e2) { > return sp.getId().equals(idToFind); > } > > > > > > > -- > Sent from: http://apache-ignite-users.70518.x6.nabble.com/ >
Re: Scan query ClassNotFoundException
NO, POJO only client side YES, peerClassLoadingEnabled I think it has something to do with the classloader running the scan query . if in the signature of the "apply" method I pass the definition of the POJO class, it gives a ClassNotFoundException error; On the other hand, in the body of the "apply" method, if I pass the definition of the class, it works. THIS WORK! @Override public boolean apply(Integer e1, BinaryObject e2) { SimplePojo sp = e2.deserialize(SimplePojo.class.getClassLoader()); return sp.getId().equals(idToFind); } THIS NOT WORK! @Override public boolean apply(Integer e1, SimplePojo e2) { return sp.getId().equals(idToFind); } -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: Scan query ClassNotFoundException
Hello! Do you actually have the POJO class on the server side? Do you have peer class loading enabled? Regards, -- Ilya Kasnacheev пт, 11 июн. 2021 г. в 11:37, ict.management.trexon < ict.management.tre...@gmail.com>: > Hi, why the scanquery return me this error? > I've a cache , the POJO is a simple entity from jar > dependency, > it extend an abstract class who implement an interface that extends > serializable. > I've follow the example on page > https://ignite.apache.org/docs/latest/key-value-api/using-scan-queries > The IgniteBiPredicate is a concrete class, not a lambda. > If i do an IgniteRunnable with the POJO class, no error returned, all work > well. Why scan query fails? > tank! > > > > -- > Sent from: http://apache-ignite-users.70518.x6.nabble.com/ >
Re: Scan query ClassNotFoundException
Incredible. By treating the cache with withKeepBinary (), obviously the IgniteBiPredicate also, now WORKS! However, such a solution is not normal. Below the classes and the search method: public class SimplePojo implements Serializable{ private static final long serialVersionUID = 1L; private Integer id; private String str1; public SimplePojo() {} public Integer getId() {return id;} public String getStr1() {return str1;} public void setId(Integer id) {this.id = id;} public void setStr1(String str1) {this.str1 = str1;} } public class SmplePojoFilter implements IgniteBiPredicate { private static final long serialVersionUID = 1L; private Integer idToFind; private String srtToFind; public SmplePojoFilter() {} public SmplePojoFilter(Integer idToFind, String srtToFind) { super(); this.idToFind = idToFind; this.srtToFind = srtToFind; } @Override public boolean apply(Integer e1, BinaryObject e2) { SimplePojo sp = e2.deserialize(SimplePojo.class.getClassLoader()); return sp.getId().equals(idToFind); } } IgniteCache cache = ignite.getOrCreateCache(c_cfg); SmplePojoFilter spf = new SmplePojoFilter(1, null); Collection res = new ArrayList<>(); try(QueryCursor> cursor = cache.withKeepBinary().query(new ScanQuery<>(spf))){ cursor.forEach(entry->res.add(entry.getValue().deserialize())); } -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: Scan query ClassNotFoundException
I've also prepared a test with the simplest POJO possible, ad the ClassNotFoundException persist with scanquery: public class SimplePojo implements Serializable{ private static final long serialVersionUID = 1L; private Integer id; private String str1; public SimplePojo() {} public Integer getId() {return id;} public String getStr1() {return str1;} public void setId(Integer id) {this.id = id;} public void setStr1(String str1) {this.str1 = str1;} } public class SmplePojoFilter implements IgniteBiPredicate { private static final long serialVersionUID = 1L; private Integer idToFind; private String srtToFind; public SmplePojoFilter() {} public SmplePojoFilter(Integer idToFind, String srtToFind) { super(); this.idToFind = idToFind; this.srtToFind = srtToFind; } @Override public boolean apply(Integer e1, SimplePojo e2) { return e2.getId().equals(idToFind); } } IgniteCache cache = ignite.getOrCreateCache(c_cfg); SmplePojoFilter spf = new SmplePojoFilter(1, null); Collection res = new ArrayList<>(); try(QueryCursor> cursor = cache.query(new ScanQuery<>(spf))){ cursor.forEach(entry->res.add(entry.getValue())); } -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Scan query ClassNotFoundException
Hi, why the scanquery return me this error? I've a cache , the POJO is a simple entity from jar dependency, it extend an abstract class who implement an interface that extends serializable. I've follow the example on page https://ignite.apache.org/docs/latest/key-value-api/using-scan-queries The IgniteBiPredicate is a concrete class, not a lambda. If i do an IgniteRunnable with the POJO class, no error returned, all work well. Why scan query fails? tank! -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/