2012-06-29 4 views
1

Comment fonctionne le port COM dans GWT.GWT fonctionne avec le port COM

comm.java sa fonction pour l'écriture sur le port com

package com.hell.server; 

import jssc.SerialPort; 
import jssc.SerialPortException; 

public class comm { 



    public String writeHelloString(String portName) { 
     SerialPort serialPort = new SerialPort("COM5"); 

      try { 

       serialPort.openPort(); 

       serialPort.setParams(SerialPort.BAUDRATE_9600, 
            SerialPort.DATABITS_8, 
            SerialPort.STOPBITS_1, 
            SerialPort.PARITY_NONE); 


       serialPort.writeBytes(portName.getBytes()); 
       @SuppressWarnings("unused") 
       byte[] buffer = serialPort.readBytes(10); 

       serialPort.closePort(); 

      } 

      catch (SerialPortException ex) { 
      // System.out.println(ex); 

     } 

       return "dsada"; 
    } 
} 

func du serveur.

public String greetServer(String input) throws IllegalArgumentException { 
     comm A = new comm(); 
     A.writeHelloString("$KE"); 
     return input; 
    } 
Interface

du client GWT au serveur:

@RemoteServiceRelativePath("greet") 
    public interface GreetingService extends RemoteService { 
     String greetServer(String name) throws IllegalArgumentException; 

    } 

Il est correct ??????? !!! ne fonctionne pas et il y a beaucoup d'erreurs ...

erreurs de la console:

Jun 29, 2012 10:21:59 AM com.google.appengine.tools.development.ApiProxyLocalImpl log 
SEVERE: javax.servlet.ServletContext log: Exception while dispatching incoming RPC call 
com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract java.lang.String com.hell.client.GreetingService.greetServer(java.lang.String) throws java.lang.IllegalArgumentException' threw an unexpected exception: java.lang.NoClassDefFoundError: jssc/SerialPortException 
...... 

Caused by: java.lang.NoClassDefFoundError: jssc/SerialPortException 
    at com.hell.server.GreetingServiceImpl.greetServer(GreetingServiceImpl.java:21) 
    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 
Caused by: java.lang.ClassNotFoundException: jssc.SerialPortException 
    at java.net.URLClassLoader$1.run(Unknown Source) 
    at java.security.AccessController.doPrivileged(Native Method) 
    at java.net.URLClassLoader.findClass(Unknown Source) 
    at java.lang.ClassLoader.loadClass(Unknown Source) 
    at com.google.appengine.tools.development.IsolatedAppClassLoader.loadClass(IsolatedAppClassLoader.java:176) 
    at java.lang.ClassLoader.loadClass(Unknown Source) 
    ... 41 more 
+0

veuillez poster ici une liste d'erreurs. On ne sait pas quelle erreur cela pourrait être –

+0

posté en haut! –

Répondre

Questions connexes