Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

com2 - it's class which work with com port ( rxtx library ). When I run my site on gwt and press on button run this function and errors:

public String greetServer(String input)  {


    try {
        comm2 COM = new comm2("COM3", "$KE,WR,6,1
");
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return input;



}


  Caused by: java.lang.NoClassDefFoundError: Could not initialize class gnu.io.CommPortIdentifier
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Unknown Source)
        at com.google.appengine.tools.development.agent.runtime.RuntimeHelper.checkRestricted(RuntimeHelper.java:69)
        at com.google.appengine.tools.development.agent.runtime.Runtime.checkRestricted(Runtime.java:64)
        at com.aaa.server.comm2.<init>(comm2.java:17)
        at com.aaa.server.GreetingServiceImpl.greetServer(GreetingServiceImpl.java:18)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at com.google.appengine.tools.development.agent.runtime.Runtime.invoke(Runtime.java:115)
        at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:569)
        ... 34 more

on first run i see in error's

Caused by: java.security.AccessControlException: access denied (java.lang.RuntimePermission loadLibrary.rxtxSerial)
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
244 views
Welcome To Ask or Share your Answers For Others

1 Answer

GWT is primarily a cross compiler that translates Java code to Javascript which runs completely inside the browser. That means you cannot do anything that cannot be done inside a browser like any kind of IO or accessing COM ports

Update 1:


Actually after reviewing your question, it looks like your code is run on the server not the client. Your question confused me. You question should have been about executing the library through gwt rpc on the embedded jetty or whatever.

I can see that your stacktrace lists google app engine, do you intend to run the app on app engine? If yes, then how do you intend to access the hardware? if not, you should remove the app engine dependency and run on the webserver directly.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...