title: cannot acquire data source trying to Unit test java persistence Entity Manager
body: <p>I am fairly new to JPA and I wanted to test my EntityManagers persistance/deletion etc. I keep recieving an error that i cannot accquire 
  data source . I am at a complete lose, I have searched online for hours and cannot find(or at least understand) any answers on the web. Any help would be appreciated. Thank you!</p>
  
  <p><strong>This is the test class.</strong></p>
  
  <pre><code>@Transactional
  public class DoctorRepositoryTest
  {
     private DoctorRepository dr;
     private Doctor doctor;
     private EntityManagerFactory emf
         = Persistence.createEntityManagerFactory("TestPersistence");
    private  EntityManager em = null;
  
  
  public DoctorRepositoryTest()
  {
  }
  
  @BeforeClass
  public static void setUpClass()
  {
  
  }
  
  @AfterClass
  public static void tearDownClass()
  {
  }
  
  @Before
  public void setUp()
  {
  
  
  
  
    dr = new DoctorRepository();
  
    doctor = new Doctor(0,"doctorFirstName", "doctorLastName", "4032223333", 
    "123 45 ave NW","Calgary", "AB", "t3k5c9");
  
  
  }
  
  @After
  public void tearDown()
  {
     dr = null;
     doctor = null;
  }
  
  /**
   * Testings method for the insertion of Doctor Objects to
   * the database
   */
  @Test
  public void testInsert(){
  
  
  
      int result;
      EntityManager em = emf.createEntityManager();
       try
     {
        em.getTransaction().begin();
        em.persist(doctor);
        em.getTransaction().commit();
        result = 1;
     }
       catch(Exception e){
  
          result = 0;
       }
     finally
     {
        em.close();
     }
  
       assertEquals(result,1);
  
  }
  </code></pre>
  
  <p><strong>This is my persistence xml</strong></p>
  
  <pre><code>    &lt;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   http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"&gt;
    &lt;persistence-unit name="SunrisePU" transaction-type="JTA"&gt;
     &lt;jta-data-source&gt;SunriseDB&lt;/jta-data-source&gt;
     &lt;exclude-unlisted-classes&gt;false&lt;/exclude-unlisted-classes&gt;
      &lt;properties/&gt;
    &lt;/persistence-unit&gt;
    &lt;persistence-unit name="TestPersistence" transaction-type="RESOURCE_LOCAL"&gt;
      &lt;jta-data-source&gt;SunriseDB&lt;/jta-data-source&gt;
      &lt;properties&gt;
      &lt;/properties&gt;
    &lt;/persistence-unit&gt;
  &lt;/persistence&gt;
  </code></pre>
  
  <p><strong>The Error I keep getting is.</strong></p>
  
  <pre><code>[EL Info]: 2016-03-27 12:50:44.151--ServerSession(957465255)--EclipseLink, version: Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd
  
  [EL Severe]: ejb: 2016-03-27 12:50:48.588--ServerSession(957465255)--Exception     
  [EclipseLink-7060] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.ValidationException
  </code></pre>
  
  <p>Exception Description: Cannot acquire data source [SunriseDB].</p>
  
  <p>There is much more to the error, but the root cause is that i cannot connect to my database for the testing.</p>