Application does not access database when hosted

0

I have a hosting for testing, but I can not access the database.

persistece.xlm:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1"
xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence">

<persistence-unit name="person_pu" transaction-type="RESOURCE_LOCAL">
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
    <properties>
        <property name="hibernate.dialect" 
            value="org.hibernate.dialect.MySQL5InnoDBDialect"/>

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

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

        <property name="javax.persistence.jdbc.driver" 
            value="com.mysql.jdbc.Driver"/> 

        <property name="javax.persistence.jdbc.user" 
            value="xxx"/>

        <property name="javax.persistence.jdbc.password" 
            value="xxx"/>

        <property name="javax.persistence.jdbc.url" 
            value="jdbc:mysql://meubanco.mysql.uhserver.com"/>
    </properties>

</persistence-unit>

On my machine it works normal with this difference:

<property name="javax.persistence.jdbc.url" 
            value="jdbc:mysql://person-db.mysql.uhserver.com"/>

But when I upload to the server I get the following error:

2015-11-19 09:53:18,619 [main] INFO  org.apache.catalina.startup.VersionLoggerListener- Server version:        Apache Tomcat/8.0.20
2015-11-19 09:53:18,620 [main] INFO  org.apache.catalina.startup.VersionLoggerListener- Server built:          Feb 15 2015 18:10:42 UTC
2015-11-19 09:53:18,620 [main] INFO  org.apache.catalina.startup.VersionLoggerListener- Server number:         8.0.20.0
2015-11-19 09:53:18,620 [main] INFO  org.apache.catalina.startup.VersionLoggerListener- OS Name:               Linux
2015-11-19 09:53:18,620 [main] INFO  org.apache.catalina.startup.VersionLoggerListener- OS Version:            3.18.3-1.el6.elrepo.x86_64
2015-11-19 09:53:18,620 [main] INFO  org.apache.catalina.startup.VersionLoggerListener- Architecture:          amd64
2015-11-19 09:53:18,620 [main] INFO  org.apache.catalina.startup.VersionLoggerListener- Java Home:             /usr/java/jdk8/jre
2015-11-19 09:53:18,620 [main] INFO  org.apache.catalina.startup.VersionLoggerListener- JVM Version:           1.8.0_11-b12
2015-11-19 09:53:18,620 [main] INFO  org.apache.catalina.startup.VersionLoggerListener- JVM Vendor:            Oracle Corporation
2015-11-19 09:53:18,620 [main] INFO  org.apache.catalina.startup.VersionLoggerListener- CATALINA_BASE:         /opt/tomcat8
2015-11-19 09:53:18,620 [main] INFO  org.apache.catalina.startup.VersionLoggerListener- CATALINA_HOME:         /opt/tomcat8
2015-11-19 09:53:18,621 [main] INFO  org.apache.catalina.startup.VersionLoggerListener- Command line argument: -Dnop
2015-11-19 09:53:18,621 [main] INFO  org.apache.catalina.startup.VersionLoggerListener- Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
2015-11-19 09:53:18,621 [main] INFO  org.apache.catalina.startup.VersionLoggerListener- Command line argument: -XX:+DisableExplicitGC
2015-11-19 09:53:18,621 [main] INFO  org.apache.catalina.startup.VersionLoggerListener- Command line argument: -Xms51m
2015-11-19 09:53:18,621 [main] INFO  org.apache.catalina.startup.VersionLoggerListener- Command line argument: -Xmx204m
2015-11-19 09:53:18,621 [main] INFO  org.apache.catalina.startup.VersionLoggerListener- Command line argument: -Duser.timezone=America/Sao_Paulo
2015-11-19 09:53:18,621 [main] INFO  org.apache.catalina.startup.VersionLoggerListener- Command line argument: -verbose:gc
2015-11-19 09:53:18,621 [main] INFO  org.apache.catalina.startup.VersionLoggerListener- Command line argument: -XX:+PrintGCTimeStamps
2015-11-19 09:53:18,621 [main] INFO  org.apache.catalina.startup.VersionLoggerListener- Command line argument: -Xloggc://opt/web/logs/loggc
2015-11-19 09:53:18,621 [main] INFO  org.apache.catalina.startup.VersionLoggerListener- Command line argument: -Djava.io.tmpdir=/opt/web/temp
2015-11-19 09:53:18,621 [main] INFO  org.apache.catalina.startup.VersionLoggerListener- Command line argument: -XX:+UseGCLogFileRotation
2015-11-19 09:53:18,622 [main] INFO  org.apache.catalina.startup.VersionLoggerListener- Command line argument: -XX:NumberOfGCLogFiles=5
2015-11-19 09:53:18,622 [main] INFO  org.apache.catalina.startup.VersionLoggerListener- Command line argument: -XX:GCLogFileSize=5M
2015-11-19 09:53:18,622 [main] INFO  org.apache.catalina.startup.VersionLoggerListener- Command line argument: -XX:MaxMetaspaceSize=34m
2015-11-19 09:53:18,622 [main] INFO  org.apache.catalina.startup.VersionLoggerListener- Command line argument: -XX:MaxDirectMemorySize=17m
2015-11-19 09:53:18,622 [main] INFO  org.apache.catalina.startup.VersionLoggerListener- Command line argument: -Djava.endorsed.dirs=/opt/tomcat8/endorsed
2015-11-19 09:53:18,622 [main] INFO  org.apache.catalina.startup.VersionLoggerListener- Command line argument: -Dcatalina.base=/opt/tomcat8
2015-11-19 09:53:18,622 [main] INFO  org.apache.catalina.startup.VersionLoggerListener- Command line argument: -Dcatalina.home=/opt/tomcat8
2015-11-19 09:53:18,622 [main] INFO  org.apache.catalina.startup.VersionLoggerListener- Command line argument: -Djava.io.tmpdir=/opt/tomcat8/temp
2015-11-19 09:53:18,622 [main] INFO  org.apache.catalina.core.AprLifecycleListener- The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
2015-11-19 09:53:19,305 [main] INFO  org.apache.coyote.http11.Http11NioProtocol- Initializing ProtocolHandler ["http-nio-8080"]
2015-11-19 09:53:19,410 [main] INFO  org.apache.tomcat.util.net.NioSelectorPool- Using a shared selector for servlet write/read
2015-11-19 09:53:19,415 [main] INFO  org.apache.catalina.startup.Catalina- Initialization processed in 2283 ms
2015-11-19 09:53:19,453 [main] INFO  org.apache.catalina.core.StandardService- Starting service Catalina
2015-11-19 09:53:19,454 [main] INFO  org.apache.catalina.core.StandardEngine- Starting Servlet Engine: Apache Tomcat/8.0.20
2015-11-19 09:53:19,561 [localhost-startStop-1] INFO  org.apache.catalina.startup.HostConfig- Deploying web application archive /opt/web/webapps/ROOT.war
2015-11-19 09:53:30,900 [localhost-startStop-1] INFO  org.hibernate.jpa.internal.util.LogHelper- HHH000204: Processing PersistenceUnitInfo [
    name: person_pu
    ...]
