2012-07-18 117 views
0

當我嘗試從服務器檢索某些內容時,出現以下錯誤。我正在嘗試與GWT的服務器端進行通信。但它整個星期都給了我錯誤。這是最新的一個。我很難理解如何解決。任何幫助,將不勝感激。與服務器端GWT通信

這裏是PredictClientServlet.java

public class PredictClientServlet extends RemoteServiceServlet implements PredictClient 
{ 

    public List<ArrayList<Double>> myMethod(String[] keywords, int numOfPredictions, List<Data> input) 
    { 

    TS ts =new TS(input); 
    // Create the predictor 
    Predictor predictor = new Predictor(); 

    //Set the number of predictions 
    predictor.setNumPredictions(3); 
    try 
    { 
     //Set the data 
     predictor.setTargetData(ts); 

     //Add the filters (now this is not doing any difference) 
     predictor.addFilter("filterA"); 
     predictor.addFilter("filterB"); 
     predictor.predict(); 
    } 
    catch (Exception e) 
    { 

    } 
    List<Predictions> allPredictions = predictor.getPredictions(); 
    List<ArrayList<Double>> ret =new ArrayList<ArrayList<Double>>(); 
    for (Predictions pred: allPredictions) 
    { 
     System.out.printf("Predictor %s %n",pred.getName()); 
     int c = 1; 
     ArrayList<Double> temp =new ArrayList<Double>(); 
     for (Prediction p: pred.getPredictions()) 
     { 
      System.out.printf("\t Prediction: %d Value: %f [%f,%f] %n",c,(p).getValue(),p.getLowConfidence(),p.getHighConfidence()); 
      temp.add(p.getValue()); 
      c++; 
     } 
     ret.add(temp); 
    } 

    return ret; 
} 

這裏是我的PredictClient.java

public class Predict implements EntryPoint 
{ 

@Override 
public void onModuleLoad() 
{ 
    final PredictClientAsync predictService = GWT.create(PredictClient.class); 


    AsyncCallback<List<ArrayList<Double>>> callback =new AsyncCallback<List<ArrayList<Double>>>() 
      { 

     public void onFailure(Throwable caught) 
     { 
      caught.printStackTrace(); 
      System.out.println("Error! " + caught.getCause() );// do some UI stuff to show failure 
     } 

     @Override 
     public void onSuccess(List<ArrayList<Double>> result) 
     { 
      //Global.data = result; 
      Global.c.clear(); 
      Global.c =new Chart(); 
      Global.c.onModuleLoad(); 
     } }; 
     predictService.myMethod(null,3, Global.predata,callback); 

} 

,這裏是我的錯誤,可怕:

UPDATE

現在我固定缺少類錯誤。新的錯誤是以下

Transforming input data... 
Problem instantiating package manager. Using DefaultPackageManager. 
Jul 18, 2012 3:47:14 PM 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.util.List tts.client.PredictClient.myMethod(java.lang.String[],int,java.util.List)'  threw an unexpected exception: java.lang.ExceptionInInitializerError 
at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:385) 
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:588) 
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208) 
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248) 
at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62) 
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) 
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) 
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166) 
at com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:35) 
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) 
at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:60) 
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) 
at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43) 
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) 
at com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:125) 
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) 
at com.google.appengine.tools.development.BackendServersFilter.doFilter(BackendServersFilter.java:97) 
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) 
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388) 
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) 
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) 
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) 
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418) 
at com.google.appengine.tools.development.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:94) 
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) 
at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:370) 
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) 
at org.mortbay.jetty.Server.handle(Server.java:326) 
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) 
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:938) 
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:755) 
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218) 
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) 
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409) 
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582) 
Caused by: java.lang.ExceptionInInitializerError 
at weka.core.Utils.readProperties(Utils.java:142) 
at weka.core.Capabilities.<init>(Capabilities.java:261) 
at weka.filters.Filter.getCapabilities(Filter.java:160) 
at weka.filters.unsupervised.attribute.Add.getCapabilities(Add.java:284) 
at weka.filters.Filter.getCapabilities(Filter.java:193) 
at weka.filters.Filter.testInputFormat(Filter.java:446) 
at weka.filters.Filter.setInputFormat(Filter.java:464) 
at weka.filters.unsupervised.attribute.Add.setInputFormat(Add.java:310) 
at weka.classifiers.timeseries.core.TSLagMaker.createDateTimestampRemap(TSLagMaker.java:1578) 
at weka.classifiers.timeseries.core.TSLagMaker.getTransformedData(TSLagMaker.java:3077) 
at weka.classifiers.timeseries.WekaForecaster.buildForecaster(WekaForecaster.java:1007) 
at tts.server.Predictor.predict(Predictor.java:151) 
at tts.server.PredictClientServlet.myMethod(PredictClientServlet.java:42) 
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.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:569) 
... 34 more 
Caused by: java.security.AccessControlException: access denied (java.io.FilePermission C:\Users\William\wekafiles read) 
at java.security.AccessControlContext.checkPermission(Unknown Source) 
at java.security.AccessController.checkPermission(Unknown Source) 
at java.lang.SecurityManager.checkPermission(Unknown Source) 
at com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkPermission(DevAppServerFactory.java:283) 
at java.lang.SecurityManager.checkRead(Unknown Source) 
at java.io.File.exists(Unknown Source) 
at weka.core.WekaPackageManager.establishWekaHome(WekaPackageManager.java:119) 
at weka.core.WekaPackageManager.<clinit>(WekaPackageManager.java:95) 
... 52 more 

com.google.gwt.user.client.rpc.StatusCodeException: 500 The call failed on the server; see server log for details 
at com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceived(RequestCallbackAdapter.java:209) 
at com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:287) 
at com.google.gwt.http.client.RequestBuilder$1.onReadyStateChange(RequestBuilder.java:395) 
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.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: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.invokeNativeObject(ModuleSpace.java:269) 
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.GeneratedMethodAccessor24.invoke(Unknown Source) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
at java.lang.reflect.Method.invoke(Unknown Source) 
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:292) 
at  com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546) 
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363) 
at java.lang.Thread.run(Unknown Source) 

回答

1

我看到App Engine和錯誤引用:

Caused by: java.security.AccessControlException: access denied (java.io.FilePermission C:\Users\William\wekafiles read)

當您啓用應用程序引擎並且不支持文件訪問時,看起來對我來說。

+0

啊!我也看到了,但我可以使用,而不是GAE,允許文件訪問? – user1527872 2012-07-19 17:58:35

+0

是的!!!我得到它的工作!所有我必須做的是關閉GAE! – user1527872 2012-07-19 18:13:48

+0

我不明白的是爲什麼我們需要GAE? – user1527872 2012-07-19 18:14:52

1

你確實有缺課,看到你的日誌中的ClassNotFoundException:

SEVERE: javax.servlet.ServletContext log: Exception while dispatching incoming RPC call com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract  java.util.List tts.client.PredictClient.myMethod(java.lang.String[],int,java.util.List)' threw an unexpected exception: java.lang.NoClassDefFoundError: Could not initialize class  weka.core.WekaPackageManager 

如果您使用的是標準的GWT碼頭:是指包含「秧雞的jar文件.core.WekaPackageManager「在WEB-INF/lib目錄下?

+0

是的,我剛剛解決了這個問題,但仍然有更多:(。 – user1527872 2012-07-18 22:54:40