com.google.gwt.user.client.rpc.SerializationException: Could not get type signature for class Line (when Save)

2,041 views
Skip to first unread message

Jorge Luis Pérez Medina

unread,
Jul 29, 2014, 4:12:30 AM7/29/14
to objectify...@googlegroups.com

The example is realized with Objectify 5.0.3. The case is produced when i trying save instances of Project. I obtain the error: "Could not get type signature for class Line"

Here the StackTrace and the Code of entities used, also the code that save the Project with the service used.

The StackTrace:

objc[6458]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home/bin/java and /Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined.
Initializing App Engine server
juil
. 29, 2014 9:33:59 AM com.google.apphosting.utils.config.AppEngineWebXmlReader readAppEngineWebXml
INFOS
: Successfully processed /Users/jperezmedina/Documents/workspace/TestCase/war/WEB-INF/appengine-web.xml
juil
. 29, 2014 9:33:59 AM com.google.apphosting.utils.config.AbstractConfigXmlReader readConfigXml
INFOS
: Successfully processed /Users/jperezmedina/Documents/workspace/TestCase/war/WEB-INF/web.xml
juil
. 29, 2014 9:33:59 AM com.google.appengine.tools.development.SystemPropertiesManager setSystemProperties
INFOS
: Overwriting system property key 'java.util.logging.config.file', value '/Applications/eclipse/appengine-java-sdk-1.9.6/config/sdk/logging.properties' with value 'WEB-INF/logging.properties' from '/Users/jperezmedina/Documents/workspace/TestCase/war/WEB-INF/appengine-web.xml'
juil
. 29, 2014 9:33:59 AM com.google.apphosting.utils.jetty.JettyLogger info
INFOS
: Logging to JettyLogger(null) via com.google.apphosting.utils.jetty.JettyLogger
juil
. 29, 2014 9:34:06 AM com.google.apphosting.utils.jetty.JettyLogger info
INFOS
: jetty-6.1.x
juil
. 29, 2014 9:34:14 AM com.google.apphosting.utils.jetty.JettyLogger info
INFOS
: Started SelectChannelConnector@0.0.0.0:8888
juil
. 29, 2014 9:34:14 AM com.google.appengine.tools.development.AbstractModule startup
INFOS
: Module instance default is running at http://localhost:8888/
juil
. 29, 2014 9:34:14 AM com.google.appengine.tools.development.AbstractModule startup
INFOS
: The admin console is running at http://localhost:8888/_ah/admin
juil
. 29, 2014 9:34:14 AM com.google.appengine.tools.development.DevAppServerImpl doStart
INFOS
: Dev App Server is now running
com
.google.gwt.user.client.rpc.SerializationException: could not get type signature for class be.example.shared.model.Line
    at com
.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:125)
    at com
.google.gwt.user.client.rpc.core.java.util.Map_CustomFieldSerializerBase.serialize(Map_CustomFieldSerializerBase.java:53)
    at com
.google.gwt.user.client.rpc.core.java.util.HashMap_CustomFieldSerializer.serialize(HashMap_CustomFieldSerializer.java:39)
    at com
.google.gwt.user.client.rpc.core.java.util.HashMap_FieldSerializer.serial(HashMap_FieldSerializer.java:23)
    at com
.google.gwt.user.client.rpc.impl.SerializerBase.serialize(SerializerBase.java:126)
    at com
.google.gwt.user.client.rpc.impl.ClientSerializationStreamWriter.serialize(ClientSerializationStreamWriter.java:183)
    at com
.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:130)
    at be
.example.shared.model.Session_FieldSerializer.serialize(Session_FieldSerializer.java:112)
    at be
.example.shared.model.Session_FieldSerializer.serial(Session_FieldSerializer.java:132)
    at com
.google.gwt.user.client.rpc.impl.SerializerBase.serialize(SerializerBase.java:126)
    at com
.google.gwt.user.client.rpc.impl.ClientSerializationStreamWriter.serialize(ClientSerializationStreamWriter.java:183)
    at com
.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:130)
    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_FieldSerializer.serial(ArrayList_FieldSerializer.java:23)
    at com
.google.gwt.user.client.rpc.impl.SerializerBase.serialize(SerializerBase.java:126)
    at com
.google.gwt.user.client.rpc.impl.ClientSerializationStreamWriter.serialize(ClientSerializationStreamWriter.java:183)
    at com
.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:130)
    at be
.example.shared.model.Project_FieldSerializer.serialize(Project_FieldSerializer.java:51)
    at be
.example.shared.model.Project_FieldSerializer.serial(Project_FieldSerializer.java:66)
    at com
.google.gwt.user.client.rpc.impl.SerializerBase.serialize(SerializerBase.java:126)
    at com
