Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>(...) The standard recommended solution is to add the glassfish-embedded-all artifact as the first project dependency with test scope</p> </blockquote> <p>Indeed, you need an implementation like <code>glassfish-embedded-all</code> or <code>glassfish-embedded-web</code> if you're only using the web profile, which seems to be your case (I didn't know that the web profile was providing <code>EJBContainer</code> by the way).</p> <p>And to be precise, this artifact doesn't have to be the "first" dependency but it <strong>must</strong> be declared <strong>before</strong> the <code>javaee-api</code> artifact.</p> <blockquote> <p>So, is there a Maven repository that Nexus will be able to index to give me the glassfish-embedded-all artifact? </p> </blockquote> <p>I couldn't reproduce the issue with <a href="http://download.java.net/maven/glassfish/" rel="noreferrer">http://download.java.net/maven/glassfish/</a> but it appears that JBoss Nexus repository does have it (probably because they use it in <a href="http://jboss.org/arquillian" rel="noreferrer">Arquillian</a>):</p> <pre><code>&lt;repository&gt; &lt;id&gt;jboss-public-repository-group&lt;/id&gt; &lt;name&gt;JBoss Public Maven Repository Group&lt;/name&gt; &lt;url&gt;https://repository.jboss.org/nexus/content/groups/public&lt;/url&gt; &lt;/repository&gt; </code></pre> <blockquote> <p>is this even the correct way to go about unit testing EJBs?</p> </blockquote> <p>Unit tests are typically done outside-container and in isolation (using a Mocking framework) so I wouldn't call that unit testing. But for integration/functional testing (in-container), the <code>EJBContainer</code> API is really great and perfectly fine.</p> <h3>See also</h3> <ul> <li><a href="http://blogs.oracle.com/arungupta/entry/totd_128_ejbcontainer_createejbcontainer_embedded" rel="noreferrer">TOTD #128: EJBContainer.createEJBContainer: Embedded EJB using GlassFish v3</a></li> <li><a href="http://ctpjava.blogspot.com/2009/10/unit-testing-ejbs-and-jpa-with.html" rel="noreferrer">Unit Testing EJBs and JPA with Embeddable GlassFish</a></li> <li><a href="http://blogs.oracle.com/alexismp/entry/testing_ejb_3_1_s" rel="noreferrer">Using the EJBContainer API with or without Maven (but with GlassFish v3)</a></li> <li><a href="http://www.adam-bien.com/roller/abien/entry/embedding_ejb_3_1_container" rel="noreferrer">Embedding EJB 3.1 Container Into Your Unit Tests - Boot Time: 5 Seconds</a></li> <li><a href="http://www.adam-bien.com/roller/abien/entry/unit_testing_ejb_3_1" rel="noreferrer">Unit Testing EJB 3.1 ...When 0.8 Seconds Are Too Long</a> for a unit test example</li> <li>The <a href="http://jboss.org/arquillian" rel="noreferrer">Arquillian</a> project</li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. COThanks Pascal, an excellent answer as usual. Unfortunately it's not fixed my problem. I think I must be configuring Nexus incorrectly or something. I've tried setting up the repository you suggested and this one https://repository.jboss.org/nexus/content/repositories/glassfish/ and neither ever show anything to download under the "browse index" tab (if you're familiar with Nexus). I've got 4 or 5 other maven repositories configured fine under Nexus so I can't understand why these ones are proving so much trouble. I've even tried setting up a completely clean install of Nexus - still no joy.
      singulars
    2. CO@wobblycogs Regarding http://download.java.net/maven/glassfish/, note that this repository doesn't provide a Nexus index (a `.index` directory at the root) so I wouldn't expect to see anything in the browse index tab if Nexus didn't download an artifact from it. However, https://repository.jboss.org/nexus/content/groups/public definitely does. But did you enable *remote repository index downloads*? See http://www.sonatype.com/books/nexus-book/reference/using-sect-browsing.html. Anyway, does the proxying feature actually work or not (does your maven client succeed in downloading artifacts)?
      singulars
    3. CO@pascal Yes, index downloads are enabled, in the Nexus logs I get: Aborted walking on repository ID='jboss-glassfish' from path='/.index', cause: Item not found on path "/.index" in repository "jboss-glassfish"!. No, I can't seem to download any of the artifacts from _that_ repository. I tried adding the repository to my settings.xml but that didn't help either I simply got: Unable to find resource 'org.glassfish.extras:glassfish-embedded-all:jar:3.0.1' in repository jboss-glassfish (https://repository.jboss.org/nexus/content/repositories/glassfish/) - odd since that URL is correct.
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload