Don Collett
Don Collett

Reputation: 29

Glassfish Docker EAR deploy failing authentication

On the latest, glassfish docker image, I'm trying to deploy an EAR.

Here's the Dockerfile:

FROM glassfish/nightly
COPY start.sh /
COPY gf-j2ee8-poc.ear /
COPY glassfish-password.txt /
EXPOSE 8080
EXPOSE 4848
ENTRYPOINT ["/start.sh"]

In my start.sh, I have the following:

/glassfish4/bin/asadmin --interactive=false --user admin --passwordfile /glassfish-password.txt deploy /gf-j2ee8-poc.ear

with the following glassfish-password.txt

AS_ADMIN_PASSWORD=
AS_ADMIN_ADMINPASSWORD=
AS_ADMIN_USERPASSWORD=
AS_ADMIN_MASTERPASSWORD=

I've tried with these values unset, set to admiadmin, and admin. Nothing works.

I've also tried this as:

/glassfish4/bin/asadmin --interactive=false -u admin deploy /gf-j2ee8-poc.ear

I always get the following error while running the docker image.

Authentication failed for user: admin with password from password file: /glassfish-password.txt 
(Usually, this means invalid user name and/or password) 
Command deploy failed.

Anyone know how to make this work?

Upvotes: 0

Views: 462

Answers (2)

You have to change admin password. This is working script. It changes password and enables admin panel. Also, probably, your AS_ADMIN_PASSWORD is not correct.

echo "AS_ADMIN_PASSWORD=" > /tmp/glassfishpwd && \
echo "AS_ADMIN_NEWPASSWORD=$GLASSFISH_ADMIN_PASSWORD" >> /tmp/glassfishpwd  && \

asadmin --user=admin --passwordfile=/tmp/glassfishpwd change-admin-password --domain_name domain1 && \
asadmin start-domain && \
echo "AS_ADMIN_PASSWORD=$GLASSFISH_ADMIN_PASSWORD" > /tmp/glassfishpwd && \
asadmin --user=admin --passwordfile=/tmp/glassfishpwd enable-secure-admin && \
/glassfish-4.1/bin/asadmin --user=admin stop-domain && \
rm /tmp/glassfishpwd

Upvotes: 0

Mike
Mike

Reputation: 4963

The answer is in the blog post you linked to:

And access the console at http://localhost:4848. The default admin username and password are: user=admin / password=glassfish.

You will need to set AS_ADMIN_PASSWORD=glassfish. You shouldn't need anything else in your passwordfile.

Upvotes: 1

Related Questions