users@jersey.java.net

[Jersey] Re: Glassfish embedded server does not start in junit tests after upgrading to 1.6

From: Pavel Bucek <pavel.bucek_at_oracle.com>
Date: Tue, 17 May 2011 09:58:54 +0200

Hello Pierre,

do you really need embedded glassfish? Wouldn't be just grizzly (2.x)
sufficient? (Depends on what you have in your app - do you use any java
ee 6 specific stuff like cdi, ejb, managed beans?)

And to answer your question - I must (sadly) admit, that using
jersey-test-framework-external and whatever container (full glassfish
distro for example) is currently better than our integration of embedded
one. We recently updated jersey-test-framework-embedded-glassfish to use
glassfish 3.1 and it seem to work for simple cases but there might be
some issues for more complicated scenarios (like yours I guess).

If you want to help us, please create new JIRA issue for this, ideally
with a simple testcase.

Thanks,
Pavel

On 5/16/11 10:05 PM, Pierre Radermecker wrote:
> Hi,
>
> I can be a bit more specific. It fails the first time because of this error:
>
> Caused by: java.io.IOException: src/main/webapp/WEB-INF/sun-web.xml does not
> exist.
> at
> org.glassfish.embeddable.archive.ScatteredArchive.addMetadata(ScatteredArchive.java:327)
>
>
>
>
> I don't understand the change made in "createArchive()". Why is it suddendly
> trying to build a "sun-web.xml" ?
>
> I am using Tomcat in production so maybe I should forget about Glassfish
> altogether and use "jersey-test-framework-external" ?
>
> Thanks for any help.
>
> - Pierre
>
> ----- Original Message ----
> From: Pierre Radermecker<pradermecker_at_yahoo.ca>
> To: users_at_jersey.dev.java.net
> Sent: Mon, May 16, 2011 5:39:15 PM
> Subject: Glassfish embedded server does not start in junit tests after upgrading
> to 1.6
>
> Hi,
>
> Since the 1.6 Jersey upgrade (from 1.5), I have the following error message
> while I try to run my tests (using "jersey-test-framework-embedded-glassfish")
>
>
> Caused by: org.glassfish.embeddable.GlassFishException: Already bootstrapped
> at
> org.glassfish.embeddable.GlassFishRuntime._bootstrap(GlassFishRuntime.java:150)
> at
> org.glassfish.embeddable.GlassFishRuntime.bootstrap(GlassFishRuntime.java:106)
> at
> org.glassfish.embeddable.GlassFishRuntime.bootstrap(GlassFishRuntime.java:80)
> at
> com.sun.jersey.test.framework.spi.container.embedded.glassfish.EmbeddedGlassFishTestContainerFactory$EmbeddedGlassFishTestContainer.instantiateServer(EmbeddedGlassFishTestContainerFactory.java:258)
>
>
> ... 33 more
>
> Here is my pom entry (${jerseyVersion} is 1.6):
>
> <dependency>
> <groupId>com.sun.jersey.jersey-test-framework</groupId>
> <artifactId>jersey-test-framework-embedded-glassfish</artifactId>
> <version>${jerseyVersion}</version>
> <scope>test</scope>
> </dependency>
>
> Any ideas ?
>
> Thanks for your help,
>
> - Pierre
>