.google.gwt.user.client.rpc.impl.ClientSerializationStreamWriter.serialize(ClientSerializationStreamWriter.java:183)
    at com
.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:130)
    at be
.example.client.TestCaseService_Proxy.saveProject(TestCaseService_Proxy.java:123)
    at be
.example.client.TestCase.onModuleLoad(TestCase.java:46)
    at sun
.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun
.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun
.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java
.lang.reflect.Method.invoke(Method.java:606)
    at com
.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:411)
    at com
.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:200)
    at com
.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:526)
    at com
.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
    at java
.lang.Thread.run(Thread.java:745)


The entities:

@SuppressWarnings("serial")
@Entity
public class Project extends GenericEntity implements IsSerializable {
 
@Index
 
private String name;
 
private User user;

 
@Serialize
 
private List<Session> sessions = new ArrayList<Session>();
 
...


@SuppressWarnings("serial")
@Entity
public class Session extends GenericEntity implements IsSerializable {
 
private int rows;
 
private int cols;
 
private User user;
 
private Date date;
 
private String name;
 
@Serialize
 
private Vector<Line> transectsH = new Vector<Line>();
 
@Serialize
 
private Vector<Line> transectsV = new Vector<Line>();
 
@Serialize
 
private HashMap<Point, Line> mapperHorizontalLines = new HashMap<Point, Line>();
 
@Serialize
 
private HashMap<Point, Line> mapperVerticalLines = new HashMap<Point, Line>();
 
...


@SuppressWarnings("serial")
@Entity
public class Line extends GenericEntity implements IsSerializable {
 
private Image image;
 
private Object data;
 
private Point coordinate;
 
private boolean selected;
 
...


@SuppressWarnings("serial")
@Entity
public class Point extends GenericEntity implements IsSerializable {
 
private double x;
 
private double y;
 
...


@SuppressWarnings("serial")
@Entity
public class User extends GenericEntity implements IsSerializable {
 
@Index
 
private String username;
 
private String email;
 
...


The code that save the class Project:

package be.example.client;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import be.example.shared.model.Line;
import be.example.shared.model.Point;
import be.example.shared.model.Project;
import be.example.shared.model.Session;
import be.example.shared.model.User;

import com.google.gwt.core.client.EntryPoint;

import com.google.gwt.user.client.rpc.AsyncCallback;

public class TestCase implements EntryPoint {

 
private Session session;
 
private User user;
 
private Project project;
 
private List<Session> sessions = new ArrayList<Session>();

 
public void onModuleLoad() {

   
// create the user
    user
= new User();
    user
.setUsername("username");
    user
.setEmail("em...@gmail.com");

   
// create the sessions
    session
= new Session();
    session
.setCols(4);
    session
.setRows(6);
    session
.setUser(user);
    session
.setDate(new Date("07/22/2014"));
    session
.setName("Test 001");

   
// add horizontal lines
    addHorizontalLines
(300, 10);

    sessions
.add(session);

   
// create the project and save it

    project
= new Project("0001LN", user, sessions);

   
Services.getSensportService().saveProject(project, new AsyncCallback<Project>() {

         
@Override
         
public void onFailure(Throwable caught) {
            caught
.printStackTrace(); }

         
@Override
         
public void onSuccess(Project result) {
           
System.out.println(result.getSessions().get(0).toString());
         
}

     
});
   
}

   
private void addHorizontalLines(int height, int padding) {
         
if (session.getRows() != 0) {
           
for (int k = 0; k <= height; k += (height / session.getRows())) {
               
// create the line and add it to the session
               
Line line = new Line();
               line
.setData("HorizontalLine");
               line
.setCoordinate(new Point(padding, 0.5 + k + padding));
               line
.setImage(null);
               session
.addHorizontalLine(line);
           
}
         
}
     
}
}



The method saveProject of service used:

public Project saveProject(Project project) throws IllegalArgumentException {
     
ProjectDAO dao = new ProjectDAO();
     
Key<Project> key = dao.save(project);
     
return dao.findById(key.getId());
 
}


The genericDAO that save and find one Entity:

 public Key<T> save(T clazz) {
     
return ofy().save().entity(clazz).now();
 
}

 
public T findById(Long id) {
     
return ofy().load().type(this.entityClass).id(id).now();
 
}


Jeff Schnitzer

unread,
Jul 29, 2014, 10:10:31 AM7/29/14
to objectify...@googlegroups.com
This is a GWT question - you would probably get better results by asking on the GWT list.

My guess, however, is that you can't serialize and Object type via GWT-RPC.

Jeff


--
You received this message because you are subscribed to the Google Groups "objectify-appengine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to objectify-appen...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages