title: JPA + EJB testing with embedded glassfish v3
body: <p>Trying to set up a JPA+EJB testing after these instructions:
  <a href="http://ctpjava.blogspot.fi/2009/10/unit-testing-ejbs-and-jpa-with.html" rel="nofollow">http://ctpjava.blogspot.fi/2009/10/unit-testing-ejbs-and-jpa-with.html</a></p>
  
  <p>There seems to be few problems that I can't seem to get quite right.
  First I get this error (which I am able to work around, but it still needs to be fixed):</p>
  
  <pre><code>SEVERE: EJB6004:Specified application server installation location [C:\Users\&lt;userName&gt;\.m2\repository\org\glassfish\extras\glassfish-embedded-all\domains\domain1] does not exist.
  </code></pre>
  
  <p>Found this site, which gives the (more correct?) properties to set:
  <a href="http://docs.oracle.com/cd/E18930_01/html/821-2424/gjlde.html" rel="nofollow">http://docs.oracle.com/cd/E18930_01/html/821-2424/gjlde.html</a></p>
  
  <p>And modified my testing setup to this:</p>
  
  <pre><code>import javax.ejb.embeddable.EJBContainer;
  import javax.naming.Context;
  import org.junit.BeforeClass;
  import org.junit.Test;
  import org.junit.runner.RunWith;
  import org.junit.runners.JUnit4;
  ...
  @BeforeClass
  public static void createContainer() {
      Map&lt;String, Object&gt; properties = new HashMap&lt;String, Object&gt;();
      properties.put(EJBContainer.MODULES, new File("target/classes"));
      properties.put("installation.root", "./src/test/glassfish");
      properties.put("configuration.file", "./src/test/glassfish/domains/domain1/config/domain.xml");
      container = EJBContainer.createEJBContainer(properties);
      ctx = container.getContext();
  }
  </code></pre>
  
  <p>And in pom.xml I have the following that seems to be required for this:</p>
  
  <pre><code>    &lt;dependency&gt;
          &lt;groupId&gt;org.apache.derby&lt;/groupId&gt;
          &lt;artifactId&gt;derby&lt;/artifactId&gt;
          &lt;version&gt;10.9.1.0&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  
      &lt;!-- Must be before java-ee --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.glassfish.extras&lt;/groupId&gt;
          &lt;artifactId&gt;glassfish-embedded-all&lt;/artifactId&gt;
          &lt;version&gt;3.1.1&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;javax&lt;/groupId&gt;
          &lt;artifactId&gt;javaee-api&lt;/artifactId&gt;
          &lt;version&gt;6.0&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;junit&lt;/groupId&gt;
          &lt;artifactId&gt;junit&lt;/artifactId&gt;
          &lt;version&gt;4.11&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>The error pointed into user directory and I was able to get pass this by setting up the required stuff there (and got past this), but that is not a proper place, since everything must be available via SVN.</p>
  
  <p>According to the latter link I think I have the correct properties set, but those seem to be ignored. Maybe I am missing something obvious?</p>