0 Replies Latest reply on Nov 1, 2012 8:45 AM by psilos panipsilos

    java.net.NoRouteToHostException: No route to host

    psilos panipsilos Newbie

      Hi guys,

       

      I created a web app that connects to a mySql db. I m using JPA and hibernate for the connection.

       

      However when I m trying to connect to the db I get the following exception:   java.net.NoRouteToHostException: No route to host

       

      The  trace is: ( I also attach the whole log in a file)

       

      2012/10/30 06:28:57,035 INFO  [org.hibernate.validator.util.Version] (MSC service thread 1-3) Hibernate Validator 4.2.0.Final

      2012/10/30 06:28:59,935 INFO  [org.hibernate.tool.hbm2ddl.SchemaUpdate] (MSC service thread 1-3) HHH000228: Running hbm2ddl schema update

      2012/10/30 06:29:00,024 INFO  [org.hibernate.tool.hbm2ddl.SchemaUpdate] (MSC service thread 1-3) HHH000102: Fetching database metadata

      2012/10/30 06:29:01,045 WARN  [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (MSC service thread 1-3) IJ000604: Throwable while attempting to get a new connection: null: javax.resource.ResourceException: Could not create connection

          at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:277)

          at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:235)

          at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.createConnectionEventListener(SemaphoreArrayListManagedConnectionPool.java:758)

          at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.getConnection(SemaphoreArrayListManagedConnectionPool.java:343)

          at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getSimpleConnection(AbstractPool.java:400)

          at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(AbstractPool.java:365)

          at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:329)

          at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:368)

          at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:464)

          at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:129)

          at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:67) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.prepare(SuppliedConnectionProviderConnectionHelper.java:51) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:194) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:178) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:457) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1737) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:84) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:889) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:162) [jboss-as-jpa-7.1.0.Final.jar:7.1.0.Final]

          at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:85) [jboss-as-jpa-7.1.0.Final.jar:7.1.0.Final]

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)

          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_09-icedtea]

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_09-icedtea]

          at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_09-icedtea]

      Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

       

      The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.

          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [rt.jar:1.7.0_09-icedtea]

          at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) [rt.jar:1.7.0_09-icedtea]

          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [rt.jar:1.7.0_09-icedtea]

          at java.lang.reflect.Constructor.newInstance(Constructor.java:525) [rt.jar:1.7.0_09-icedtea]

          at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)

          at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1116)

          at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:344)

          at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2332)

          at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2369)

          at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2153)

          at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:792)

          at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)

          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [rt.jar:1.7.0_09-icedtea]

          at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) [rt.jar:1.7.0_09-icedtea]

          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [rt.jar:1.7.0_09-icedtea]

          at java.lang.reflect.Constructor.newInstance(Constructor.java:525) [rt.jar:1.7.0_09-icedtea]

          at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)

          at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:381)

          at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:305)

          at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:249)

          ... 26 more

      Caused by: java.net.NoRouteToHostException: No route to host

          at java.net.PlainSocketImpl.socketConnect(Native Method) [rt.jar:1.7.0_09-icedtea]

          at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339) [rt.jar:1.7.0_09-icedtea]

          at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200) [rt.jar:1.7.0_09-icedtea]

          at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182) [rt.jar:1.7.0_09-icedtea]

          at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391) [rt.jar:1.7.0_09-icedtea]

          at java.net.Socket.connect(Socket.java:579) [rt.jar:1.7.0_09-icedtea]

          at java.net.Socket.connect(Socket.java:528) [rt.jar:1.7.0_09-icedtea]

          at java.net.Socket.<init>(Socket.java:425) [rt.jar:1.7.0_09-icedtea]

          at java.net.Socket.<init>(Socket.java:241) [rt.jar:1.7.0_09-icedtea]

          at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:257)

          at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:294)

          ... 39 more

       

      2012/10/30 06:29:03,344 ERROR [org.hibernate.tool.hbm2ddl.SchemaUpdate] (MSC service thread 1-3) HHH000319: Could not get database metadata: java.sql.SQLException: javax.resource.ResourceException: IJ000453: Unable to get managed connection for java:jboss/datasources/MysqlDS

          at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:137)

          at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:67) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.prepare(SuppliedConnectionProviderConnectionHelper.java:51) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:194) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:178) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:457) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1737) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:84) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:889) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:162) [jboss-as-jpa-7.1.0.Final.jar:7.1.0.Final]

          at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:85) [jboss-as-jpa-7.1.0.Final.jar:7.1.0.Final]

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)

          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_09-icedtea]

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_09-icedtea]

          at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_09-icedtea]

      Caused by: javax.resource.ResourceException: IJ000453: Unable to get managed connection for java:jboss/datasources/MysqlDS

          at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:390)

          at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:368)

          at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:464)

          at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:129)

          ... 17 more

      Caused by: javax.resource.ResourceException: IJ000658: Unexpected throwable while trying to create a connection: null

          at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.getConnection(SemaphoreArrayListManagedConnectionPool.java:371)

          at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getSimpleConnection(AbstractPool.java:400)

          at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(AbstractPool.java:365)

          at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:329)

          ... 20 more

      Caused by: javax.resource.ResourceException: Could not create connection

          at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:277)

          at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:235)

          at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.createConnectionEventListener(SemaphoreArrayListManagedConnectionPool.java:758)

          at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.getConnection(SemaphoreArrayListManagedConnectionPool.java:343)

          ... 23 more

      Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

       

      The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.

          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [rt.jar:1.7.0_09-icedtea]

          at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) [rt.jar:1.7.0_09-icedtea]

          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [rt.jar:1.7.0_09-icedtea]

          at java.lang.reflect.Constructor.newInstance(Constructor.java:525) [rt.jar:1.7.0_09-icedtea]

          at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)

          at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1116)

          at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:344)

          at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2332)

          at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2369)

          at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2153)

          at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:792)

          at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)

          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [rt.jar:1.7.0_09-icedtea]

          at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) [rt.jar:1.7.0_09-icedtea]

          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [rt.jar:1.7.0_09-icedtea]

          at java.lang.reflect.Constructor.newInstance(Constructor.java:525) [rt.jar:1.7.0_09-icedtea]

          at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)

          at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:381)

          at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:305)

          at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:249)

          ... 26 more

      Caused by: java.net.NoRouteToHostException: No route to host

          at java.net.PlainSocketImpl.socketConnect(Native Method) [rt.jar:1.7.0_09-icedtea]

          at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339) [rt.jar:1.7.0_09-icedtea]

          at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200) [rt.jar:1.7.0_09-icedtea]

          at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182) [rt.jar:1.7.0_09-icedtea]

          at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391) [rt.jar:1.7.0_09-icedtea]

          at java.net.Socket.connect(Socket.java:579) [rt.jar:1.7.0_09-icedtea]

          at java.net.Socket.connect(Socket.java:528) [rt.jar:1.7.0_09-icedtea]

          at java.net.Socket.<init>(Socket.java:425) [rt.jar:1.7.0_09-icedtea]

          at java.net.Socket.<init>(Socket.java:241) [rt.jar:1.7.0_09-icedtea]

          at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:257)

          at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:294)

          ... 39 more

       

      2012/10/30 06:29:05,637 ERROR [org.hibernate.tool.hbm2ddl.SchemaUpdate] (MSC service thread 1-3) HHH000299: Could not complete schema update: java.sql.SQLException: javax.resource.ResourceException: IJ000453: Unable to get managed connection for java:jboss/datasources/MysqlDS

          at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:137)

          at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:67) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.prepare(SuppliedConnectionProviderConnectionHelper.java:51) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:194) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:178) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:457) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1737) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:84) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:889) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:162) [jboss-as-jpa-7.1.0.Final.jar:7.1.0.Final]

          at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:85) [jboss-as-jpa-7.1.0.Final.jar:7.1.0.Final]

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)

          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_09-icedtea]

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_09-icedtea]

          at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_09-icedtea]

      Caused by: javax.resource.ResourceException: IJ000453: Unable to get managed connection for java:jboss/datasources/MysqlDS

          at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:390)

          at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:368)

          at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:464)

          at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:129)

          ... 17 more

      Caused by: javax.resource.ResourceException: IJ000658: Unexpected throwable while trying to create a connection: null

          at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.getConnection(SemaphoreArrayListManagedConnectionPool.java:371)

          at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getSimpleConnection(AbstractPool.java:400)

          at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(AbstractPool.java:365)

          at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:329)

          ... 20 more

      Caused by: javax.resource.ResourceException: Could not create connection

          at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:277)

          at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:235)

          at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.createConnectionEventListener(SemaphoreArrayListManagedConnectionPool.java:758)

          at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.getConnection(SemaphoreArrayListManagedConnectionPool.java:343)

          ... 23 more

      Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

       

      The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.

          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [rt.jar:1.7.0_09-icedtea]

          at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) [rt.jar:1.7.0_09-icedtea]

          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [rt.jar:1.7.0_09-icedtea]

          at java.lang.reflect.Constructor.newInstance(Constructor.java:525) [rt.jar:1.7.0_09-icedtea]

          at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)

          at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1116)

          at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:344)

          at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2332)

          at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2369)

          at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2153)

          at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:792)

          at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)

          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [rt.jar:1.7.0_09-icedtea]

          at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) [rt.jar:1.7.0_09-icedtea]

          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [rt.jar:1.7.0_09-icedtea]

          at java.lang.reflect.Constructor.newInstance(Constructor.java:525) [rt.jar:1.7.0_09-icedtea]

          at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)

          at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:381)

          at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:305)

          at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:249)

          ... 26 more

      Caused by: java.net.NoRouteToHostException: No route to host

          at java.net.PlainSocketImpl.socketConnect(Native Method) [rt.jar:1.7.0_09-icedtea]

          at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339) [rt.jar:1.7.0_09-icedtea]

          at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200) [rt.jar:1.7.0_09-icedtea]

          at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182) [rt.jar:1.7.0_09-icedtea]

          at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391) [rt.jar:1.7.0_09-icedtea]

          at java.net.Socket.connect(Socket.java:579) [rt.jar:1.7.0_09-icedtea]

          at java.net.Socket.connect(Socket.java:528) [rt.jar:1.7.0_09-icedtea]

          at java.net.Socket.<init>(Socket.java:425) [rt.jar:1.7.0_09-icedtea]

          at java.net.Socket.<init>(Socket.java:241) [rt.jar:1.7.0_09-icedtea]

          at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:257)

          at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:294)

          ... 39 more

       

      My peristence file look like this:

       

      <?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="ResearchManagement.Data" transaction-type="RESOURCE_LOCAL">
            <!-- If you are running in a production environment, add a managed
              data source, this example data source is just for development and testing! -->
            <!-- The datasource is deployed as WEB-INF/kitchensink-quickstart-ds.xml, you
              can find it in the source at src/main/webapp/WEB-INF/kitchensink-quickstart-ds.xml -->      
            <jta-data-source>java:jboss/datasources/MysqlDS</jta-data-source>
      
               <class>org.Entities.Department</class>
              <class>org.Entities.Employee</class>
              <class>org.Entities.Partner</class>
              <class>org.Entities.Project</class>
              <class>org.Entities.User</class>        
      
      
            <properties>
               <!-- Properties for Hibernate -->
               <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
               <property name="hibernate.hbm2ddl.auto" value="update" />
               <property name="hibernate.show_sql" value="false" />
            </properties>
         </persistence-unit>
      </persistence>
      

      and the datasource.xml :

       

      <?xml version="1.0" encoding="UTF-8"?>
      <!-- This is an unmanaged datasource. It should be used for proofs of concept
      or testing only. It uses H2, an in memory database that ships with JBoss
      AS. -->
      <datasources xmlns="http://www.jboss.org/ironjacamar/schema"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://www.jboss.org/ironjacamar/schema http://docs.jboss.org/ironjacamar/schema/datasources_1_0.xsd">
         <!-- The datasource is bound into JNDI at this location. We reference
      this in META-INF/persistence.xml -->
      
         <datasource jndi-name="java:jboss/datasources/MysqlDS"
            pool-name="openshiftdatabasemysql" enabled="true"
            use-java-context="true">
            <connection-url>jdbc:mysql://127.5.54.1:3306/researchprojects</connection-url>
            <driver>mysql</driver>
            <security>
               <user-name>admin</user-name>
               <password>********</password>
            </security>
         </datasource>
      </datasources>
      

       

       

      <datasources>
                      <datasource jndi-name="java:jboss/datasources/ExampleDS" enabled="true" use-java-context="true" pool-name="H2DS">
                          <connection-url>jdbc:h2:${jboss.server.data.dir}/test;DB_CLOSE_DELAY=-1</connection-url>
                          <driver>h2</driver>
                          <security>
                              <user-name>sa</user-name>
                              <password>sa</password>
                          </security>
                      </datasource>
                      <datasource jndi-name="java:jboss/datasources/MysqlDS" enabled="${mysql.enabled}" use-java-context="true" pool-name="MysqlDS">
                          <connection-url>jdbc:mysql://${env.OPENSHIFT_DB_HOST}:${env.OPENSHIFT_DB_PORT}/${env.OPENSHIFT_APP_NAME}</connection-url>
                          <driver>mysql</driver>
                          <security>
                            <user-name>${env.OPENSHIFT_DB_USERNAME}</user-name>
                            <password>${env.OPENSHIFT_DB_PASSWORD}</password>
                          </security>
                          <validation>
                            <check-valid-connection-sql>SELECT 1</check-valid-connection-sql>
                          </validation>
                      </datasource>
                      <datasource jndi-name="java:jboss/datasources/PostgreSQLDS" enabled="${postgresql.enabled}" use-java-context="true" pool-name="PostgreSQLDS" use-ccm="true">
                          <connection-url>jdbc:postgresql://${env.OPENSHIFT_DB_HOST}:${env.OPENSHIFT_DB_PORT}/${env.OPENSHIFT_APP_NAME}</connection-url>
                          <driver>postgresql</driver>
                          <security>
                            <user-name>${env.OPENSHIFT_DB_USERNAME}</user-name>
                            <password>${env.OPENSHIFT_DB_PASSWORD}</password>
                          </security>
                          <validation>
                            <check-valid-connection-sql>SELECT 1</check-valid-connection-sql>
                          </validation>
                      </datasource>
                      <drivers>
                          <driver name="h2" module="com.h2database.h2">
                              <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
                          </driver>
                          <driver name="mysql" module="com.mysql.jdbc">
                              <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
                          </driver>
                          <driver name="postgresql" module="org.postgresql.jdbc">
                              <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
                          </driver>
                      </drivers>
                  </datasources>
      

       

      Anybody has an idea how can i solve the error???