当我尝试从服务器检索某些内容时,我收到以下错误。我正在尝试使用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 );
}
这是我可怕的错误:
更新
现在我修复了丢失的类错误。新错误如下
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)
答案 0 :(得分: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 jetty:在WEB-INF / lib目录中是否包含“weka.core.WekaPackageManager”的jar文件?
答案 1 :(得分:1)
我看到对应用引擎的引用和错误:
Caused by: java.security.AccessControlException: access denied (java.io.FilePermission C:\Users\William\wekafiles read)
。
当您启用应用引擎并且不支持文件访问时,我会看到它。