GlassFish and MySQL bundle

GlassFish and MySQL bundle was released a while ago and I finally got a chance to try it out. Here are simple instructions to get you started:
  1. Download GlassFish and MySQL co-bundle zip from here.
  2. Install the bundle (detailed docs)
    1. Create a temp directory and unzip the contents of bundle there. The contents are:

      -rw-r--r--   1 arungupta  arungupta   239703 Mar 19 02:57 3RD-PARTY-LICENSE.txt
      -rw-r--r--   1 arungupta  arungupta      709 Mar 19 02:57 LICENSE.txt
      -rw-r--r--   1 arungupta  arungupta  1560195 Mar 19 02:57 appserv.class
      drwxr-xr-x  18 arungupta  arungupta      612 Mar 19 02:57 package
      -rwxr-xr-x   1 arungupta  arungupta     5577 Mar 19 02:57 setup
    2. Invoke "setup" script that brings up the installer. Take the default value, click "Next", accept the license, click "Next" and specify the install directory location as shown below:

    3. If the directory is not created, then click on "Create Directory" button. Enter the administrator password and click on "Don't Prompt for Admin User Name and Password" as shown below:

      These are not the typical values used in a production system.
    4. Take the default values for MySQL as shown below:

      and click on "Next".
    5. Once the final options are shown, click on "Install Now" button to start the install process:

      and see the install in progress as shown below:

    6. It's recommended to Regiser the recently installed copy of Application Server, the benefits are highlighted here. After registration, click on "Next" and then on "Finish" to complete the installation process.
    7. The directory structure after completed installation looks like:

      drwxr-xr-x  22 arungupta  arungupta       748 Aug 10 16:23 .
      drwxr-xr-x   5 arungupta  arungupta       170 Aug 10 16:22 ..
      -rw-r--r--   1 arungupta  arungupta    239703 Aug 10 16:23 3RD-PARTY-LICENSE.txt
      -rw-r--r--   1 arungupta  arungupta      4149 Aug 10 16:23 COPYRIGHT
      -rw-r--r--   1 arungupta  arungupta      2126 Aug 10 16:23 Install_Application_Server_9PE_200808101622.log
      -rw-r--r--   1 arungupta  arungupta       709 Aug 10 16:23 LICENSE.txt
      -rw-r--r--   1 arungupta  arungupta  20025392 Aug 10 16:23 License_Notice_Translated.pdf
      -rw-r--r--   1 arungupta  arungupta       186 Aug 10 16:23 Sun_Java_System_Application_Server_install.A08100423
      -rw-r--r--   1 arungupta  arungupta    191191 Aug 10 16:23 Sun_Java_System_Application_Server_install.B08100423
      -rw-r--r--   1 arungupta  arungupta   1569911 Aug 10 16:23 appserv_uninstall.class
      drwxr-xr-x  17 arungupta  arungupta       578 Aug 10 16:23 bin
      drwxr-xr-x   4 arungupta  arungupta       136 Aug 10 16:23 config
      drwxr-xr-x   9 arungupta  arungupta       306 Aug 10 16:23 docs
      drwxr-xr-x   3 arungupta  arungupta       102 Aug 10 16:23 domains
      drwxr-xr-x  11 arungupta  arungupta       374 Aug 10 16:23 imq
      drwxr-xr-x   9 arungupta  arungupta       306 Aug 10 16:23 javadb
      drwxr-xr-x  14 arungupta  arungupta       476 Aug 10 16:23 jbi
      drwxr-xr-x  65 arungupta  arungupta      2210 Aug 10 16:23 lib
      drwxr-xr-x  19 arungupta  arungupta       646 Aug 10 16:23 mysql
      drwxr-xr-x   6 arungupta  arungupta       204 Aug 10 16:23 samples
      -rwxr-xr-x   1 arungupta  arungupta      4717 Aug 10 16:23 uninstall
      drwxr-xr-x  14 arungupta  arungupta       476 Aug 10 16:23 updatecenter
  3. Configure MySQL
    1. In "mysql" directory, change the permissions of "configure" and "scripts/mysql_install_db" script by invoking

      chmod +x configure scripts/mysql_install_db
    2. Then invoke "configure" script to see the output as:

      ~/tools/glassfish/v2/SUNWappserver/mysql >./configure
      NOTE: This is a MySQL binary distribution. It's ready to run, you don't
      need to configure it!

      To help you a bit, I am now going to create the needed MySQL databases
      and start the MySQL server for you.  If you run into any trouble, please
      consult the MySQL manual, that you can find in the Docs directory.

      Installing MySQL system tables...
      080810 16:39:16 [Warning] Setting lower_case_table_names=2 because file system for /Users/arungupta/tools/glassfish/v2/SUNWappserver/mysql/data/ is case insensitive
      Filling help tables...
      080810 16:39:16 [Warning] Setting lower_case_table_names=2 because file system for /Users/arungupta/tools/glassfish/v2/SUNWappserver/mysql/data/ is case insensitive

      To start mysqld at boot time you have to copy
      support-files/mysql.server to the right place for your system

      To do so, start the server, then issue the following commands:
      ./bin/mysqladmin -u root password 'new-password'
      ./bin/mysqladmin -u root -h Macintosh-187.local password 'new-password'

      Alternatively you can run:

      which will also give you the option of removing the test
      databases and anonymous user created by default.  This is
      strongly recommended for production servers.

      See the manual for more instructions.

      You can start the MySQL daemon with:
      cd . ; ./bin/mysqld_safe &

      You can test the MySQL daemon with
      cd mysql-test ; perl

      Please report any problems with the ./bin/mysqlbug script!

      The latest information about MySQL is available on the web at
      Support MySQL by buying support/licenses at
      Starting the mysqld server.  You can test that it is up and running
      with the command:
      ./bin/mysqladmin version
      ~/tools/glassfish/v2/SUNWappserver/mysql >chown: /Users/arungupta/tools/glassfish/v2/SUNWappserver/mysql/data/Macintosh-187.local.err: Operation not permitted
      Starting mysqld daemon with databases from /Users/arungupta/tools/glassfish/v2/SUNWappserver/mysql/data

      This configures and starts MySQL process as well. As mentioned in the command output, MySQL server running can be cofirmed by giving the command "./bin/mysqladmin version". It shows the following output on my machine:

      ~/tools/glassfish/v2/SUNWappserver/mysql >./bin/mysqladmin version
      ./bin/mysqladmin  Ver 8.41 Distrib 5.0.51a, for apple-darwin8.6.0 on powerpc
      Copyright (C) 2000-2006 MySQL AB
      This software comes with ABSOLUTELY NO WARRANTY. This is free software,
      and you are welcome to modify and redistribute it under the GPL license

      Server version          5.0.51a
      Protocol version        10
      Connection              Localhost via UNIX socket
      UNIX socket             /tmp/mysql.sock
      Uptime:                 2 min 22 sec

      Threads: 1  Questions: 1  Slow queries: 0  Opens: 12  Flush tables: 1  Open tables: 6  Queries per second avg: 0.007

      MySQL daemon can always be restarted as:

      ~/tools/glassfish/v2/SUNWappserver/mysql >./bin/mysqld_safe
      Starting mysqld daemon with databases from /Users/arungupta/tools/glassfish/v2/SUNWappserver/mysql/data
  4. Register GlassFish and MySQL with NetBeans
    1. Installing GlassFish is straight-forward - Just go to NetBeans IDE, "Services" tab, "Services" tree, right-click and select "Add Server..." as shown:

      and then follow the directions.
    2. To configure MySQL, right-click on "Databases" tree and select "Register MySQL Server ..." as shown (official docs):

    3. Take the default values in "Basic Properties" and specify the properties in "Admin Properties" tab as:

    4. Starting MySQL server from the command gives "Permission Denied" access. So I started MySQL server from command-line as shown above and then could see all the databases as shown below:

      Alternatively, you can also download NetBeans 6.1 with GlassFish and MySQL Bundle where both GlassFish and MySQL are pre-configured for you.
