On 4 déc, 06:43, Rohan Redkar <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am completely stumped by this error that  I getting.
> I am using the Random class in the client package and not the native
> Java Random.
>
> import com.google.gwt.user.client.Random;
>
> When I include this line in my code,
>
> int index = Random.nextInt(1000);
>
> I get the following exception in my log. Can anyone please point to my
> fault? I tried to look through the archives but did not find anything
> on this issue. Thanks.
>
> [WARN] StandardContext[]Exception while dispatching incoming RPC call
> com.google.gwt.user.server.rpc.UnexpectedException: Service method
> 'public abstract void edu.nyu.client.SuperplyService.onCreateGame
> (java.lang.String,java.lang.String)' threw an unexpected exception:
> java.lang.UnsatisfiedLinkError:
> com.google.gwt.user.client.Random.nextInt(I)I
>         at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure
> (RPC.java:360)
>         at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse
> (RPC.java:546)
>         at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall
> (RemoteServiceServlet.java:164)
>         at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost
> (RemoteServiceServlet.java:86)

Server-side you have to use Java's Random, not GWT's *client* Random
(which, obviously is for client-side code and defers to JavaScript on
way or another).

The exception you get is because GWT's Random.nextInt is a JSNI
method, i.e. a "native" Java method with some special comment in the
source so that the GWTCompiler knows how to transform it to
JavaScript. Because it is marked "native", a JVM tries to find its
implementation in native libraries, and in this case it doesn't find
any.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to