So I have noticed that when cloud sql has a maintenance window my app seems to die as the entity manager does not seem to be able to handle the sql restarts and I need to go into appengine and restart the app.
I can also replicate this on my local using mysql and stopping/starting. I am using the normal setup from the instructions in the docs and running inside appengine along with https://github.com/GoogleCloudPlatform/cloud-sql-mysql-socket-factory public class MyModule extends ServletModule { protected void configureServlets() { install(new JpaPersistModule("MyApp")); // like we saw earlier. filter("/*").through(PersistFilter.class); } } persistence.xml looks like <?xml version="1.0" encoding="UTF-8"?> <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" version="2.0"> <!--Define Persistence Unit for the application--> <persistence-unit name="MyApp" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <class>myapp.persistence.sql.entity.TestObject</class> <properties> <property name="javax.persistence.jdbc.url" value="jdbc:mysql://google/myapp?cloudSqlInstance=myapp-instance:us-east1:myapp&socketFactory=com.google.cloud.sql.mysql.SocketFactory" /> <property name="javax.persistence.jdbc.user" value="root" /> <property name="javax.persistence.jdbc.password" value="password" /> <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect" /> <property name="hibernate.show_sql" value="true" /> <property name="hibernate.hbm2ddl.auto" value="update" /> <property name="hibernate.connection.useUnicode" value="true" /> <property name="hibernate.connection.characterEncoding" value="UTF-8" /> <property name="validationQuery" value="SELECT 1" /> <property name="testOnBorrow" value="true" /> </properties> </persistence-unit> </persistence> A few posts said to try using the validationQuery and testOnBorrow but this definately doesnt work, I also tried using c3po settings <property name="hibernate.connection.provider_class" value="org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider" /> <property name="hibernate.c3p0.max_size" value="100" /> <property name="hibernate.c3p0.min_size" value="0" /> <property name="hibernate.c3p0.acquire_increment" value="1" /> <property name="hibernate.c3p0.idle_test_period" value="300" /> <property name="hibernate.c3p0.max_statements" value="0" /> <property name="hibernate.c3p0.timeout" value="100" /> <property name="hibernate.c3p0.preferredTestQuery" value="SELECT 1" /> But when I try to run I get the error java.lang.NoClassDefFoundError: java.lang.management.ManagementFactory is a restricted class. Please see the Google App Engine developer's guide for more details Am I missing something obvious or do I need to something myself to handle the restarts? Any advice appreciated, thanks. -- You received this message because you are subscribed to the Google Groups "google-guice" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/google-guice. To view this discussion on the web visit https://groups.google.com/d/msgid/google-guice/cc18f1eb-ad48-4090-ae6a-6b7045ebb6c7%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
