[GLASSFISH-20923] stop-database command does not work when derby authentication is on Created: 10/Dec/13  Updated: 20/Oct/14

Status: Open
Project: glassfish
Component/s: admin
Affects Version/s: 4.0
Fix Version/s: None

Type: Bug Priority: Major
Reporter: jiggster Assignee: Chris Kasso
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Mac OS X 10.9/Windows 7


Tags: 4_0_1-approved, 4_0_1-evangelists, admin, stop-database

 Description   

When derby/java db authentication is turned on via the derby.properties file, it is impossible to stop the database by means of the stop-domain asadmin command.

Steps to reproduce:

1. Install glassfish 4 server
2. Go to as_install/glassfish and create the databases directory
3. Create derby.properties file in the as_install/glassfish/databases directory - the content of the file shall be as below:

derby.connection.requireAuthentication=true
derby.authentication.provider=BUILTIN
derby.user.APP=APP

4. Execute asadmin start-database - it will succeed.
5. Execute asadmin stop-database --dbuser APP

The command will fail with the below message:

Tue Dec 10 19:10:48 CET 2013 : Connection obtained for host: 0.0.0.0, port number 1527.
Unable to stop database. Please check log in derby.log.
Command stop-database failed.

Content of the derby.log:

Tue Dec 10 19:10:14 CET 2013 : Derby shutdown warning:
Connection authentication failure occurred. Reason: Invalid authentication..

Tested it on both Windows 7 and Mac OS X 10.9



 Comments   
Comment by jifeng [ 13/Dec/13 ]

Hi
Chris Kasso, jiggster

this error may relate to the fact that asadmin stop-database does not support the input password(At present only username can be entered), because the database can be stopped when I use the following command:

 
javadb/lib/java -jar derbyrun.jar server shutdown -user APP -password APP//it will succeed.

next, I'm going to see the implemention of stop-database commmand to verify that my idea is correct or not.

Comment by jiggster [ 13/Dec/13 ]

Yup,

I can confirm that the above command works. Also when using stopNetworkServer script from as_install/javadb/bin folder everything works as expected.

I just thought that maybe the stop-database command could somehow parse the derby.properties file and deduce the password from the username indicated by --dbuser option.

Anyways, it would definitely be convenient if the stop-database command worked.

Cheers!

Comment by jifeng [ 17/Dec/13 ]

Hi
jiggster

If so, we need to increase the processing in glassfish code, that is analysis of the derby.properties to achieve password, so the degree of coupling between glassfish and javadb will increase. Whether the following form can be considered:

 
asadmin stop-database --dbuser APP --dbpass APP 

Cheers!

Comment by jiggster [ 17/Dec/13 ]

Hi,

Your proposal is perfectly fine with me - hopefully with others interested too!

I'm assuming it is You, who will take care of implementing this additional option for stop-database command, right? If You need any help, I'd be delighted to contribute in some way - I don't have the commiter's rights, but I can help with the tests.

Cheers.

Comment by jifeng [ 21/Jan/14 ]

Hi
Chris

In order to resolve this bug, I think the glassfish can provide an additional option in the command of stop-database,
such as "asadmin stop-database --dbuser APP --dbpass APP ".
I am create a patch, and it works fine:

com.sun.enterprise.admin.cli.optional.StopDatabaseCommand
// Some comments here
--- StopDatabaseCommand.java	(revision 62639)
+++ StopDatabaseCommand.java	(working copy)
@@ -73,6 +73,7 @@
     @Param(name = "dbuser", optional = true)
     private String dbUser;
 
     private File dbPasswordFile;

+    @Param(name = "dbpass", optional = true)
     private String dbPassword;
 
Comment by Chris Kasso [ 18/Feb/14 ]

I took a look at StopDatabaseCommand.java. It supports pulling the DB password from a password file. Have you verified it works and if it does would you still need the dbpass command line option (other than for convenience)?

Comment by jifeng [ 27/Mar/14 ]

Hi
Chris

Thanks for taking notes of this issue, I have confirmed that the StopDatabaseCommand indeed support the feature to acquire the password from password file. So We needn't add dbpass option here.

Comment by jiggster [ 20/Oct/14 ]

Did a quick test using the recently released 4.1 version, but unfortunately the stop-database command does not recognize the --dbpass option and this my question is when (which release) will this issue be fixed?

Generated at Sun Jul 05 19:41:26 UTC 2015 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.