Dev mode throws MissingResourceException on SerializationStreamFactory.createStreamReader()

153 views
Skip to first unread message

Célio Cidral

unread,
Jun 11, 2014, 5:01:02 PM6/11/14
to google-we...@googlegroups.com
This is what happens when SerializationStreamFactory.createStreamReader() is called in dev mode:

java.util.MissingResourceException: Can't find bundle for base name com.google.gwt.dev.js.rhino.Messages, locale en_US

A quick google search shows that a few other people had this issue before, but none of them got an answer.  Does anyone have an idea of how to work around this?

I'm using GWT 2.6.1 from the central Maven repository.  Here's some code to help reproduce the error:

  SerializationStreamFactory ssf = GWT.create(SignalProcessingService.class);
  SerializationStreamWriter writer = ssf.createStreamWriter();
  writer.writeObject(new Foo("bar"));
  String serializedObject = writer.toString();

  SerializationStreamReader reader = ssf.createStreamReader(serializedObject); //exception is thrown here
  Foo foo = (Foo) reader.readObject();
  GWT.log(foo.toString());
    
  public class Foo implements IsSerializable {
    private String str;

    Foo() {}

    public Foo(String str) {
      this.str = str;
    }
  }

The complete stack trace:

com.google.gwt.user.client.rpc.SerializationException: Failed to parse RPC payload
at com.google.gwt.user.client.rpc.impl.ClientSerializationStreamReader.prepareToRead(ClientSerializationStreamReader.java:322)
at com.google.gwt.user.client.rpc.impl.RemoteServiceProxy.createStreamReader(RemoteServiceProxy.java:259)
at rtsbrasil.portal.ui.client.home.Home$4.execute(Home.java:105)
at rtsbrasil.portal.ui.client.home.Home$4.execute(Home.java:1)
at rtsbrasil.portal.common.client.signal.promise.ReplyPromise$1.f(ReplyPromise.java:23)
at com.google.gwt.query.client.Function.f(Function.java:393)
at com.google.gwt.query.client.plugins.deferred.Callbacks.run(Callbacks.java:158)
at com.google.gwt.query.client.plugins.deferred.Callbacks.fire(Callbacks.java:120)
at com.google.gwt.query.client.plugins.deferred.Deferred.resolve(Deferred.java:363)
at com.google.gwt.query.client.plugins.deferred.PromiseRPC.onSuccess(PromiseRPC.java:44)
at com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceived(RequestCallbackAdapter.java:232)
at com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:259)
at com.google.gwt.http.client.RequestBuilder$1.onReadyStateChange(RequestBuilder.java:412)
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.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:338)
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:576)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:284)
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:356)
at sun.reflect.GeneratedMethodAccessor31.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
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:293)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.util.MissingResourceException: Can't find bundle for base name com.google.gwt.dev.js.rhino.Messages, locale en_US
at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1499)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1322)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:795)
at com.google.gwt.dev.js.rhino.Context.getMessage(Context.java:738)
at com.google.gwt.dev.js.rhino.TokenStream.reportSyntaxError(TokenStream.java:1592)
at com.google.gwt.dev.js.rhino.Parser.reportError(Parser.java:72)
at com.google.gwt.dev.js.rhino.Parser.statementHelper(Parser.java:783)
at com.google.gwt.dev.js.rhino.Parser.statement(Parser.java:360)
at com.google.gwt.dev.js.rhino.Parser.parse(Parser.java:123)
at com.google.gwt.dev.js.JsParser.parseImpl(JsParser.java:131)
at com.google.gwt.dev.js.JsParser.parse(JsParser.java:89)
at com.google.gwt.user.client.rpc.impl.ClientSerializationStreamReader.prepareToRead(ClientSerializationStreamReader.java:313)
at com.google.gwt.user.client.rpc.impl.RemoteServiceProxy.createStreamReader(RemoteServiceProxy.java:259)
at rtsbrasil.portal.ui.client.home.Home$4.execute(Home.java:105)
at rtsbrasil.portal.ui.client.home.Home$4.execute(Home.java:1)
at rtsbrasil.portal.common.client.signal.promise.ReplyPromise$1.f(ReplyPromise.java:23)
at com.google.gwt.query.client.Function.f(Function.java:393)
at com.google.gwt.query.client.plugins.deferred.Callbacks.run(Callbacks.java:158)
at com.google.gwt.query.client.plugins.deferred.Callbacks.fire(Callbacks.java:120)
at com.google.gwt.query.client.plugins.deferred.Deferred.resolve(Deferred.java:363)
at com.google.gwt.query.client.plugins.deferred.PromiseRPC.onSuccess(PromiseRPC.java:44)
at com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceived(RequestCallbackAdapter.java:232)
at com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:259)
at com.google.gwt.http.client.RequestBuilder$1.onReadyStateChange(RequestBuilder.java:412)
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.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:338)
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:576)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:284)
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:356)
at sun.reflect.GeneratedMethodAccessor31.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
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:293)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
at java.lang.Thread.run(Thread.java:744)

