JenkinsでGlassFishにデプロイしようとすると、エラーとなってしまった。
/usr/local/glassfish5/bin/asadmin --user admin --passwordfile /tmp/password-admin.txt redeploy --name=test /tmp/test.war
エラーログ
SSH: EXEC: connected
Deprecated syntax, instead use:
asadmin --user admin --passwordfile /tmp/password-admin.txt redeploy [options] ...
No such local command: redeploy. Unable to access the server to execute the command remotely. Verify the server is available.
Command redeploy failed.
Remote server does not listen for requests on [localhost:4848]. Is the server up?
SSH: EXEC: completed after 1,412 ms
SSH: Disconnecting configuration [test] ...
ERROR: Exception when publishing, exception message [Exec exit status not zero. Status [1]]
Build step 'Send build artifacts over SSH' changed build result to UNSTABLE
Finished: UNSTABLE
どうやら、asadmin redeployコマンドの実行に失敗しているらしい。
原因
asadminコマンドはポートを指定しない場合、デフォルトで 4848 と通信するらしい
https://docs.oracle.com/cd/E18930_01/html/821-2433/asadmin-1m.html
解決方法
asadminコマンドのオプションでportが指定できるので、このオプションでポートを指定する。
/usr/local/glassfish5/bin/asadmin --port 4849 --user admin --passwordfile /tmp/password-admin.txt redeploy --name=test /tmp/test.war