Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java DatastoreNeedIndexException:未找到匹配的索引。使用对象化_Java_Google App Engine_Google Cloud Datastore_Objectify - Fatal编程技术网

Java DatastoreNeedIndexException:未找到匹配的索引。使用对象化

Java DatastoreNeedIndexException:未找到匹配的索引。使用对象化,java,google-app-engine,google-cloud-datastore,objectify,Java,Google App Engine,Google Cloud Datastore,Objectify,在使用GoogleAppEngine将代码部署到云端之后,出现了这个错误,我使用objectify索引进行过滤 下面是我的java类(实体)文件,其中包含索引 @Entity public class Session{ @Index private Integer year; @Index private Key<Institute> institute; //some other manipulation goes below } 它在我的控制台上抛出下面的

在使用GoogleAppEngine将代码部署到云端之后,出现了这个错误,我使用objectify索引进行过滤

下面是我的java类(实体)文件,其中包含索引

@Entity
public class Session{
   @Index private Integer year;
   @Index private Key<Institute> institute;
  //some other manipulation goes below
   }
它在我的控制台上抛出下面的错误,下图显示了它,对不起,不太清楚


您需要将建议的索引定义添加到
数据存储index.xml
文件中。如果没有此文件,则需要在/war/WEB-INF/文件夹中创建它:

<?xml version="1.0" encoding="utf-8"?>
<datastore-indexes
  autoGenerate="true">

    <datastore-index kind="Session" ancestor="false" source="manual">
        <property name="institute" direction="asc"/>
        <property name="year" direction="asc"/>
    </datastore-index>
</datastore-indexes>


请注意,当您在开发服务器上测试应用程序时,大多数索引定义都可以自动生成,但有时测试每个可能的用例并不容易,手动定义可能是一个更容易的选择。

我很想看看如何解决同样的问题。谢谢,已经完成了,已经完成了mvn更新,当我检查google云控制台索引时,它没有显示在那里,错误仍然存在,它根本没有显示,或者它说“building”?如果您根本看不到它,则表示您没有部署此文件。查看部署日志。我在objectfy wiki中看到,他们说这需要几天或几小时,取决于系统,因为这是一项低优先级的任务。或者是否有单独的方法来更新索引您应该在上传索引定义后立即查看它。构建可能需要一些时间-您应该在新索引定义旁边看到“building”。没有看到任何建筑,看到了更新索引的命令,
mvn appengine:update\u index
。返回祖先为false的错误
<?xml version="1.0" encoding="utf-8"?>
<datastore-indexes
  autoGenerate="true">

    <datastore-index kind="Session" ancestor="false" source="manual">
        <property name="institute" direction="asc"/>
        <property name="year" direction="asc"/>
    </datastore-index>
</datastore-indexes>