Glassfish Application Server is a Java EE 7 compliant Application Server.
We can deploy the Java Application archives (jar, war, ear) manually two ways:
. Using Glassfish Admin Console using its URL
Default URL: http://localhost:4848
The other new way is
. Using Command Line Interface (CLI) - "asadmin"
"asadmin" - is a command line tool available in the glassfish server installation folder
under the domain directory
Example:
In Windows
c:/glassfish/domain/domain1/
In Linux
/home/dinesh/glassfish/domain/domain1/
Functions of asadmin:
. we can perform all the functions that are available through a glassfish server admin
console
. Inorder to do operations on application server, first we need to start the domain
using the command ----> start-domain
asadmin> start-domain
We will see the following message if the domain is started successfully:
Waiting for domain1 to start .............................................
Successfully started the domain : domain1
domain Location: /home/dinesh/Downloads/JavaDownloads/GlassFish_Server/glassfish/domains/domain1
Log File: /home/dinesh/Downloads/JavaDownloads/GlassFish_Server/glassfish/domains/domain1/logs/server.log
Admin Port: 4848
Command start-domain executed successfully.
Some of useful commands of asadmin:
To start and stop the glassfish application server domain:
. <start-domain>
. <stop-domain>
To deploy and undeploy an application archive - jar, war, ear.
. <deploy>
. <undeploy>
eg:
asadmin> deploy /home/dinesh/example.jar
asadmin> undeploy /home/dinesh/example.war
To see the list of the already deployed applications.
. <list-components>
eg:
asadmin> list-components
To create jdbc connection pool
. <create-jdbc-connection-pool>
eg:
asadmin> create-jdbc-connection-pool
--datasourceclassname com.mysql.jdbc.jdbc2.optional.MysqlDataSource
--restype javax.sql.DataSource
--property portNumber=3306:user=root:password=root:
serverName=localhost:databaseName=mydatabase sample_mysql_pool
Command create-jdbc-connection-pool executed successfully.
To test the created jdbc connection pool use:
. <ping-connection-pool>
eg:
asadmin> ping-connection-pool sample_mysql_pool
Command ping-connection-pool executed successfully.
To create jdbc resource using the above created jdbc connection pool.
. <create-jdbc-resource>
eg:
asadmin> create-jdbc-resource --connectionpoolid sample_mysql_pool jdbc/SampleDS
Command create-jdbc-resource executed successfully.
asadmin is also used to create jms resources, java mail resources and many more commands are used in real-time.
. <create-jms-host>
. <create-jms-resource>
. <create-jmsdest>
. <create-jndi-resource>
Note:
Glassfish is a reference implementation, created by JCP Team.
We can deploy the Java Application archives (jar, war, ear) manually two ways:
. Using Glassfish Admin Console using its URL
Default URL: http://localhost:4848
The other new way is
. Using Command Line Interface (CLI) - "asadmin"
"asadmin" - is a command line tool available in the glassfish server installation folder
under the domain directory
Example:
In Windows
c:/glassfish/domain/domain1/
In Linux
/home/dinesh/glassfish/domain/domain1/
Functions of asadmin:
. we can perform all the functions that are available through a glassfish server admin
console
. Inorder to do operations on application server, first we need to start the domain
using the command ----> start-domain
asadmin> start-domain
We will see the following message if the domain is started successfully:
Waiting for domain1 to start .............................................
Successfully started the domain : domain1
domain Location: /home/dinesh/Downloads/JavaDownloads/GlassFish_Server/glassfish/domains/domain1
Log File: /home/dinesh/Downloads/JavaDownloads/GlassFish_Server/glassfish/domains/domain1/logs/server.log
Admin Port: 4848
Command start-domain executed successfully.
Some of useful commands of asadmin:
To start and stop the glassfish application server domain:
. <start-domain>
. <stop-domain>
To deploy and undeploy an application archive - jar, war, ear.
. <deploy>
. <undeploy>
eg:
asadmin> deploy /home/dinesh/example.jar
asadmin> undeploy /home/dinesh/example.war
To see the list of the already deployed applications.
. <list-components>
eg:
asadmin> list-components
To create jdbc connection pool
. <create-jdbc-connection-pool>
eg:
asadmin> create-jdbc-connection-pool
--datasourceclassname com.mysql.jdbc.jdbc2.optional.MysqlDataSource
--restype javax.sql.DataSource
--property portNumber=3306:user=root:password=root:
serverName=localhost:databaseName=mydatabase sample_mysql_pool
Command create-jdbc-connection-pool executed successfully.
To test the created jdbc connection pool use:
. <ping-connection-pool>
eg:
asadmin> ping-connection-pool sample_mysql_pool
Command ping-connection-pool executed successfully.
To create jdbc resource using the above created jdbc connection pool.
. <create-jdbc-resource>
eg:
asadmin> create-jdbc-resource --connectionpoolid sample_mysql_pool jdbc/SampleDS
Command create-jdbc-resource executed successfully.
asadmin is also used to create jms resources, java mail resources and many more commands are used in real-time.
. <create-jms-host>
. <create-jms-resource>
. <create-jmsdest>
. <create-jndi-resource>
Note:
Glassfish is a reference implementation, created by JCP Team.
Please refer to glassfish reference manual for more concepts:
useful links: glassfish reference - > asadmin commands
useful links: glassfish reference - > asadmin commands


No comments:
Post a Comment