glassfish
  1. glassfish
  2. GLASSFISH-20923

stop-database command does not work when derby authentication is on

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 4.0
    • Fix Version/s: None
    • Component/s: admin
    • Labels:
      None
    • Environment:

      Mac OS X 10.9/Windows 7

      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

        Activity

        Hide
        jifeng added a comment -

        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.

        Show
        jifeng added a comment - 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.
        Hide
        jiggster added a comment -

        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!

        Show
        jiggster added a comment - 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!
        Hide
        jifeng added a comment -

        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!

        Show
        jifeng added a comment - 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!
        Hide
        jiggster added a comment -

        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.

        Show
        jiggster added a comment - 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.
        Hide
        jifeng added a comment -

        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;
         
        
        Show
        jifeng added a comment - 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;
        Hide
        Chris Kasso added a comment -

        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)?

        Show
        Chris Kasso added a comment - 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)?
        Hide
        jifeng added a comment -

        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.

        Show
        jifeng added a comment - 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.

          People

          • Assignee:
            Chris Kasso
            Reporter:
            jiggster
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: