Aerox
Aerox

Reputation: 679

Error in Generating API (Google Cloud Endpoint) with GAE

I created a simple project with GAE and i put in my package 'model' the PMF.java (Persistence Manager Factory Class) and a class (Employee.java) that i can show you here:

    @PersistenceCapable
public class Employee {
    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Key key;

    @Persistent
    private String firstName;

    @Persistent
    private String lastName;

    @Persistent
    private Date hireDate;

    public Employee(String firstName, String lastName, Date hireDate) {
        this.firstName = firstName;
        this.lastName = lastName;
        this.hireDate = hireDate;
    }

    // Accessors for the fields. JDO doesn't use these, but your application does.

    public Key getKey() {
        return key;
    }

    public String getFirstName() {
        return firstName;
    }
    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public Date getHireDate() {
        return hireDate;
    }
    public void setHireDate(Date hireDate) {
        this.hireDate = hireDate;
    }
}

When i click on Google->Generate Cloud Enpoint Client Library, i receive the following error message: Error in Generating API: this project does not have cloud endpoint classes. What does it mean? Thank you so much

Upvotes: 0

Views: 528

Answers (1)

Romin
Romin

Reputation: 8806

You have done the first part i.e. created your model.

When you try to generate the Cloud Endpoint Client Library, the tool is look for Java classes that are annotated with the @API annotation, so that it knows which classes are your endpoints.

What you should try is the following series of steps :

  1. Create a new Project and add your model i.e. Employee
  2. Generate the Endpoint classes for Employee by simply right clicking on the class in the Project and selecting Google -> Generate Cloud Endpoint class. This will generate the Endpoint class EmployeeEndpoint along with PMF. java.
  3. Now, right-click on the project and select Google -> Generate Cloud Endpoint Client Library and you should be good since the tool will find the Endpoint class (EmployeeEndpoint) that has been annotated correctly.

Upvotes: 1

Related Questions