简体   繁体   中英

Something other than a Java object was returned from JSNI method

When running the errai-mvp-demo sample application via

mvn gwt:run 

I get this error:

java.lang.IllegalArgumentException: Something other than a Java object was returned from JSNI method '@com.google.gwt.core.client.impl.Impl::apply(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)': JS value of type boolean, expected java.lang.Object at com.google.gwt.dev.shell.JsValueGlue.get(JsValueGlue.java:178) at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:271) 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.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:601) at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) at com.google.gwt.dev.shell.Metho dDispatch.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.invokeNativeBoolean(ModuleSpace.java:184) at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeBoolean(JavaScriptHost.java:35) at org.jboss.errai.common.client.util.LogUtil.isNativeJavaScriptLoggerSupported(LogUtil.java) at org.jboss.errai.common.client.util.LogUtil.log(LogUtil.java:29) at org.jboss.errai.ioc.client.Container.boostrapContainer(Container.java:45) at org.jboss.errai.ioc.client.Container.onModuleLoad(Container.java:34) at sun.reflect.NativeMeth odAccessorImpl.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:601) at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:396) at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:200) at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:525) at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363) at java.lang.Thread.run(Thread.java:722)

I'm assuming you're working with Chrome.This seems to be a common problem with it. I had the same issue and switched to Firefox. I haven't seen the error since.

If you are using Chrome,YES.This issue is with CHROME happens .

According to @Thomos Broyer relative to the same issue on Google groups:

https://groups.google.com/forum/?fromgroups=#!topic/google-web-toolkit/b0KbD8BNsqw

Quick Fix : switch from Chrome to Firefox for Dev Mode

And you can find the same question on Stackoverflow .See answer for that question also .

If you are getting IllegalArgumentException, just make a few changes on client side model or bean.

Just mention package path when you returning the value with his data type.

public native final Boolean apply() /*-{
 return this.apply ? @java.lang.Double::Boolean(D)(this.apply) : null;
 }-*/;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM