Saturday, June 1, 2013

GlassFish

Glassfish v 4 requires java 7
  1. glassfish/config/asenv.bat [set AS_JAVA=C:\YYY\java\jdk1.7.0_51]
  2. glassfish/config/asenv.conf [AS_JAVA=C:\YYY\java\jdk1.7.0_51]
  3. An alternative to setting the AS_JAVA variable is to set JAVA_HOME environment variable to the jdk
  4. set JAVA_HOME=C:\YYY\java\jdk1.7.0_51
Restart the GlassFish domain server and any other server instances you might have:
  1. C:\CCC\netbeans\glassfish4\bin\asadmin stop-local-instance
  2. C:\CCC\netbeans\glassfish4\bin\asadmin stop-domain domain1
  3. C:\CCC\netbeans\glassfish4\bin\asadmin start-domain domain1
  4. C:\CCC\netbeans\glassfish4\bin\asadmin start-local-instance 
  5. asadmin start-domain [--verbose]
C:\CCC\netbeans\glassfish4\bin>asadmin version
asadmin enable-secure-admin
asadmin restart-domain
asadmin undeploy hello
# In order to save typing "admin user name" and "password" every time you deploy or undeploy an application, create a password file pwdfile with content:
AS_ADMIN_PASSWORD=your_admin_password
--
Add --passwordfile in command: [asadmin --passwordfile pwdfile deploy /home/ee/glassfish/sample/hello.war]

as-install/bin/asadmin list-domains [List all domains]

Before you start database, atleast one domain to be running:
$ asadmin start-database
$ as-install/bin/asadmin start-database --dbhome directory-path
$ as-install/bin/asadmin start-database --dbhome as-install-parent/javadb [to start javadb]
$ as-install/bin/asadmin stop-database [stop database]


$ as-install/bin/asadmin deploy war-name [as-install/bin/asadmin deploy sample-dir/hello.war]
http://localhost:8080/hello
$ as-install/bin/asadmin list-applications
$ as-install/bin/asadmin undeploy war-name [as-install/bin/asadmin undeploy hello]

Automatically Deploy: copy application to as-install/domains/domain1/autodeploy
[Unix:] cp sample-dir/hello.war as-install/domains/domain-dir/autodeploy
[windows: ] copy sample-dir\hello.war as-install\domains\domain-dir\autodeploy
Undeploy:
 $ cd as-install\domains\domain-dir\autodeploy
$ rm hello.war [unix] or $ del hello.war (windows)

admin default password : adminadmin

At least one GlassFish Server domain must be started before you start the database server.
as-install/bin/asadmin start-database --dbhome directory-path
as-install/bin/asadmin start-database --dbhome as-install-parent/javadb
as-install/bin/asadmin stop-database

Changing Default GlassFish v3 Prelude Port Numbers 4848, 8080, and 8181
When you install GlassFish, it gives you default port numbers of:
  1. 4848 (for administration)
  2. 8080 (for the HTTP listener)
  3. 8181 (for the HTTPS listener)
Here are some examples that work in GlassFish v3 Prelude:
  1. To change the HTTP port to 10080: asadmin set server.http-service.http-listener.http-listener-1.port=10080
  2. To change the HTTPS port to 10443:asadmin set server.http-service.http-listener.http-listener-2.port=10443
  3. To change the administration server port to 14848: asadmin set server.http-service.http-listener.admin-listener.port=14848
  4. It's handy to know you can grep for server properties in GlassFish v3 Prelude as follows:
    1. asadmin get server | grep listener
  5. In GlassFish v3 Prelude, you can set port numbers for administration and the HTTP listener in the installer - but not for the HTTPS listener. You might find yourself needing to explicitly specify the administration port in your asadmin command. For example:
    1. $ asadmin set --port 14848 server.http-service.http-listener.http-listener-2.port=10443
    2. For GlassFish v2, use the asadmin get command as described here.

No comments:

Post a Comment