Skip to first unread message


Nov 30, 2011, 11:51:49 AM11/30/11

I have got some Question concerning Serialization and persistence.
At First I have got a GWT project with Client code and a Servlet to communicate with
my EJB Project.
In the EJB project there are some Persistent Entitie Classes with references among each other and beans to manage them.
The Reference may look like this:
             Object A
              /        \
  Object B     Object C
                          Object D
Mostly there are 1:n Relationships, which i have to modelling with oneToMany or something like this..
I store them into a MYSQL Database which already work with Strings.
With Strings I haven't got Problems to transfer them from the GWT Client Side over the GWt Servlet to the EJB Bean and then into the Database and the same way back to the Client Side.
But when I try to transfer an own created Class object (POJO?) between GWT Client and EJB, I always get an Serialization Exception. 
Is it because of the GWT Servlet? I read something that you have to use DTo or Value Objects? Is this correct?
or isn't there a easy way to solve this?


Nov 30, 2011, 12:24:14 PM11/30/11
If you use GWT-RPC every class that goes over the wire has to implement Serializable and must have a default constructor. Depending on your setup it can occur that the RemoteServiceServlet from GWT does not find the serialization policy file. So you should check your server logs to see if there are any serialization warnings.

Also if you are using an external server for GWT during development make sure that you first start dev mode and access your app. Then, when you got a SerializationException, redeploy your app to your external server and try it again. This ensures that your server always has the up-to-date version of the serialization policy file.

When I encounter SerializationExceptions I mostly forgot to add a default constructor to my classes. So check this first! ;-)

-- J.


Nov 30, 2011, 2:21:42 PM11/30/11
Thank you for your answer.

I use glassfish app server for my project, maybe there is something wrong?

To clarify my project structur:

Entities + SessionBean:

GWT Servlet:

I have got a GWT Client Side where I temporally want to use POJOs from the EJB Project.
Then there is a GWT Servlet, which is there to communicate with my EJB Project.
At least I have got a EJB Project with my Session Beans for managing the Persistence Entities,
which should be able to be transferd to GWT Client Side. 
When I want to test if I could persist this little example, I got the following Exception:

Seems like I couldn`t use Transactionmanagement..
And how can I tell my GWT Project which Persistence Entities I have?


Nov 30, 2011, 4:02:17 PM11/30/11
Ok, I have got the reason for the exception.
I have got (cascade={CascadeType.PERSIST}) forgotten.

But how could I transfer for example the company object to my GWT Client Side?

Reply all
Reply to author
0 new messages