Company work server is GlassFish, but there is no need for multiple domains. The thing is that you want to configure a domain to do a variety of technical testing. Originally wanted to copy a copy of GlassFish, but it turns out that there are multiple glassfish on a machine that can have a variety of port conflict problems. Later thought of GlassFish not can configure multiple domain, hurriedly go online looking for information. In fact, configuring multiple domain is very simple and requires only a few commands.
Create domain
GlassFish the command to create domain is: create-domain create-domain
Into the GlassFish bin directory, you can see the GlassFish asadmin tool.
Executing the./asadmin command in the current bin directory allows you to enter the asadmin command mode:
Here you can execute the create-domain command to create domain, we create a default domain, the process will require you to enter a username, password and Confirm password.
See command Create-domain executed successfully created successfully, in the process of creating, GlassFish will default to specify some ports, because there is already a domain in existence, if you have not modified the configuration, Two domain started together, there may be problems with port conflicts.
This article resolves, no free port problem: no free port
Java.net.BindException:No free port within range:7676=com.sun.enterprise.v3.se
Rvices.impl.serviceinitializerhandler@69ed60dd.
This article resolves: server up issue: is the server up?
Remote server does not listen to requests on [localhost:4848].
Is the server up?
Deployment Test
Deploying and Undeploying applications
1. Download the example provided by GlassFish,
Https://glassfish.dev.java.net/downloads/quickstart/hello.war.
2. Deploy using the command line:
Asadmin Deploy Sample-dir/hello.war
The result of two domains on my machine at the same time:
Domain is done here, Create-domain has many configuration items, the default port can be specified with configuration items, details refer to GlassFish's official documentation: Create-domain.