2015-11-19 09:53:31,342 [localhost-startStop-1] INFO  org.hibernate.Version- HHH000412: Hibernate Core {4.3.5.Final}
2015-11-19 09:53:31,393 [localhost-startStop-1] INFO  org.hibernate.cfg.Environment- HHH000206: hibernate.properties not found
2015-11-19 09:53:31,396 [localhost-startStop-1] INFO  org.hibernate.cfg.Environment- HHH000021: Bytecode provider name : javassist
2015-11-19 09:53:32,044 [localhost-startStop-1] INFO  org.hibernate.annotations.common.Version- HCANN000001: Hibernate Commons Annotations {4.0.4.Final}
2015-11-19 09:53:32,142 [localhost-startStop-1] WARN  org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl- HHH000402: Using Hibernate built-in connection pool [not for production use!]
2015-11-19 09:53:32,195 [localhost-startStop-1] INFO  org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl- HHH000401: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql://person-db.mysql.uhserver.com]
2015-11-19 09:53:32,196 [localhost-startStop-1] INFO  org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl- HHH000046: Connection properties: {user=adminbnh, password=****}
2015-11-19 09:53:32,196 [localhost-startStop-1] INFO  org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl- HHH000006: Autocommit mode: false
2015-11-19 09:53:32,199 [localhost-startStop-1] INFO  org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl- HHH000115: Hibernate connection pool size: 20 [min=1]
2015-11-19 09:53:34,158 [localhost-startStop-1] INFO  org.hibernate.dialect.Dialect- HHH000400: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect
2015-11-19 09:53:34,433 [localhost-startStop-1] INFO  org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory- HHH000397: Using ASTQueryTranslatorFactory
2015-11-19 09:53:35,198 [localhost-startStop-1] INFO  org.hibernate.tool.hbm2ddl.SchemaUpdate- HHH000228: Running hbm2ddl schema update
2015-11-19 09:53:35,198 [localhost-startStop-1] INFO  org.hibernate.tool.hbm2ddl.SchemaUpdate- HHH000102: Fetching database metadata
2015-11-19 09:53:35,228 [localhost-startStop-1] INFO  org.hibernate.tool.hbm2ddl.SchemaUpdate- HHH000396: Updating schema
2015-11-19 09:53:35,261 [localhost-startStop-1] INFO  java.sql.DatabaseMetaData- HHH000262: Table not found: Contato
2015-11-19 09:53:35,273 [localhost-startStop-1] INFO  java.sql.DatabaseMetaData- HHH000262: Table not found: Contato
2015-11-19 09:53:35,281 [localhost-startStop-1] INFO  java.sql.DatabaseMetaData- HHH000262: Table not found: Contato
2015-11-19 09:53:35,293 [localhost-startStop-1] ERROR org.hibernate.tool.hbm2ddl.SchemaUpdate- HHH000388: Unsuccessful: create table Contato [id bigint not null auto_increment, data date, email varchar[255], mensagem varchar[500], nome varchar[255], primary key [id]] ENGINE=InnoDB
2015-11-19 09:53:35,294 [localhost-startStop-1] ERROR org.hibernate.tool.hbm2ddl.SchemaUpdate- No database selected
2015-11-19 09:53:35,294 [localhost-startStop-1] INFO  org.hibernate.tool.hbm2ddl.SchemaUpdate- HHH000232: Schema update complete
2015-11-19 09:53:36,105 [Catalina-startStop-1] ERROR org.apache.catalina.startup.HostConfig- Error waiting for multi-thread deployment of WAR files to complete
java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Metaspace
    at java.util.concurrent.FutureTask.report[FutureTask.java:122]
    at java.util.concurrent.FutureTask.get[FutureTask.java:192]
    at org.apache.catalina.startup.HostConfig.deployWARs[HostConfig.java:718]
    at org.apache.catalina.startup.HostConfig.deployApps[HostConfig.java:396]
    at org.apache.catalina.startup.HostConfig.start[HostConfig.java:1436]
    at org.apache.catalina.startup.HostConfig.lifecycleEvent[HostConfig.java:282]
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent[LifecycleSupport.java:117]
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent[LifecycleBase.java:90]
    at org.apache.catalina.util.LifecycleBase.setStateInternal[LifecycleBase.java:402]
    at org.apache.catalina.util.LifecycleBase.setState[LifecycleBase.java:347]
    at org.apache.catalina.core.ContainerBase.startInternal[ContainerBase.java:934]
    at org.apache.catalina.core.StandardHost.startInternal[StandardHost.java:871]
    at org.apache.catalina.util.LifecycleBase.start[LifecycleBase.java:150]
    at org.apache.catalina.core.ContainerBase$StartChild.call[ContainerBase.java:1409]
    at org.apache.catalina.core.ContainerBase$StartChild.call[ContainerBase.java:1399]
    at java.util.concurrent.FutureTask.run[FutureTask.java:266]
    at java.util.concurrent.ThreadPoolExecutor.runWorker[ThreadPoolExecutor.java:1142]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run[ThreadPoolExecutor.java:617]
    at java.lang.Thread.run[Thread.java:745]
