0

我在让全文搜索在 GAE 生产环境中工作时遇到问题。它在我的开发机器上运行良好,但是当我将它部署到生产环境时,我收到了这个错误:

com.google.apphosting.api.ApiProxy$CallNotFoundException: The API package 'search' or call 'IndexDocument()' was not found.

这看起来是一个运行时问题,它找不到正确的类,但我在 WEB-INF/lib 中包含了 appengine-api-1.0-sdk-1.7.0.jar,所以我假设在部署到 prod 时,它将使用该版本的 GAE。我是否遗漏了有关 GAE 如何将库部署到产品的信息?GAE SDK 1.7 现在应该可以在生产中使用了吧?

这些是我的进口:

  import com.google.appengine.api.datastore.Entity;
import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.search.Document;
import com.google.appengine.api.search.Field;
import com.google.appengine.api.search.GeoPoint;
import com.google.appengine.api.search.Index;
import com.google.appengine.api.search.IndexSpec;
import com.google.appengine.api.search.SearchServiceFactory;

//my instantiation
private static final Index INDEX = SearchServiceFactory.getSearchService()
              .getIndex(IndexSpec.newBuilder().setName("shared_index"));

它似乎使用的是 1.7.0 版。这是我正在使用的版本的日志记录以及紧随其后的错误堆栈跟踪:

E 2012-08-07 19:30:37.352

version: Google App Engine/1.7.0

W 2012-08-07 19:30:37.702

com.google.apphosting.api.ApiProxy$CallNotFoundException: The API package 'search' or call 'IndexDocument()' was not found.
    at com.google.net.rpc3.client.RpcStub$RpcCallbackDispatcher$1.runInContext(RpcStub.java:782)
    at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:455)
    at com.google.tracing.TraceContext.runInContext(TraceContext.java:695)
    at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:333)
    at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:325)
    at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:453)
    at com.google.net.rpc3.client.RpcStub$RpcCallbackDispatcher.rpcFinished(RpcStub.java:824)
    at com.google.net.rpc3.client.RpcStub$RpcCallbackDispatcher.success(RpcStub.java:809)
    at com.google.net.rpc3.impl.client.RpcClientInternalContext.runCallbacks(RpcClientInternalContext.java:893)
    at com.google.net.rpc3.impl.client.RpcClientInternalContext.finishRpcAndNotifyApp(RpcClientInternalContext.java:798)
    at com.google.net.rpc3.impl.client.RpcNetChannel.afterFinishingActiveRpc(RpcNetChannel.java:1059)
    at com.google.net.rpc3.impl.client.RpcNetChannel.finishRpc(RpcNetChannel.java:907)
    at com.google.net.rpc3.impl.client.RpcNetChannel.handleResponse(RpcNetChannel.java:2255)
    at com.google.net.rpc3.impl.client.RpcNetChannel.messageReceived(RpcNetChannel.java:2062)
    at com.google.net.rpc3.impl.client.RpcNetChannel.access$2000(RpcNetChannel.java:143)
    at com.google.net.rpc3.impl.client.RpcNetChannel$TransportCallback.receivedMessage(RpcNetChannel.java:3117)
    at com.google.net.rpc3.impl.client.RpcChannelTransportData$TransportCallback.receivedMessage(RpcChannelTransportData.java:599)
    at com.google.net.rpc3.impl.wire.RpcBaseTransport.receivedMessage(RpcBaseTransport.java:417)
    at com.google.net.eventmanager.AbstractFutureTask$Sync.innerRun(AbstractFutureTask.java:260)
    at com.google.net.eventmanager.AbstractFutureTask.run(AbstractFutureTask.java:121)
    at com.google.net.eventmanager.EventManagerImpl.runTask(EventManagerImpl.java:578)
    at com.google.net.eventmanager.EventManagerImpl.internalRunWorkerLoop(EventManagerImpl.java:1002)
    at com.google.net.eventmanager.EventManagerImpl.runWorkerLoop(EventManagerImpl.java:884)
    at com.google.net.eventmanager.WorkerThreadInfo.runWorkerLoop(WorkerThreadInfo.java:136)
    at com.google.net.eventmanager.EventManagerImpl$WorkerThread.run(EventManagerImpl.java:1855)
4

1 回答 1

1

我不确定在 WEB-INF/lib 中包含 appengine-api-1.0-sdk-1.7.0.jar 是否会将其部署为该版本。

如果你使用过eclipse,你是否从preferences-->google-->appengine中选择了1.7 sdk

另外,你是如何部署的?如果您使用命令行,请确保使用 /1.7sdk/bin/appcfg 文件进行上传。如果您使用的是 eclipse,请按上述方式设置首选项。

上面的就不用说了...

我认为你需要建立你的 IndexSpec

private static final Index INDEX = SearchServiceFactory.getSearchService()
              .getIndex(IndexSpec.newBuilder().setName("shared_index").build());
于 2012-08-07T23:26:52.167 回答