Hi there
I am trying to run integration tests for my JEE application in a Payara Micro server inside Docker. In order to test, I need a couple of users in different groups. For that I thought I could use some asadmin commands in a post-boot-command script, but I have run into some problems.
I have recorded the user creation in the admin console where I created two users with empty passwords (this is just an integration test, so empty passwords are fine). My Dockerfile is like this:
FROM payara/micro
COPY ./target/bank.war /opt/payara/deployments
COPY ./src/test/payara/post-boot-commands.txt /opt/payara
ENTRYPOINT []
CMD ["/usr/bin/java", "-jar", "/opt/payara/payara-micro.jar", "--nocluster", "--deploymentDir", "/opt/payara/deployments", "--postbootcommandfile", "/opt/payara/post-boot-commands.txt"]
and post-boot-commands.txt is:
create-file-user --groups=customers customer
create-file-user --groups=advisors advisor
Nice and simple :) However, this will not run, I get this error twice:
[2018-02-23T12:09:18.125+0000] [] [WARNING] [] [fish.payara.micro.boot.runtime.BootCommand] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1519387758125] [levelValue: 900] [[
Boot Command create-file-user failed PlainTextActionReporterFAILUREorg.jvnet.hk2.config.UnsatisfiedDependencyException: injection failed on com.sun.enterprise.security.cli.CreateFileUser.userpassword with class java.lang.StringDescription: create-file-user commandCannot find userpassword in create-file-user command model, file a bug
Usage: create-file-user
[--authrealmname <authrealm_name>] [--target target]
[--groups user_groups[:user_groups]*]
[-?|--help[=<help(default:false)>]] username
]]
So apparently I cannot use empty passwords(?)
I then added a password.txt file:
AS_ADMIN_USERPASSWORD=passw0rd
and changed post-boot-commands.txt to:
create-file-user --passwordfile /opt/payara/password.txt --groups=customers customer
create-file-user --passwordfile /opt/payara/password.txt --groups=advisors advisor
but now I get this error:
[2018-02-23T12:18:55.801+0000] [] [WARNING] [] [fish.payara.micro.boot.runtime.BootCommand] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1519388335801] [levelValue: 900] Boot Command create-file-user failed PlainTextActionReporterFAILUREThe specified physical file /tmp/payaramicro-rt192260533805564173tmp/config/keyfile associated with the file realm file does not exist.
Apparently the keyfile is missing, but when i do an ls in the config directory listed in the error message, it contains an empty keyfile.
I apologize if this is just because I am a Payara noob, but I would really appreciate some help on this simple task: adding two users :)
/morten