java - GWT server side validation and RPC serialization -


can use constraintviolation or constraintviolationexception objects in async callback return values rpc (gwt 2.5) ?

i have first tried constraintviolation , gwt didn't want because (i think) constraintviolation not have parameterless constructor.

i tried constraintviolationexception , not work either, reason (see below trace).

do absolutely have catch exceptions (constraintviolationexception) instead of using return values ?

com.google.gwt.user.client.rpc.serializationexception: type 'org.hibernate.validator.engine.constraintviolationimpl' not included in set of types can serialized serializationpolicy or class object not loaded. security purposes, type not serialized.: instance = constraintviolationimpl{interpolatedmessage='{contact.validcompanyorperson}', propertypath=, rootbeanclass=class com.mycompany.shared.foo.bar.mybean, messagetemplate='{contact.validcompanyorperson}'}     @ com.google.gwt.user.server.rpc.impl.serverserializationstreamwriter.serialize(serverserializationstreamwriter.java:667)     @ com.google.gwt.user.client.rpc.impl.abstractserializationstreamwriter.writeobject(abstractserializationstreamwriter.java:126)     @ com.google.gwt.user.client.rpc.core.java.util.collection_customfieldserializerbase.serialize(collection_customfieldserializerbase.java:44)     @ com.google.gwt.user.client.rpc.core.java.util.hashset_customfieldserializer.serialize(hashset_customfieldserializer.java:39)     @ com.google.gwt.user.client.rpc.core.java.util.hashset_customfieldserializer.serializeinstance(hashset_customfieldserializer.java:51)     @ com.google.gwt.user.client.rpc.core.java.util.hashset_customfieldserializer.serializeinstance(hashset_customfieldserializer.java:28)     @ com.google.gwt.user.server.rpc.impl.serverserializationstreamwriter.serializeimpl(serverserializationstreamwriter.java:788)     @ com.google.gwt.user.server.rpc.impl.serverserializationstreamwriter.serialize(serverserializationstreamwriter.java:669)     @ com.google.gwt.user.client.rpc.impl.abstractserializationstreamwriter.writeobject(abstractserializationstreamwriter.java:126)     @ javax.validation.constraintviolationexception_customfieldserializer.serialize(constraintviolationexception_customfieldserializer.java:49)     @ javax.validation.constraintviolationexception_customfieldserializer.serializeinstance(constraintviolationexception_customfieldserializer.java:72)     @ javax.validation.constraintviolationexception_customfieldserializer.serializeinstance(constraintviolationexception_customfieldserializer.java:28)     @ com.google.gwt.user.server.rpc.impl.serverserializationstreamwriter.serializeimpl(serverserializationstreamwriter.java:788)     @ com.google.gwt.user.server.rpc.impl.serverserializationstreamwriter.serialize(serverserializationstreamwriter.java:669)     @ com.google.gwt.user.client.rpc.impl.abstractserializationstreamwriter.writeobject(abstractserializationstreamwriter.java:126)     @ com.google.gwt.user.server.rpc.impl.serverserializationstreamwriter$valuewriter$8.write(serverserializationstreamwriter.java:153)     @ com.google.gwt.user.server.rpc.impl.serverserializationstreamwriter.serializevalue(serverserializationstreamwriter.java:587)     @ com.google.gwt.user.server.rpc.rpc.encoderesponse(rpc.java:605)     @ com.google.gwt.user.server.rpc.rpc.encoderesponseforsuccess(rpc.java:471)     @ com.google.gwt.user.server.rpc.rpc.invokeandencoderesponse(rpc.java:563)     @ com.google.gwt.user.server.rpc.remoteserviceservlet.processcall(remoteserviceservlet.java:208)     @ com.google.gwt.user.server.rpc.remoteserviceservlet.processpost(remoteserviceservlet.java:248)     @ com.google.gwt.user.server.rpc.abstractremoteserviceservlet.dopost(abstractremoteserviceservlet.java:62)     @ javax.servlet.http.httpservlet.service(httpservlet.java:650)     @ javax.servlet.http.httpservlet.service(httpservlet.java:731)     @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:303)     @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:208)     @ org.apache.tomcat.websocket.server.wsfilter.dofilter(wsfilter.java:52)     @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:241)     @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:208)     @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:218)     @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:122)     @ org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:505)     @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:169)     @ org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:103)     @ org.apache.catalina.valves.accesslogvalve.invoke(accesslogvalve.java:956)     @ org.apache.catalina.core.standardenginevalve.invoke(standardenginevalve.java:116)     @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:442)     @ org.apache.coyote.http11.abstracthttp11processor.process(abstracthttp11processor.java:1083)     @ org.apache.coyote.abstractprotocol$abstractconnectionhandler.process(abstractprotocol.java:640)     @ org.apache.tomcat.util.net.jioendpoint$socketprocessor.run(jioendpoint.java:318)     @ java.util.concurrent.threadpoolexecutor.runworker(unknown source)     @ java.util.concurrent.threadpoolexecutor$worker.run(unknown source)     @ org.apache.tomcat.util.threads.taskthread$wrappingrunnable.run(taskthread.java:61)     @ java.lang.thread.run(unknown source) 

