I deployed application on openshift server (tomcat, mysql) but I can't connect with my db (I use phpmyadmin to create db and tables). On my localhost everythings work well. Here is my persistence:
<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="eshopPU" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<class>foo.domain.Catalog</class>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="javax.persistence.jdbc.url" value="mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT/katalog"/>
<property name="javax.persistence.jdbc.password" value="dyfghd"/>
<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/>
<property name="javax.persistence.jdbc.user" value="abyrewef"/>
<property name="eclipselink.ddl-generation" value="create-tables"/>
</properties>
</persistence-unit>
</persistence>
server logs: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'katalogDAO': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: foo.repositories.KatalogRepository foo.repositories.KatalogDAO.katalogRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'katalogRepository': Injection of persistence dependencies failed; nested exception is javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
I don't know what is wrong. Thanks for help.
Ok I solved the issue. In persistance.xml and spring configuration file I inserted the user and password (properties) the same like I had in my db connection on openshift. In url propertie I put :
and works fine (I use tomcat 7 and mysql 5.1, app based on spring 3 and thymeleaf).