Domanda

So right, the basics, this is running on GWT2.5.0 / JDK1.6 and set up more or less as the docs have it set up

gwt.xml

<inherits name="com.google.gwt.logging.Logging" />

<set-property name="gwt.logging.simpleRemoteHandler"
    value="ENABLED" />
<set-property name="gwt.logging.logLevel" value="INFO" />
<set-property name="gwt.logging.enabled" value="TRUE" />
<set-property name="gwt.logging.developmentModeHandler"
    value="ENABLED" />
<set-property name="gwt.logging.systemHandler" value="DISABLED" />
<set-property name="gwt.logging.popupHandler" value="DISABLED" />
<set-property name="gwt.logging.consoleHandler" value="ENABLED" />
<set-property name="gwt.logging.firebugHandler" value="ENABLED" />

and I'm forcing the exception with the following code, just a simple NullPointException

     try {
        Level n = null;
        n.getName();
      } catch (NullPointerException ex) {             
        logger.log(Level.SEVERE, "Null Exception Hit", ex);
      }

But for some reason this is thrown when the exception is thrown to the server

[WARN] remoteLogging: An IncompatibleRemoteServiceException was thrown while processing this call.
com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException: Type 'com.google.gwt.core.client.impl.SerializableThrowable' was not assignable to 'com.google.gwt.user.client.rpc.IsSerializable' and did not have a custom field serializer. For security purposes, this type will not be deserialized.
at com.google.gwt.user.server.rpc.RPC.decodeRequest(RPC.java:323)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:206)

The RPC servlet is properly configured and if I throw just the message and not the exception it logs back to the server just fine.

According to the docs on remote server logging this should "just work" and I don't see why this is getting thrown. It seems to me SerializableThrowable should by definition be serializable. I know you have to jump through some hoops to have your own classes be serializable, but everything I've read says I should be able to toss exceptions back to the server without issue. Any ideas? It looks like since 2.5.0 serializableThrowable has been moved to com.google.gwt.core.shared.SerializableThrowable, but I don't think that's doing it.

È stato utile?

Soluzione

Because Exception's super class is Throwable and it Implementing java.io.Serializable

important point to note is that none of the classes that implement java.io.Serializable in the full Java JRE implement java.io.Serializable in GWT's emulated JRE. What this means is that types that implement java.io.Serializable in the JRE like Throwable, or StackTraceElement won't be able to transfer across the wire through GWT RPC since the client won't be able to serialize/deserialize them. However, this isn't an issue for other types like String, Number, etc... that don't implement java.io.Serializable in the emulated JRE but have custom field serializers so that they can be properly serialized.

GWT serialization policy

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top