How to start glassfish domain from different path using command line

6k Views Asked by At

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

2

There are 2 best solutions below

0
On BEST ANSWER

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
1
On

First I would make sure that the domain personal_domain is known by the glassfish server. The following statement lists all the known domains.

C:\Program Files (x86)\glassfish4\glassfish\bin>asadmin list-domains

If the asadmin list-domains list personal-domain, I would try to start the domain using the domain name instead of the domain path and the --domaindir option.

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