Org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]

2,540 views
Skip to first unread message

BestBuy Holidays

unread,
Oct 24, 2018, 3:53:10 PM10/24/18
to Google App Engine
I am getting this error when I try to connect to google cloud sql from JPA + Hibernate. The configuration is

<?xml version="1.0" encoding="UTF-8"?>

<persistence version="2.0" 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">

<persistence-unit name="ContactUsPU">

<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>

<properties>

<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL57InnoDBDialect" /> 

<property name="hibernate.hbm2ddl.auto" value="none" />

<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver" />

<!-- <property name="hibernate.connection.url" value="jdbc:mysql://localhost/bbholidays" />  -->

<property name="hibernate.connection.url" 

value="jdbc:mysql://google/bbh_database?cloudSqlInstance=bbhwebapp:asia-southeast1:bbh-db&amp;socketFactory=com.google.cloud.sql.mysql.SocketFactory&amp;useSSL=false"/>

<property name="hibernate.connection.username" value="xxxxx" />

<property name="hibernate.connection.password" value="xxxxx" />

<property name="hibernate.archive.autodetection" value="class" />

<property name="hibernate.show_sql" value="true" />

<property name="hibernate.format_sql" value="true" />

<property name="hibernate.use_sql_comments" value="true" />

<property name="hbm2ddl.auto" value="none" />

<property name="hibernate.connection.autocommit" value="true"/>

</properties>

</persistence-unit>

</persistence>


Org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
    1. at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService (AbstractServiceRegistryImpl.java:271)
    2. at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService (AbstractServiceRegistryImpl.java:233)
    3. at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService (AbstractServiceRegistryImpl.java:210)
    4. at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure (JdbcServicesImpl.java:51)
    5. at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService (StandardServiceRegistryImpl.java:94)
    6. at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService (AbstractServiceRegistryImpl.java:242)
    7. at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService (AbstractServiceRegistryImpl.java:210)
    8. at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.handleTypes (MetadataBuildingProcess.java:352)
    9. at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete (MetadataBuildingProcess.java:111)
    10. at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata (EntityManagerFactoryBuilderImpl.java:861)
    11. at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build (EntityManagerFactoryBuilderImpl.java:888)
    12. at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory (HibernatePersistenceProvider.java:58)
    13. at javax.persistence.Persistence.createEntityManagerFactory (Persistence.java:55)
    14. at javax.persistence.Persistence.createEntityManagerFactory (Persistence.java:39)

Edgar (Google Cloud Platform Support)

unread,
Oct 26, 2018, 7:01:45 PM10/26/18
to google-a...@googlegroups.com

I would recommend providing more details about your implementation and providing full errors logs. It will also be useful to know which documentation you used to set up your connection between Cloud SQL and JPA + Hibernate. This github sample provide more details on how to connect to Cloud SQL with Hibernate.


Your issue seems to pertains to a configuration error and you would have better assistance from the community by posting in StackOverflow as Google Groups is intended for general discussion of the App Engine platform, not specific technical issues. You should post to StackOverflow to have the developers community assist you.

Reply all
Reply to author
Forward
0 new messages