Caused by: java.lang.OutOfMemoryError: Metaspace
    at java.lang.ClassLoader.defineClass1[Native Method]
    at java.lang.ClassLoader.defineClass[ClassLoader.java:760]
    at java.security.SecureClassLoader.defineClass[SecureClassLoader.java:142]
    at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal[WebappClassLoaderBase.java:2472]
    at org.apache.catalina.loader.WebappClassLoaderBase.findClass[WebappClassLoaderBase.java:854]
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass[WebappClassLoaderBase.java:1274]
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass[WebappClassLoaderBase.java:1157]
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform[EntityManagerFactoryBuilderImpl.java:865]
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform[EntityManagerFactoryBuilderImpl.java:843]
    at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl[ClassLoaderServiceImpl.java:397]
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build[EntityManagerFactoryBuilderImpl.java:842]
    at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory[HibernatePersistenceProvider.java:75]
    at javax.persistence.Persistence.createEntityManagerFactory[Persistence.java:79]
    at javax.persistence.Persistence.createEntityManagerFactory[Persistence.java:54]
    at br.com.robsonalv.filters.JPAFilter.init[JPAFilter.java:23]
    at org.apache.catalina.core.ApplicationFilterConfig.initFilter[ApplicationFilterConfig.java:279]
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter[ApplicationFilterConfig.java:260]
    at org.apache.catalina.core.ApplicationFilterConfig.[ApplicationFilterConfig.java:105]
    at org.apache.catalina.core.StandardContext.filterStart[StandardContext.java:4573]
    at org.apache.catalina.core.StandardContext.startInternal[StandardContext.java:5188]
    at org.apache.catalina.util.LifecycleBase.start[LifecycleBase.java:150]
    at org.apache.catalina.core.ContainerBase.addChildInternal[ContainerBase.java:725]
    at org.apache.catalina.core.ContainerBase.addChild[ContainerBase.java:701]
    at org.apache.catalina.core.StandardHost.addChild[StandardHost.java:717]
    at org.apache.catalina.startup.HostConfig.deployWAR[HostConfig.java:917]
    at org.apache.catalina.startup.HostConfig$DeployWar.run[HostConfig.java:1701]
    at java.util.concurrent.Executors$RunnableAdapter.call[Executors.java:511]
    ... 4 more
2015-11-19 09:53:36,153 [main] INFO  org.apache.coyote.http11.Http11NioProtocol- Starting ProtocolHandler ["http-nio-8080"]
2015-11-19 09:53:36,157 [main] INFO  org.apache.catalina.startup.Catalina- Server startup in 16741 ms
2015-11-19 09:53:36,995 [http-nio-8080-Acceptor-0] ERROR org.apache.tomcat.util.net.NioEndpoint- 
java.lang.OutOfMemoryError: Metaspace
    at sun.nio.ch.ServerSocketChannelImpl.accept[ServerSocketChannelImpl.java:257]
    at org.apache.tomcat.util.net.NioEndpoint$Acceptor.run[NioEndpoint.java:688]
    at java.lang.Thread.run[Thread.java:745]
    
asked by anonymous 19.11.2015 / 13:46

0 answers