Kirill
Kirill

Reputation: 6036

Spring Cloud Netflix Zuul. SQLSyntaxErrorException: Table 'rate' doesn't exist

I am trying to configure rate limiting in my Spring Cloud Netflix Zuul using JPA repository. However at the start I receive this Exception:

java.sql.SQLSyntaxErrorException: Table 'kirillbq_bl_acc.rate' doesn't exist

My application.yaml:

zuul:
  routes:
    my-service:
      path: /
  ratelimit:
    enabled: true
    repository: JPA
    policy-list:
      my-service:
        - limit: 2
          refresh-interval: 60
          type:
            - origin
  strip-prefix: true

I have a spring-boot-starter-data-jpa dependency in a project also.

I assume that Zuul needs a 'Rate' table to store an information about requests however I can not find any information about the structure of such table. What it should be?

Upvotes: 0

Views: 288

Answers (1)

Kirill
Kirill

Reputation: 6036

I have found this information: https://www.programcreek.com/java-api-examples/?code=marcosbarbero/spring-cloud-zuul-ratelimit/spring-cloud-zuul-ratelimit-master/spring-cloud-zuul-ratelimit-core/src/main/java/com/marcosbarbero/cloud/autoconfigure/zuul/ratelimit/RateLimitAutoConfiguration.java#

There is Rate.java class in config folder with a structure of 'Rate' table:

@Entity
public class Rate {

    @Id
    private String key;
    private Long remaining;
    private Long remainingQuota;
    private Long reset;
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "dd-MM-yyyy HH:mm:ss")
    private Date expiration;

    // constructor, getters and setters 
}

After this table was created all works fine. Zuul saves information about requests in this table.

Upvotes: 0

Related Questions