Thomas Broyer

unread,
Jun 11, 2014, 7:48:09 PM6/11/14
to google-we...@googlegroups.com


On Wednesday, June 11, 2014 11:01:02 PM UTC+2, Célio Cidral wrote:
This is what happens when SerializationStreamFactory.createStreamReader() is called in dev mode:

java.util.MissingResourceException: Can't find bundle for base name com.google.gwt.dev.js.rhino.Messages, locale en_US

A quick google search shows that a few other people had this issue before, but none of them got an answer.  Does anyone have an idea of how to work around this?

That looks like a bug in DevMode's CompilingClassLoader. BUT:
 
I'm using GWT 2.6.1 from the central Maven repository.  Here's some code to help reproduce the error:

  SerializationStreamFactory ssf = GWT.create(SignalProcessingService.class);
  SerializationStreamWriter writer = ssf.createStreamWriter();
  writer.writeObject(new Foo("bar"));
  String serializedObject = writer.toString();

  SerializationStreamReader reader = ssf.createStreamReader(serializedObject); //exception is thrown here

RPC serialization is not symetric (what the client writes can be read by the server, but not the client; what the server writes can be read by the client, but not the server), so this won't work.
Here, "you" try to interpret as JS (because RPC uses eval()) what definitely is NOT JS, so you're having a syntax error (looking at the stack trace, it's an "invalid label", meaning that it chokes on a ":" char in the payload).

Célio Cidral

unread,
Jun 13, 2014, 8:25:45 AM6/13/14
to google-we...@googlegroups.com
That looks like a bug in DevMode's CompilingClassLoader.

I wonder if someone ever worked around that problem before.

RPC serialization is not symetric (what the client writes can be read by the server, but not the client; what the server writes can be read by the client, but not the server), so this won't work.
Here, "you" try to interpret as JS (because RPC uses eval()) what definitely is NOT JS, so you're having a syntax error (looking at the stack trace, it's an "invalid label", meaning that it chokes on a ":" char in the payload).

I oversimplified that sample code.  What I'm doing exactly is client->server (de)serialization and vice versa.

Célio Cidral

unread,
Jun 13, 2014, 9:58:19 AM6/13/14
to google-we...@googlegroups.com
RPC serialization is not symetric (what the client writes can be read by the server, but not the client; what the server writes can be read by the client, but not the server), so this won't work.
Here, "you" try to interpret as JS (because RPC uses eval()) what definitely is NOT JS, so you're having a syntax error (looking at the stack trace, it's an "invalid label", meaning that it chokes on a ":" char in the payload).

When you mentioned that serialization is asymmetric I checked the stack trace again and realized what I did wrong.  I said that I'm doing client->server serialization and vice versa, but what I did in fact in the server side was taking the string representing the object that was serialized in the client side and replying it "as is" to the client (doh!).  That was my (broken) proof of concept test.  I fixed the code in the server side by serializing the deserialized object with ServerSerializationStreamWriter, and now my proof of concept code works.

The part of the stack trace that helped me realize the problem was this:

at com.google.gwt.dev.js.rhino.TokenStream.reportSyntaxError(TokenStream.java:1592)

The MissingResourceException, though, kind of obscured the real problem.
Reply all
Reply to author
Forward
0 new messages