Not having a default constructor would defiantly cause a problem. Why
don't you use java.util.Date? You could also create your own Date
class and just pull the information you need.
Also, I would recommend using GWT's IsSerializable instead of
Serializable, and put all classes passed between the client and server
in the shared package. Although these aren't necessary, I think it
follow the "GWT standards."
Tom
On Aug 1, 8:14 am, bernhard <unger.bernh...@googlemail.com> wrote:
> Hallo all,
>
> I am using GWT 2.0.4 and try to implement a service that handles with
> iCal4J calendar objects.
> (http://wiki.modularity.net.au/ical4j/index.php?title=Main_Page)
> However, when I invoke the RPC service a SerializationException is
> thrown:
>
> com.google.gwt.user.client.rpc.SerializationException: Type
> 'net.fortuna.ical4j.model.DateTime' 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.
>
> I already read the suggestion from article "http://code.google.com/
> intl/de/webtoolkit/articles/using_gwt_with_hibernate.html" and made a
> CalendarDTO object for the transfer.
> (Additionally I read "tons" of post for the SerializationException
> problem, without finding a solution).
>
> Here is my structure of the service:
> ------------------------------------------------------------
> package mydomain.de.client
> /**
> * The client side stub for the RPC service.
> */
> @RemoteServiceRelativePath("calendar")
> public interface CalendarService extends RemoteService {
> public CalendarDTO getCalendarEvent();}
>
> /**
> * The async counterpart of <code>CalendarService</code>.
> */
> public interface CalendarServiceAsync {
> void getCalendarEvent(AsyncCallback<CalendarDTO> callback);}
>
> ---------------------------------------------------------------
> package mydomain.client.dto
> /* The data transfer object used on the client (GWT) side */
> public class CalendarDTO implements Serializable {
> private static final long serialVersionUID = 1L;
> private Date date;
> private String name;
> private String uid;
>
> public CalendarDTO() {};
>
> public CalendarDTO(Date date, String name, String uid) {
> this.date = date;
> this.name = name;
> this.uid = uid;
>
> }
> ...
> setter and getter}
>
> -----------------------------------------------------------------
> package mydomain.domain
> /* The domain class for the calendar */
> public class MyCalendar implements Serializable {
> private static final long serialVersionUID = 9054803484652745548L;
> private Date eventDate;
> private String eventName;
> private String uid;
>
> public MyCalendar() {};
>
> public MyCalendar(CalendarDTO calendarDTO) {
> eventDate = calendarDTO.getDate();
> eventName = calendarDTO.getName();
> uid = calendarDTO.getUid();
> }
> ...
> getter and setter
> ...}
>
> ---------------------------------------------------------------------
> package mydomain.server
> /**
> * The server side implementation of the RPC service.
> */
> //@SuppressWarnings("serial")
> public class CalendarServiceImpl extends RemoteServiceServlet
> implements
> CalendarService {
> private static final long serialVersionUID = -7306504057898287672L;
> .....
> public CalendarDTO getCalendarEvent() {
>
> MyCalendar myCalendar = new MyCalendar();
> setMyCalendar(myCalendar); // Do iCal4J stuff....
> CalendarDTO calendarDTO = new CalendarDTO();
> calendarDTO.setDate(myCalendar.getEventDate());
> calendarDTO.setName(myCalendar.getEventName());
> calendarDTO.setUid(myCalendar.getUid());
> return calendarDTO;
> }
> ....
> ---------------------------------------------------------------------
> For my understanding the server code should be decoupled by the Data
> Transfer Objects "CalendarDTO", but
> the serialization exception is still thrown.
> I already did a look in the implementation class of
> "net.fortuna.ical4j.model.DateTime" one of its superclass ("Iso8601")
> does not have a default constructor.
> Could that be the issue?
> Is there a workaround for this problem available?
>
> Any suggestions are highly appreciated.
>
> Thanks & regards
>
> Bernhard
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
No comments:
Post a Comment