Re: [gwt-contrib] GWT SerialisationPolicy Error

2012-05-02 Thread Freeland Abbott
It explicitly does increase the size of the generated javascript (more code
for more classes, which later turn out to be unused-in-practice).

More code size also implies more *latency* to download the extra size, but
not really any run-time *slowness*, unless you need to e.g. do paging
because of the extra code size (fairly unlikely, I would hope!).

But yes, more serializable classes means more code generation at compile
time, so it'll be slower.  But probably not much---that part should be
pretty fast, I would think.  The big static problem is the JS code bloat
(and attendant latency), but the functional problem is the runtime error
risk from *non*serializable or server-classpath-only types.


On Wed May 02 20:12:44 GMT-400 2012, Karthik Reddy 
wrote:

> *In a distinct difference from regular Java, GWT usually rewards you for
> being more specific about classes:  if you are specific that you return
> ArrayList only, then GWT only makes a serializer for that, and you save
> client size.  But if you return List<...>, and your classpath for the GWT
> compile includes all 8 of the vanilla Java "List" types, then GWT has to
> generate code to handle all of them, leading to code bloat *
> *
> *
> Does this have any run-time slow-ness is it just a compile-time slowness ?
>
>
> Also, does it increase the ultimate size of the generated javascript?
>
>
> On Wednesday, May 2, 2012 7:35:36 AM UTC-7, Freeland Abbott wrote:
>
> Roughly speaking, the GWT serialization code---specifically, the part of
> the generated server stub that serializes your response to send to the
> client---is getting a type of object (PersistentBag) that it knows the
> client code won't be able to decode, and is stopping as a result.
>
> In this case, PersistentBag is a List, and your interface says it might
> return any kind of List known to the system.  Either the compile of your
> GWT app didn't know about the hibernate classes, to include a deserializer
> for PersistentBag, or (perhaps at least as likely), the hibernate class is
> using some of the features that GWT forbids (e.g. it may be reflective),
> and so we can't generate a deserializer for it.  You can compile with DEBUG
> messages and search for the class name to see what the exact problem is.
>  But one of those two explains why it's "not included in the set."
>
> In a distinct difference from regular Java, GWT usually rewards you for
> being more specific about classes: if you are specific that you return
> ArrayList only, then GWT only makes a serializer for that, and you save
> client size.  But if you return List<...>, and your classpath for the GWT
> compile includes all 8 of the vanilla Java "List" types, then GWT has to
> generate code to handle all of them, leading to code bloat because, in
> fact, you probably don't actually touch CopyOnWriteArrayList, for example.
>  And, to your problem, the server runtime may have List types that the
> client didn't know about to generate code for, or list types that GWT just
> can't handle (but it could handle many others, and doesn't know which
> concrete types you might see).
>
> Since GWT can't prove there *is* an error at compile time, it won't
> whine.  But, using an interface type in your serialization, there *might* be
> a runtime problem, and that's the error message you are seeing.
>
> You might do better to translate the persisted list into a vanilla
> ArrayList, and express your RPC in those terms.  Or you might use something
> other than RPC as a transport, looking at JSON or RequestFactory as a way
> to make the wire protocol lose the detailed Java type and just have a
> JavaScript array as the underlying base.
>
>
>
>  --
> http://groups.google.com/group/Google-Web-Toolkit-Contributors

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Re: [gwt-contrib] GWT SerialisationPolicy Error

2012-05-02 Thread Karthik Reddy
*In a distinct difference from regular Java, GWT usually rewards you for 
being more specific about classes:  if you are specific that you return 
ArrayList only, then GWT only makes a serializer for that, and you save 
client size.  But if you return List<...>, and your classpath for the GWT 
compile includes all 8 of the vanilla Java "List" types, then GWT has to 
generate code to handle all of them, leading to code bloat *
*
*
Does this have any run-time slow-ness is it just a compile-time slowness ? 
  

Also, does it increase the ultimate size of the generated javascript?

On Wednesday, May 2, 2012 7:35:36 AM UTC-7, Freeland Abbott wrote:
>
> Roughly speaking, the GWT serialization code---specifically, the part of 
> the generated server stub that serializes your response to send to the 
> client---is getting a type of object (PersistentBag) that it knows the 
> client code won't be able to decode, and is stopping as a result.
>
> In this case, PersistentBag is a List, and your interface says it might 
> return any kind of List known to the system.  Either the compile of your 
> GWT app didn't know about the hibernate classes, to include a deserializer 
> for PersistentBag, or (perhaps at least as likely), the hibernate class is 
> using some of the features that GWT forbids (e.g. it may be reflective), 
> and so we can't generate a deserializer for it.  You can compile with DEBUG 
> messages and search for the class name to see what the exact problem is. 
>  But one of those two explains why it's "not included in the set."
>
> In a distinct difference from regular Java, GWT usually rewards you for 
> being more specific about classes: if you are specific that you return 
> ArrayList only, then GWT only makes a serializer for that, and you save 
> client size.  But if you return List<...>, and your classpath for the GWT 
> compile includes all 8 of the vanilla Java "List" types, then GWT has to 
> generate code to handle all of them, leading to code bloat because, in 
> fact, you probably don't actually touch CopyOnWriteArrayList, for example. 
>  And, to your problem, the server runtime may have List types that the 
> client didn't know about to generate code for, or list types that GWT just 
> can't handle (but it could handle many others, and doesn't know which 
> concrete types you might see).
>
> Since GWT can't prove there *is* an error at compile time, it won't 
> whine.  But, using an interface type in your serialization, there *might* be 
> a runtime problem, and that's the error message you are seeing.
>
> You might do better to translate the persisted list into a vanilla 
> ArrayList, and express your RPC in those terms.  Or you might use something 
> other than RPC as a transport, looking at JSON or RequestFactory as a way 
> to make the wire protocol lose the detailed Java type and just have a 
> JavaScript array as the underlying base.
>
>
>
>>

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Re: [gwt-contrib] GWT SerialisationPolicy Error

2012-05-02 Thread Freeland Abbott
Roughly speaking, the GWT serialization code---specifically, the part of
the generated server stub that serializes your response to send to the
client---is getting a type of object (PersistentBag) that it knows the
client code won't be able to decode, and is stopping as a result.

In this case, PersistentBag is a List, and your interface says it might
return any kind of List known to the system.  Either the compile of your
GWT app didn't know about the hibernate classes, to include a deserializer
for PersistentBag, or (perhaps at least as likely), the hibernate class is
using some of the features that GWT forbids (e.g. it may be reflective),
and so we can't generate a deserializer for it.  You can compile with DEBUG
messages and search for the class name to see what the exact problem is.
 But one of those two explains why it's "not included in the set."

In a distinct difference from regular Java, GWT usually rewards you for
being more specific about classes: if you are specific that you return
ArrayList only, then GWT only makes a serializer for that, and you save
client size.  But if you return List<...>, and your classpath for the GWT
compile includes all 8 of the vanilla Java "List" types, then GWT has to
generate code to handle all of them, leading to code bloat because, in
fact, you probably don't actually touch CopyOnWriteArrayList, for example.
 And, to your problem, the server runtime may have List types that the
client didn't know about to generate code for, or list types that GWT just
can't handle (but it could handle many others, and doesn't know which
concrete types you might see).

Since GWT can't prove there *is* an error at compile time, it won't whine.
 But, using an interface type in your serialization, there *might* be a
runtime problem, and that's the error message you are seeing.

You might do better to translate the persisted list into a vanilla
ArrayList, and express your RPC in those terms.  Or you might use something
other than RPC as a transport, looking at JSON or RequestFactory as a way
to make the wire protocol lose the detailed Java type and just have a
JavaScript array as the underlying base.


On Tue May 01 14:01:49 GMT-400 2012, nofear  wrote:

