Google Appengine Issue with Hibernate

2 views
Skip to first unread message

zdesam via StackOverflow

unread,
Jan 25, 2013, 1:10:55 AM1/25/13
to google-appengin...@googlegroups.com

I have a working Spring Hibernate Application running on Amazon EC2 with MySQL. I am thinking of porting my application to Google App Engine as Google now support MySQL with Google Could SQL.

So configure my existing application to Google App Engine Web Application, then compile the code without any error. I have not changed anything to my existing application and it compiled and also created the required tables and the server started successfully.

However, when running application that access the database via hibernate, I am getting the following error.

org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.JDBCConnectionException: Cannot open connection
at org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:596)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:371)
at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:335)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:105)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy30.findById(Unknown Source)
at com.openentry.catgen.services.impl.WebsiteServiceImpl.getMasterDomain(WebsiteServiceImpl.java:99)

I am using annotations for my entity classes.

Is there anything I need changing for this?



Please DO NOT REPLY directly to this email but go to StackOverflow:
http://stackoverflow.com/questions/14516319/google-appengine-issue-with-hibernate

snow8261 via StackOverflow

unread,
Jan 25, 2013, 1:20:55 AM1/25/13
to google-appengin...@googlegroups.com

I believe it is a connection problem.Either you write database configuration wrong or the connection between the database and application has data loss.



Please DO NOT REPLY directly to this email but go to StackOverflow:
http://stackoverflow.com/questions/14516319/google-appengine-issue-with-hibernate/14516402#14516402

zdesam via StackOverflow

unread,
Jan 25, 2013, 1:30:58 AM1/25/13
to google-appengin...@googlegroups.com

below is my applicationContext.xml

<bean id="dataSource"
    class="org.springframework.jdbc.datasource.DriverManagerDataSource"
    p:driverClassName="${jdbc.driverClassName}" p:url="${jdbc.url}"
    p:username="${jdbc.username}" p:password="${jdbc.password}" />

<bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"
    p:dataSource-ref="dataSource" p:configurationClass="org.hibernate.cfg.AnnotationConfiguration"
    p:packagesToScan="com.package.app.entities">
    <property name="hibernateProperties">
        <props>
            <prop key="hibernate.dialect">${hibernate.dialect}</prop>
            <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
            <prop key="hibernate.format_sql">${hibernate.format_sql}</prop>
            <prop key="hibernate.generate_statistics">${hibernate.generate_statistics}</prop>
            <prop key="hibernate.connection.useUnicode">${hibernate.connection.useUnicode}</prop>
            <prop key="hibernate.connection.characterEncoding">${hibernate.connection.characterEncoding}</prop>
            <prop key="hibernate.connection.charSet">${hibernate.connection.charSet}</prop>
            <prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
        </props>
    </property>

</bean>

<tx:annotation-driven />

<bean id="transactionManager"
    class="org.springframework.orm.hibernate3.HibernateTransactionManager"
    p:sessionFactory-ref="sessionFactory" />

<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
    <constructor-arg>
        <ref bean="sessionFactory" />
    </constructor-arg>
</bean>
Reply all
Reply to author
Forward
0 new messages