jakartaee / rest

Jakarta RESTful Web Services
Other
353 stars 114 forks source link

Cannot start jersey-tck two times in a row #1079

Closed mkarg closed 2 years ago

mkarg commented 2 years ago

When running mvn --file jersey-tck/pom.xml verify the first run starts GlassFish 6 then does all tests and finally says there are test failures (which all is correct and fine).

A subsequent second run with the same command fails to start GlassFish 6 due to two problems:

mkarg commented 2 years ago

@alwin-joseph @jelemux @jansupol Any ideas how to correctly solve this instead of just working around?

arjantijms commented 2 years ago

One thing I noticed quickly glancing over the code; in jersey-tck there's this Arquillian connector:

<dependency>
    <groupId>org.jboss.arquillian.container</groupId>
    <artifactId>arquillian-glassfish-managed-6</artifactId>
    <version>1.0.0.Alpha1</version>
</dependency>

For Mojarra we're using a connector that was forked from that one a long time ago, and I think has seen quite a bit more development and improvements:

<dependency>
    <groupId>org.omnifaces.arquillian</groupId>
    <artifactId>arquillian-glassfish-server-managed</artifactId>
    <version>1.0</version>
    <scope>test</scope>
</dependency>

See https://github.com/eclipse-ee4j/mojarra/blob/master/test2/pom.xml#L386

Compare

https://github.com/omnifaces/arquillian-container-glassfish/graphs/contributors

to

https://github.com/arquillian/arquillian-container-glassfish/graphs/contributors?from=2017-06-04&to=2022-01-09&type=c + https://github.com/arquillian/arquillian-container-glassfish6/graphs/contributors

alwin-joseph commented 2 years ago

When running mvn --file jersey-tck/pom.xml verify the first run starts GlassFish 6 then does all tests and finally says there are test failures (which all is correct and fine).

A subsequent second run with the same command fails to start GlassFish 6 due to two problems:

* The first run did not stop GlassFish 6, so it is still running and listens to port 4848, leading to the error message `There is a process already using the admin port 4848 -- it probably is another instance of a GlassFish server.`; Workaround: Manually killing the process.

* The first run left over some artifacts, leading to the error message `remote failure: Adding User j2ee to file realm file failed.  User j2ee already exists. User j2ee already exists.`; Workaround: `mvn --file jersey-tck/pom.xml clean` which only works _after_ manually killing the process (see above).

I have a possible solution using https://github.com/alwin-joseph/jaxrs-api/commit/9fd7b278e216bbd6e391e83935b63d5220be7f61 .It works for me for both the above cases. Can you try the same and see if the same works too. I will create a PR after some more testing. Please suggest if any improvements can be made too.