[Engine-devel] oVirt UI technology stack upgrade complete
Vojtech Szocs
vszocs at redhat.com
Wed Jul 31 13:17:30 UTC 2013
Hello everyone,
last week, we merged a patch that upgrades oVirt UI technology stack to use the latest version of Google Web Toolkit SDK and related modules [1]. This patch includes all "essential" upgrade changes as described in [2].
After merging the above mentioned patch, we faced some issues related to GWT RPC serialization, involving classes shared between frontend and backend. Please read on to learn more about these issues and ways to fix them.
--
(A) NullPointerException at server-side (GWT RPC servlet) when serializing backend business entity into RPC response payload
Symptoms
* exception in server.log -> Exception while dispatching incoming RPC call: java.lang.NullPointerException
* error dialog in web UI with status code 500 (internal server error)
Root cause
* fields such as "private X field = Y;" of the given entity are not included in GWT RPC serialization policy
* this happens when entity constructor isn't referenced in UI code -> GWT compiler marks the constructor and instance initializer as dead code
* since instance initializer takes care of adding such fields to given type (entity) in generated JavaScript, such fields won't be added at all
Workaround
* for each field such as "private X field = Y;"
1, change field declaration to "private X field;"
2, add "field = Y;" statement to constructor
Consequence
* even though constructor and instance initializer are marked as dead code, fields such as "private X field;" are still added to given type (entity) in generated JavaScript
* this is due to how generated JavaScript works, i.e. fields without initialization statement such as "private X field;" are always added, whereas fields with initialization statement such as "private X field = Y;" are added via instance initializer (which might be removed if it's marked as dead code)
References
* patch [http://gerrit.ovirt.org/#/c/17352/] for RepoImage entity
--
(B) Instance field(s) with null values at server-side after deserializing RPC request payload
Symptoms
* object passed from client contains field(s) with null values, despite client initializing fields before making RPC call
Root cause
* client uses RPC method signature that works with type A, i.e. VdcActionParametersBase
* type A meets GWT RPC serialization rules, as defined in [3] section "Serializable User-defined Classes"
* client uses type B (extends A) when calling given RPC method at runtime, i.e. MyCustomParameters
* type B does NOT meet GWT RPC serialization rules, i.e. missing no-arg constructor
* back at server-side, GWT RPC servlet fails to deserialize type B properly
Workaround
* ensure all types participating in GWT RPC communication meet GWT RPC serialization rules
1, assignable to IsSerializable or Serializable interface
2, all non-final & non-transient instance fields meet GWT RPC serialization rules
3, contains no-arg constructor (in order to create instance during deserialization)
References
* patch [http://gerrit.ovirt.org/#/c/17368/] for Gluster Parameter classes
--
Regards,
Vojtech
[1] http://gerrit.ovirt.org/#/c/16739/
[2] http://www.ovirt.org/Features/GWT_Platform_Upgrade
[3] http://www.gwtproject.org/doc/latest/DevGuideServerCommunication.html#DevGuideSerializableTypes
More information about the Engine-devel
mailing list