Now you can leverage this deadly combination of NetBeans, GlassFish and MySQL to create any enterprise application.

There are many related blog entries on this topic as well:

Technorati: glassfish mysql netbeans

Hi arun. You may want to also add Alexis [1] entry to your list


Posted by Eduardo Pelegri-Llopart on August 11, 2008 at 01:31 AM PDT #

Hi, Arun. The permission denied problem in NetBeans can be worked around by making the "Path to start command" be the full path to gksu, whatever it is on your system, and then make the "Arguments" be the path to mysqld_safe.

Also, FYI, the next bundle of MySQL with NetBeans will come with the start and stop commands preconfigured.

Posted by David Van Couvering on August 11, 2008 at 02:53 AM PDT #

Eduardo, thanks for the pointer, now added!

Posted by Arun Gupta on August 11, 2008 at 03:55 AM PDT #

David, I entered the path to sudo and mysqld_safe in arguments. But that shows "Password:" prompt in output console and not taking inputs. How do I enter the sudo password ?

Posted by Arun Gupta on August 11, 2008 at 03:58 AM PDT #

Post a Comment:
Comments are closed for this entry.

profile image
Arun Gupta is a technology enthusiast, a passionate runner, author, and a community guy who works for Oracle Corp.

Java EE 7 Samples

Stay Connected


« July 2016