20161114 update: i'm out of ideas. have tried copying constraintviolationimpl (hibernate-validator-4.1.0's) in own source file, sending on wire. won't work because "com.google.gwt.user.client.rpc.serializationexception: type 'com.mycompany.common.gwt.ui.shared.gwtconstraintviolation' not included in set of types can serialized serializationpolicy or class object not loaded". more information below (eclipse development mode console).

[debug] [foo_bar] - rebinding com.mycompany.ihm.client.gwt.foo.client.service.fooservice     [debug] [foo_bar] - invoking generator com.google.gwt.user.rebind.rpc.serviceinterfaceproxygenerator         [debug] [foo_bar] - generating client proxy remote service interface 'com.mycompany.ihm.client.gwt.foo.client.service.fooservice'             [debug] [foo_bar] - analyzing 'com.mycompany.ihm.client.gwt.foo.client.service.fooservice' serializable types                 [debug] [foo_bar] - analyzing methods:                     [debug] [foo_bar] - public abstract java.util.set<com.mycompany.commun.gwt.ui.shared.gwtconstraintviolation<com.mycompany.ihm.client.gwt.foo.shared.pack.mybean>> getconstraintviolations2(com.mycompany.ihm.client.gwt.foo.shared.pack.mybean saisie)                         [debug] [foo_bar] - return type: java.util.set<com.mycompany.commun.gwt.ui.shared.gwtconstraintviolation<com.mycompany.ihm.client.gwt.foo.shared.pack.mybean>>                             [debug] [foo_bar] - java.util.set<com.mycompany.commun.gwt.ui.shared.gwtconstraintviolation<com.mycompany.ihm.client.gwt.foo.shared.pack.mybean>>                                 [debug] [foo_bar] - verifying instantiability                                     [debug] [foo_bar] - java.util.treeset<com.mycompany.commun.gwt.ui.shared.gwtconstraintviolation<com.mycompany.ihm.client.gwt.foo.shared.pack.mybean>>                                         [debug] [foo_bar] - checking parameters of 'java.util.treeset<com.mycompany.commun.gwt.ui.shared.gwtconstraintviolation<com.mycompany.ihm.client.gwt.foo.shared.pack.mybean>>'                                             [debug] [foo_bar] - checking type argument 0 of type 'java.util.treeset<e>' because directly exposed in type or in 1 of subtypes                                                 [debug] [foo_bar] - com.mycompany.commun.gwt.ui.shared.gwtconstraintviolation<com.mycompany.ihm.client.gwt.foo.shared.pack.mybean>                                                     [debug] [foo_bar] - verifying instantiability                                                         [debug] [foo_bar] - com.mycompany.commun.gwt.ui.shared.gwtconstraintviolation<com.mycompany.ihm.client.gwt.foo.shared.pack.mybean>                                                             [debug] [foo_bar] - analyzing fields of type 'com.mycompany.commun.gwt.ui.shared.gwtconstraintviolation<com.mycompany.ihm.client.gwt.foo.shared.pack.mybean>' qualify serialization                                                                 [debug] [foo_bar] - private javax.validation.path propertypath                                                                     [debug] [foo_bar] - javax.validation.path                                                                         [debug] [foo_bar] - verifying instantiability                                                                             [debug] [foo_bar] - com.google.gwt.validation.client.impl.pathimpl                                                                                 [debug] [foo_bar] - analyzing fields of type 'com.google.gwt.validation.client.impl.pathimpl' qualify serialization                                                                                     [warn] [foo_bar] - field 'private final java.util.list<javax.validation.path.node> nodes' not serialized because final 

gwtconstraintviolation defined 'public class gwtconstraintviolation implements constraintviolation, isserializable' (content copy-paste hibernate validator). have commented out object field because know gwt not that.

no, according gwt documentation, can throw exceptions rpc methods.

the exact handling depends on type of exception:

  • for checked exceptions it's enough have them listed throws in method signature
  • unchecked exceptions wrapped invocationexception. original exception logged on server-side.

i guess in case constraintviolationexception unchecked exception. should "catchable" invocationexception on client side. stacktrace posted should log output on server side.

if want further handle unchecked exception on client side, suggest wrap own checked exception , throw rpc method.


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -