javanetbeansglassfishasadmin

How to start glassfish domain from different path using command line


I'm trying to start my local domain from a command line, for some reason my domain was created in a different location so I tried the following command to start the domain:

C:\Program Files (x86)\glassfish4\glassfish\bin>asadmin start-domain C:\Users\Abraham\personal_domain

but it doesn't work, I got the following error:

There is no such domain directory:

C:\Program Files (x86)\glassfish4\glassfish\domains\C:\Users\Abraham\personal_domain Command start-domain failed.

Do I have to add another attribute in the command?, What am I missing?

From NetBeans, it runs fine and I can access to my application but I want to be able to start it from command line


Solution

  • Firstly, to find more information about any asadmin subcommand, you can use help to find the man page for that command in one of two ways:

    Either:

    asadmin help start-domain
    

    or

    asadmin start-domain --help
    

    Secondly, to start a domain from a different location, you need to first specify the domains directory - a folder where the actual domain folder sits, and then the domain name. This will look a lot like you've just typed out the full path to the domain directory, but do be aware that there is a space in between the end of the path and the name of the domain.

    e.g. if I wanted to start a domain called "myDomain" in a folder C:\Users\me\domains, I could do this:

    asadmin start-domain --domaindir C:\Users\me\domains myDomain
    

    Note the space in between domains and myDomain.

    So, in your case, you would need to use:

    asadmin start-domain --domaindir C:\Users\Abraham personal_domain