Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix errors when migrating Appengine app from old Google Plugin into Google Tools.?

3-4 years ago, I built an Appengine app using datastore technique. At that time, we use Google Plugin. My app was perfect, I was able to deploy it without any problems.

Now, I modified it but couldn't deploy it. Someone told me to migrate it to Google tools. Here is the guide link

I used new eclipse (Oxygen) & installed Cloud Tools for Eclipse. Now after converting my old project to App Engine Project. I got some errors:

-1ST ERROR

cvc-complex-type.4: Attribute 'autoGenerate' must appear on element 'datastore-indexes'.

in datastore-indexes-auto.xml file in war\WEBG-INF\appengine-generated

  <!-- Indices written at Fri, 17 Aug 2018 19:43:56 ICT -->

**red mark here**   <datastore-indexes> 
    <!-- Used 1 time in query history -->
    <datastore-index kind="Conversation" ancestor="true" source="auto">
        <property name="LessonType" direction="asc"/>
        <property name="LessonNo" direction="asc"/>
    </datastore-index>

    <!-- Used 1 time in query history -->
    <datastore-index kind="Conversation" ancestor="true" source="auto">
        <property name="LessonType" direction="asc"/>
        <property name="ConversationNo" direction="asc"/>
        <property name="LessonNo" direction="asc"/>
    </datastore-index>

    <!-- Used 1 time in query history -->
    <datastore-index kind="Conversation" ancestor="true" source="auto">
        <property name="ConversationNo" direction="asc"/>
        <property name="LessonNo" direction="asc"/>
        <property name="LessonType" direction="asc"/>
        <property name="OrderNo" direction="asc"/>
    </datastore-index>

</datastore-indexes>

-2nd ERROR

Referenced file contains errors (http://java.sun.com/xml/ns/jdo/jdoconfig). For more information, right click on the message in the Problems View and select "Show Details..."

in jdoconfig.xml file in src/META-INF/

**red mark here** <?xml version="1.0" encoding="utf-8"?> 
**red mark here** <jdoconfig xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
**red mark here**   xsi:noNamespaceSchemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig">

   <persistence-manager-factory name="transactions-optional">
       <property name="javax.jdo.PersistenceManagerFactoryClass"
           value="org.datanucleus.api.jdo.JDOPersistenceManagerFactory"/>
       <property name="javax.jdo.option.ConnectionURL" value="appengine"/>
       <property name="javax.jdo.option.NontransactionalRead" value="true"/>
       <property name="javax.jdo.option.NontransactionalWrite" value="true"/>
       <property name="javax.jdo.option.RetainValues" value="true"/>
       <property name="datanucleus.appengine.autoCreateDatastoreTxns" value="true"/>
       <property name="datanucleus.appengine.singletonPMFForName" value="true"/>
   </persistence-manager-factory>
</jdoconfig>

My project was perfect on old Google Plugin, but why do we got the errors after migration.

How to fix it?

like image 436
Tom Avatar asked Aug 18 '18 11:08

Tom


1 Answers

I fixed it

change <datastore-indexes> to <datastore-indexes autoGenerate="true">

and change

<jdoconfig xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:noNamespaceSchemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig">

to

<jdoconfig xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig http://java.sun.com/xml/ns/jdo/jdoconfig_3_0.xsd">

would fix the problem & I was able to deploy it

like image 129
Tom Avatar answered Sep 22 '22 14:09

Tom