Im having a java web application running in App engine standard environment
with this configuration
<basic-scaling>
<max-instances>25</max-instances>
<idle-timeout>50m</idle-timeout>
</basic-scaling>
and connecting to the Cloud Sql second generation:
vCPUs Memory SSD Storage
2 7.5GB 31GB
and Im using Eclipse link provider with the following versions
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>javax.persistence</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.7.1</version>
<exclusions>
<exclusion>
<groupId>org.eclipse.persistence</groupId>
<artifactId>javax.persistence</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.12</version>
<exclusions>
<exclusion>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
</exclusion>
</exclusions>
</dependency>
I put those exclusions cause it causes conflict with other library im using in the POM.xml
and every thing is just fine, later I upgraded the version of the eclipse link to be 2.7.3 after I've done that and deploy the changes into app engine it works fine but 30 min later it started to throw the below error, I set the version back then that Exception just gone for 2 months, and today when I changed the default_time_zone of the cloud sql sec generation from "+02:00" to "+01:00" then I restarted my DB it works fine for 10 min then started to throw the same exception
Exception details
its thrown for any JPA query Example: "Select u from User u where u.facebookId = :fbid"
[e~p8belel/api:20181121t183222.414147041342026241].<stdout>: [EL Warning]: 2018-11-21 17:10:39.183--UnitOfWork(1650244092)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.7.1.v20171221-bd47e8f): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Column Index out of range, 2 > 1.
Error Code: 0
Call: SELECT ID, about_me, account_note, account_status, birth_date, body_type, created_time, EMAIL, facebook_access_token_expry, facebook_access_token, facebook_id, game_balance, game_last_time_play, gender, hashed_password, HEIGHT, IP, job_details, last_activity_date, LIKABILITY, NAME, phone_number, signedup_device_id, signup_token, un_serious_count, class, subscription_plan, CITY_ID, marital_status_id, NEIGHBORHOOD_ID, RELIGION_ID, collage_id, job_id, my_match_id, setting_id, univ_id FROM user_table WHERE (facebook_id = ?)
bind => [1 parameter bound]
Query: ReadAllQuery(name="User.getUserByFbId" referenceClass=User sql="SELECT ID, about_me, account_note, account_status, birth_date, body_type, created_time, EMAIL, facebook_access_token_expry, facebook_access_token, facebook_id, game_balance, game_last_time_play, gender, hashed_password, HEIGHT, IP, job_details, last_activity_date, LIKABILITY, NAME, phone_number, signedup_device_id, signup_token, un_serious_count, class, subscription_plan, CITY_ID, marital_status_id, NEIGHBORHOOD_ID, RELIGION_ID, collage_id, job_id, my_match_id, setting_id, univ_id FROM user_table WHERE (facebook_id = ?)")
The User class is
public class User {
@Id
String id;
@Column(nullable = false)
String name;
@Column(unique = true)
String email;
@Column(name="phone_number",unique = true)
@Convert(converter = EncryptorConverter.class)
String phoneNumber;
@Column(name="hashed_password")
String hashedPassword;
@Column(name="signedup_device_id", unique=true)
String signedUpDeviceId;
@Column(name="signup_token")
String signupToken;
@OneToOne(mappedBy = "user")
private VerificationId verificationId;
@OneToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "setting_id")
AccountSetting setting = new AccountSetting();
@Temporal(TemporalType.DATE)
@Column(name = "birth_date")
Date birthDate;
@ManyToOne
@JoinColumn(name="marital_status_id")
MaritalStatus maritalStatus;
@Enumerated(EnumType.STRING)
@Column(name = "account_status")
AccountStatus accountStatus;
@OneToMany(mappedBy = "user")
List<Device> devices;
@Deprecated
@ManyToOne
City city;
@ManyToOne
Neighborhood neighborhood;
Integer height;
@Column(name="body_type")
@Enumerated(EnumType.STRING)
BodyType bodyType;
@Column(name="game_balance")
Integer gameBalance = 0;
@ManyToOne
Religion religion;
@JoinColumn(name = "my_match_id")
User myMatch;
Integer likability;
@Column(name="un_serious_count")
Integer unSeriousCount;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "game_last_time_play")
Date gameLastPlay;
@Lob
@Column(name = "job_details")
@Convert(converter = EncryptorConverter.class)
String jobDetails;
@JoinColumn(name = "job_id")
Job job;
@JoinColumn(name = "univ_id")
University university;
@JoinColumn(name = "collage_id")
Collage collage;
@Lob
@Column(name = "about_me")
@Convert(converter = EncryptorConverter.class)
String aboutMe;
@Lob
@Column(name = "account_note")
@Convert(converter = EncryptorConverter.class)
String accountNote;
@Lob
@Convert(converter = EncryptorConverter.class)
@Column(name = "facebook_access_token", length = 700)
String facebookAccessToken;
@Column(name = "facebook_access_token_expry")
@Temporal(TemporalType.DATE)
Date faceBookTokenExpry;
@Column(name = "facebook_id", unique = true)
String facebookId;
@Column(name = "gender")
@Enumerated(EnumType.STRING)
Gender gender;
@Column(name = "class")
@Enumerated(EnumType.STRING)
UserClass userClass;
@OneToMany(mappedBy = "user")
@OrderBy("pictureOrder")
List<Picture> pictures = new ArrayList<Picture>();
@OneToMany(mappedBy = "user")
List<UserAnswer> answers;
@OneToMany(mappedBy = "user", orphanRemoval = true)
List<WorkHistory> work = new ArrayList<>();
@OneToMany(mappedBy = "user", orphanRemoval = true)
List<EducationHistory> education = new ArrayList<>();
@Column(name = "last_activity_date")
@Temporal(TemporalType.DATE)
Date lastActivityDate = new Date();
@Enumerated(EnumType.STRING)
@Column(name="subscription_plan")
SubscriptionPlan userPlan = SubscriptionPlan.FREEMIUM;
// getters and setters
}
Im really sorry for such a huge post, but Im really running out of ideas why this exception is happening
I fixed it, it seems like eclipse link starting from version 2.7.1 having that issue with MYSQL DB and its not stable, I just downgraded it to 2.7.0 and now its working just fine