Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    GWT-RPC Broken because of LogicalDate

    Hi,
    We are using simple DTO between SmartGWT and our controller, when i have a java.util.Date in my DTO the RPC fail with a

    java.lang.ClassNotFoundException: com.smartgwt.client.util.LogicalDate

    Even if i'm not using LogicalDate anywhere in my code. Version 3.1p of feb 18 2013

    i changed my Date for a Long and the error disappeared.

    All compilation caches were cleaned, the error is in dev mode and compiled mode. I didn't try removing LogicalDate_CustomFieldSerializer

    Code:
    com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException: java.lang.ClassNotFoundException: com.smartgwt.client.util.LogicalDate
    	at com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException_FieldSerializer.instantiate(IncompatibleRemoteServiceException_FieldSerializer.java:16)
    	at com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException_FieldSerializer.create(IncompatibleRemoteServiceException_FieldSerializer.java:25)
    	at com.google.gwt.user.client.rpc.impl.SerializerBase.instantiate(SerializerBase.java:115)
    	at com.google.gwt.user.client.rpc.impl.ClientSerializationStreamReader.deserialize(ClientSerializationStreamReader.java:111)
    	at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamReader.readObject(AbstractSerializationStreamReader.java:119)
    	at com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceived(RequestCallbackAdapter.java:216)
    	at com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:287)
    	at com.google.gwt.http.client.RequestBuilder$1.onReadyStateChange(RequestBuilder.java:395)
    	at sun.reflect.GeneratedMethodAccessor98.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.lang.reflect.Method.invoke(Method.java:601)
    	at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    	at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    	at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
    	at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:337)
    	at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218)
    	at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
    	at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
    	at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
    	at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
    	at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
    	at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:213)
    	at sun.reflect.GeneratedMethodAccessor84.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.lang.reflect.Method.invoke(Method.java:601)
    	at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    	at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    	at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
    	at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:292)
    	at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546)
    	at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
    	at java.lang.Thread.run(Thread.java:722)
    Code:
    public class ReviewDTO implements IsSerializable {
    
        /** Start date. */
        private Long startDate;
    
        /** End date. */
        private Long endDate;
    ...
    Last edited by kobold27; 18 Feb 2013, 12:57.

    #2
    We've already had confirmation from multiple GWT-RPC users that this issue was resolved. The most likely reason it's happening for you would be something multiple versions of .jars on your class path.

    Comment


      #3
      Originally posted by Isomorphic View Post
      We've already had confirmation from multiple GWT-RPC users that this issue was resolved. The most likely reason it's happening for you would be something multiple versions of .jars on your class path.
      I'm 100% sure that in my project there is only one version of SmartGWT and I still have this issue (even on version 3.1p 2013-02-19).

      I've found that it's related with DateItem. In some cases it's returning value as java.util.Date and in others as LogicalDate.
      Last edited by lennygym; 20 Feb 2013, 05:28.

      Comment


        #4
        DateItem and other components *should* be returning LogicalDate instances, that's correct behavior.

        If you think there's an issue serializing LogicalDate, please show a minimal, ready-to-run test case demonstrating the problem.

        Comment


          #5
          Originally posted by Isomorphic View Post
          DateItem and other components *should* be returning LogicalDate instances, that's correct behavior.
          That's strange because sometimes DateItem is returning java.util.Date.

          I have no dependencies to smartgwt on the server side, so if my RPC service gets LogicalDate then I get serialization exception. In previous versions of SmartGWT it was working just fine, i.e. DTOs Date fields always had java.util.Date instances.
          Last edited by lennygym; 20 Feb 2013, 12:23.

          Comment


            #6
            In different circumstances either Date or LogicalDate are appropriate, depending on whether the DateItem knows that the value it's editing is explicitly a "date" (with no time value).

            Again, we need to see a minimal test case if you want this issue re-examined. It's marked fixed and confirmed by a user.

            Comment


              #7
              Originally posted by Isomorphic View Post
              In different circumstances either Date or LogicalDate are appropriate, depending on whether the DateItem knows that the value it's editing is explicitly a "date" (with no time value).

              Again, we need to see a minimal test case if you want this issue re-examined. It's marked fixed and confirmed by a user.
              Any RPC call using java.util.Date will fail.

              Code:
              import com.google.gwt.user.client.rpc.RemoteService;
              import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
              
              @RemoteServiceRelativePath("servlet/controller/myController")
              public interface MyController extends RemoteService {
                  void setDate(java.util.Date date);
              }
              With Async interface and implementation that does nothing.

              This as been working for the last 2 years. I cleaned all i could. Fail in dev mode and javascript mode, builded with eclipse and builded with jenkins.

              As a workaround, im using Long instead of Date.

              Comment


                #8
                You may have forgotten to add SmartGWT.jar to the *server* classpath. It needs to be there for LogicalDate and the custom serializer to be found during server-side message decode.

                Comment


                  #9
                  Originally posted by Isomorphic View Post
                  You may have forgotten to add SmartGWT.jar to the *server* classpath. It needs to be there for LogicalDate and the custom serializer to be found during server-side message decode.
                  For last 2 years or so it was not required to add SmartGWT.jar to *server* classpath. Everything was working without *any* Smart dependencies. Can you point me where can I find in the SmartGWT documentation that now this dependency is required?

                  Comment


                    #10
                    And it's still not required, unless you're using GWT-RPC, which is considered a very bad practice (see FAQ). The fact that GWT-RPC forces us to require SmartGWT.jar on the server classpath is just yet another drawback.

                    Comment


                      #11
                      Originally posted by Isomorphic View Post
                      You may have forgotten to add SmartGWT.jar to the *server* classpath. It needs to be there for LogicalDate and the custom serializer to be found during server-side message decode.
                      That solved my problem. Thank you

                      Comment

                      Working...
                      X