jakartaee / rest

Jakarta RESTful Web Services
Other
353 stars 114 forks source link

Error when running jersey-tck: Cannot run program "asadmin" - File not found #1078

Closed jelemux closed 2 years ago

jelemux commented 2 years ago

Whenever I try to execute the jersey-tck with mvn verify I get the following error message: [ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.0.0:exec (StartDomain1) on project jersey-tck: Command execution failed.: Cannot run program "asadmin" (in directory "/home/jelemux/Documents/Java/Jakarta REST/jaxrs-api/jersey-tck/target/glassfish6/glassfish/bin"): error=2, Datei oder Verzeichnis nicht gefunden

But when I look into the glassfish/bin directory, the file clearly is there:

❯ ls jersey-tck/target/glassfish6/glassfish/bin/asadmin
jersey-tck/target/glassfish6/glassfish/bin/asadmin

@mkarg suggested that it may be related to Glassfish not being compatible to JRE 17 and made PR #1077. But this does not fix the problem for me.

I backtracked the commit that introduces the issue for me which is 793a7e35. @alwin-joseph maybe you've got an idea what might cause this?

System details:

❯ mvn -v
Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537)
Maven home: /home/jelemux/.sdkman/candidates/maven/current
Java version: 11.0.13, vendor: Eclipse Adoptium, runtime: /home/jelemux/.sdkman/candidates/java/11.0.13-tem
Default locale: de_DE, platform encoding: UTF-8
OS name: "linux", version: "5.15.10-xanmod1-1", arch: "amd64", family: "unix"
mkarg commented 2 years ago

It would be interesting to see what happens, when you try to startup GlassFish manually:

target/glassfish6/glassfish/bin/asadmin start-domain

If this fails, too, then...:

jelemux commented 2 years ago

Seems to work:

❯ ./jersey-tck/target/glassfish6/glassfish/bin/asadmin start-domain
Waiting for domain1 to start .....
Successfully started the domain : domain1
domain  Location: /home/jelemux/Documents/Java/Jakarta REST/jaxrs-api/jersey-tck/target/glassfish6/glassfish/domains/domain1
Log File: /home/jelemux/Documents/Java/Jakarta REST/jaxrs-api/jersey-tck/target/glassfish6/glassfish/domains/domain1/logs/server.log
Admin Port: 4848
Command start-domain executed successfully.

server.log TCK Tests seem to get executed, there are some exceptions but maybe they're deliberate, I can't tell.

alwin-joseph commented 2 years ago

Whenever I try to execute the jersey-tck with mvn verify I get the following error message: [ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.0.0:exec (StartDomain1) on project jersey-tck: Command execution failed.: Cannot run program "asadmin" (in directory "/home/jelemux/Documents/Java/Jakarta REST/jaxrs-api/jersey-tck/target/glassfish6/glassfish/bin"): error=2, Datei oder Verzeichnis nicht gefunden

But when I look into the glassfish/bin directory, the file clearly is there:

❯ ls jersey-tck/target/glassfish6/glassfish/bin/asadmin
jersey-tck/target/glassfish6/glassfish/bin/asadmin

@mkarg suggested that it may be related to Glassfish not being compatible to JRE 17 and made PR #1077. But this does not fix the problem for me.

I backtracked the commit that introduces the issue for me which is 793a7e3. @alwin-joseph maybe you've got an idea what might cause this?

System details:

❯ mvn -v
Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537)
Maven home: /home/jelemux/.sdkman/candidates/maven/current
Java version: 11.0.13, vendor: Eclipse Adoptium, runtime: /home/jelemux/.sdkman/candidates/java/11.0.13-tem
Default locale: de_DE, platform encoding: UTF-8
OS name: "linux", version: "5.15.10-xanmod1-1", arch: "amd64", family: "unix"

I had faced similar issue with mac OS . Can you try below workaround :

add ‘/jaxrs-api/jersey-tck/target/glassfish6/glassfish/bin’ to the PATH variable. /jaxrs-api/jersey-tck/target/glassfish6 is where the glassfish would be extracted as per the jersey-tck/pom.xml

jansupol commented 2 years ago

I am thinking if the space in the path /Jakarta REST/ can be the issue...

mkarg commented 2 years ago

I am thinking if the space in the path /Jakarta REST/ can be the issue...

But does it work fine in exactly the same path when issued manually?

jelemux commented 2 years ago

I had faced similar issue with mac OS . Can you try below workaround :

add ‘/jaxrs-api/jersey-tck/target/glassfish6/glassfish/bin’ to the PATH variable. /jaxrs-api/jersey-tck/target/glassfish6 is where the glassfish would be extracted as per the jersey-tck/pom.xml

That was it, thanks!

How do we proceed now? Is there some way we can get it to work without that right from the start?

arjantijms commented 2 years ago

@jelemux perhaps take a look at the faces prototype tck (in the test2 folder of the mojarra project).

It extracts GlassFish, and sets the location via a property. There's nothing special users have to do but type mvn clean install.

jelemux commented 2 years ago

@arjantijms Thanks for the tip, I had a look but the faces tck does not utilize exec-maven-plugin and no call to asadmin is made. Our TCK didn't use exec-maven-plugin either in the past and I'm not exactly sure why we need it now.

However, I was able to fix the problem by prepending a ./ before the executable. I'll prepare a PR. This should fix the problem for Linux and MacOS. I'm not sure how Windows handles this, so someone using Windows should test it.

arjantijms commented 2 years ago

Thanks for the tip, I had a look but the faces tck does not utilize exec-maven-plugin and no call to asadmin is made.

Yes, that's under control of the Arquillian plug-in, and as intended.

From the looks of it, the REST TCK is currently a bit too much the translation of the existing TCK somewhat partially pushed into an Arquillian setup, and therefor missing quite a few features that Arquillian already has.

Case in point was the previous attempt to create a script that adds vendor specific files to an archive, while Arquillian already has an SPI for exactly that.

Attempting to manually start and stop the server is also something that should not often be needed when using Arquillian. Of course Arquillian is not the end-all and has deficiencies too, but it might be better to solve them at the Arquillian level (adding new SPIs or APIs where needed), instead of going the way of the old TCK and using numerous scripts and utility code and what have you to manually start and stop things.

mkarg commented 2 years ago

I agree with Arjan that migrating to Arquillian should be the future target, but for now I confirm that simply adding dot-slash-prefix will not harm at all on Windows, so go for the PR, Jeremias! :-)