title: Wildfly hibernate could not create database connection
body: <p>I am the new to the whole widlfly-hibernate, at work we use tomcat-mybatis</p>
  
  <p>I am trying to connect Wildfly 10.0 using Hibernate 5.1.0 with MySQL</p>
  
  <p>How i connect:</p>
  
  <pre><code>try {
              Configuration configuration = new Configuration();
  
              configuration.setProperty("hibernate.connection.driver_class", "com.mysql.jdbc.Driver");
              configuration.setProperty("hibernate.connection.url", "jdbc:mysql://127.0.0.1:3306/foxtrot");
              configuration.setProperty("hibernate.connection.username", "root");
              configuration.setProperty("hibernate.connection.password", "");
              configuration.setProperty("hibernate.dialect", "org.hibernate.dialect.MySQLDialect");
              configuration.setProperty("hibernate.current_session_context_class", "thread");
              configuration.setProperty("hibernate.id.new_generator_mappings", "false");
              configuration.setProperty("hibernate.show_sql", "true");
  
              configuration.addAnnotatedClass(AccountEntity.class);
  
              StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder()
                      .applySettings(configuration.getProperties());
              return configuration.buildSessionFactory(builder.build());
          } catch (Throwable ex) {
              // Make sure you log the exception, as it might be swallowed
              System.err.println("Initial SessionFactory creation failed." + ex);
              System.out.println(ex.getStackTrace());
              System.out.println(ex.getMessage());
              throw new ExceptionInInitializerError(ex);
          }
  </code></pre>
  
  <p>I receive the following error: <code>org.hibernate.exception.JDBCConnectionException: Error calling Driver#connect</code></p>
  
  <p>Sql exception: <code>java.sql.SQLNonTransientConnectionException: Could not create connection to database server.</code></p>
  
  <p>I am using wamp and i have preinstall phpmyadmin and i can connect without a problem</p>
  
  <pre><code>11:23:06,457 INFO  [stdout] (default task-5) Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
  11:23:06,457 INFO  [stdout] (default task-5) org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:244)
  11:23:06,458 INFO  [stdout] (default task-5) org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:208)
  11:23:06,458 INFO  [stdout] (default task-5) org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:189)
  11:23:06,458 INFO  [stdout] (default task-5) org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:51)
  11:23:06,458 INFO  [stdout] (default task-5) org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:94)
  11:23:06,459 INFO  [stdout] (default task-5) org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:217)
  11:23:06,459 INFO  [stdout] (default task-5) org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:189)
  11:23:06,463 INFO  [stdout] (default task-5) org.hibernate.boot.model.process.spi.MetadataBuildingProcess.handleTypes(MetadataBuildingProcess.java:352)
  11:23:06,464 INFO  [stdout] (default task-5) org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:111)
  11:23:06,464 INFO  [stdout] (default task-5) org.hibernate.boot.model.process.spi.MetadataBuildingProcess.build(MetadataBuildingProcess.java:83)
  11:23:06,465 INFO  [stdout] (default task-5) org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:418)
  11:23:06,465 INFO  [stdout] (default task-5) org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:87)
  11:23:06,465 INFO  [stdout] (default task-5) org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:692)
  11:23:06,465 INFO  [stdout] (default task-5) utility.HibernateUtils.buildSessionFactory(HibernateUtils.java:46)
  11:23:06,465 INFO  [stdout] (default task-5) utility.HibernateUtils.&lt;clinit&gt;(HibernateUtils.java:13)
  11:23:06,465 INFO  [stdout] (default task-5) utility.Dao.openCurrentSession(Dao.java:16)
  11:23:06,465 INFO  [stdout] (default task-5) services.AccountService.findByKeyAndType(AccountService.java:73)
  11:23:06,466 INFO  [stdout] (default task-5) handlers.AuthHandler.Handle(AuthHandler.java:37)
  11:23:06,466 INFO  [stdout] (default task-5) Server.OnBinary(Server.java:84)
  11:23:06,466 INFO  [stdout] (default task-5) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  11:23:06,466 INFO  [stdout] (default task-5) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  11:23:06,466 INFO  [stdout] (default task-5) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  11:23:06,466 INFO  [stdout] (default task-5) java.lang.reflect.Method.invoke(Method.java:497)
  11:23:06,466 INFO  [stdout] (default task-5) io.undertow.websockets.jsr.annotated.BoundMethod.invoke(BoundMethod.java:87)
  11:23:06,466 INFO  [stdout] (default task-5) io.undertow.websockets.jsr.annotated.AnnotatedEndpoint$2$1.run(AnnotatedEndpoint.java:150)
  11:23:06,467 INFO  [stdout] (default task-5) io.undertow.websockets.jsr.ServerWebSocketContainer.invokeEndpointMethod(ServerWebSocketContainer.java:553)
  11:23:06,467 INFO  [stdout] (default task-5) io.undertow.websockets.jsr.annotated.AnnotatedEndpoint$2.onMessage(AnnotatedEndpoint.java:145)
  11:23:06,467 INFO  [stdout] (default task-5) io.undertow.websockets.jsr.FrameHandler$6.run(FrameHandler.java:245)
  11:23:06,467 INFO  [stdout] (default task-5) io.undertow.websockets.jsr.ServerWebSocketContainer.invokeEndpointMethod(ServerWebSocketContainer.java:553)
  11:23:06,467 INFO  [stdout] (default task-5) io.undertow.websockets.jsr.ServerWebSocketContainer$5.run(ServerWebSocketContainer.java:538)
  11:23:06,467 INFO  [stdout] (default task-5) io.undertow.websockets.jsr.OrderedExecutor$ExecutorTask.run(OrderedExecutor.java:67)
  11:23:06,467 INFO  [stdout] (default task-5) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  11:23:06,468 INFO  [stdout] (default task-5) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  11:23:06,468 INFO  [stdout] (default task-5) java.lang.Thread.run(Thread.java:745)
  11:23:06,469 INFO  [stdout] (default task-5) Error java.lang.ExceptionInInitializerError
  </code></pre>