> I have a problem with GW and Hibernate,
>
> in my database , I have Sinav(Exam) and Soru(Question) tables and a
> mid-table called sinav_soru(Exam_Question) , when i want to reach the
> exam list from the database using Hibernate the error occurs , please
> help.
>
> Thanks in advance.
>
> Here's the error detail ;
>
> [WARN] Exception while dispatching incoming RPC call
> com.google.gwt.user.client.rpc.SerializationException: Type
> 'org.hibernate.collection.PersistentBag' was not included in the set
> of types which can be serialized by this SerializationPolicy or its
> Class object could not be loaded. For security purposes, this type
> will not be serialized.: instance =
> [tr.edu.gsu.yds.shared.domain.Soru@307262ee] at
> com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:
>
> 619) at
> com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:
>
> 126) at
> com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter
> $ValueWriter$8.write(ServerSerializationStreamWriter.java:153) at
> com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeValue(ServerSerializationStreamWriter.java:
>
> 539) at
> com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeClass(ServerSerializationStreamWriter.java:
>
> 709) at
> com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeImpl(ServerSerializationStreamWriter.java:
>
> 748) at
> com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:
>
> 621) at
> com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:
>
> 126) at
> com.google.gwt.user.client.rpc.core.java.util.Collection_CustomFieldSerializerBase.serialize(Collection_CustomFieldSerializerBase.java:
>
> 44) at
> com.google.gwt.user.client.rpc.core.java.util.ArrayList_CustomFieldSerializer.serialize(ArrayList_CustomFieldSerializer.java:
>
> 39) at
> com.google.gwt.user.client.rpc.core.java.util.ArrayList_CustomFieldSerializer.serializeInstance(ArrayList_CustomFieldSerializer.java:
>
> 51) at
> com.google.gwt.user.client.rpc.core.java.util.ArrayList_CustomFieldSerializer.serializeInstance(ArrayList_CustomFieldSerializer.java:
>
> 28) at
> com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeImpl(ServerSerializationStreamWriter.java:
>
> 740) at
> com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:
>
> 621) at
> com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:
>
>

[gwt-contrib] GWT SerialisationPolicy Error

2012-05-02 Thread nofear
I have a problem with GW and Hibernate,

in my database , I have Sinav(Exam) and Soru(Question) tables and a
mid-table called sinav_soru(Exam_Question) , when i want to reach the
exam list from the database using Hibernate the error occurs , please
help.

Thanks in advance.

Here's the error detail ;

[WARN] Exception while dispatching incoming RPC call
com.google.gwt.user.client.rpc.SerializationException: Type
'org.hibernate.collection.PersistentBag' was not included in the set
of types which can be serialized by this SerializationPolicy or its
Class object could not be loaded. For security purposes, this type
will not be serialized.: instance =
[tr.edu.gsu.yds.shared.domain.Soru@307262ee] at
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:
619) at
com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:
126) at
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter
$ValueWriter$8.write(ServerSerializationStreamWriter.java:153) at
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeValue(ServerSerializationStreamWriter.java:
539) at
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeClass(ServerSerializationStreamWriter.java:
709) at
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeImpl(ServerSerializationStreamWriter.java:
748) at
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:
621) at
com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:
126) at
com.google.gwt.user.client.rpc.core.java.util.Collection_CustomFieldSerializerBase.serialize(Collection_CustomFieldSerializerBase.java:
44) at
com.google.gwt.user.client.rpc.core.java.util.ArrayList_CustomFieldSerializer.serialize(ArrayList_CustomFieldSerializer.java:
39) at
com.google.gwt.user.client.rpc.core.java.util.ArrayList_CustomFieldSerializer.serializeInstance(ArrayList_CustomFieldSerializer.java:
51) at
com.google.gwt.user.client.rpc.core.java.util.ArrayList_CustomFieldSerializer.serializeInstance(ArrayList_CustomFieldSerializer.java:
28) at
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeImpl(ServerSerializationStreamWriter.java:
740) at
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:
621) at
com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:
126) at
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter
$ValueWriter$8.write(ServerSerializationStreamWriter.java:153) at
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeValue(ServerSerializationStreamWriter.java:
539) at com.google.gwt.user.server.rpc.RPC.encodeResponse(RPC.java:
616) at
com.google.gwt.user.server.rpc.RPC.encodeResponseForSuccess(RPC.java:
474) at
com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:
571) at
com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:
208) at
com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:
248) at
com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:
62) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:
362) at
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:
216) at
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:
181) at
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:
729) at
org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
152) at
org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:
49) at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
152) at org.mortbay.jetty.Server.handle(Server.java:324) at
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:
505) at org.mortbay.jetty.HttpConnection
$RequestHandler.content(HttpConnection.java:843) at
org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647) at
org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211) at
org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380) at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:
395) at org.mortbay.thread.QueuedThreadPool
$PoolThread.run(QueuedThreadPool.java:488)

I really could'n fix the problem.

here's my domain code ;



Sinav.java (Exam)

package tr.edu.gsu.yds.shared.domain;

import java.io.Seri