Miles to go …

September 30, 2009

TOTD #107: Connect to Oracle database using NetBeans

Filed under: General — arungupta @ 11:32 am

TOTD #106 explained how to install Oracle database 10g R2 on Mac OS X. This Tip Of The Day will explain how to connect Oracle database with NetBeans to leverage all the goodness provided by NetBeans for Java EE application development, Rails, and others.

  1. Download Oracle JDBC Drivers, specifically ojdbc14.jar. (ojdbc6.jar is recommended to be used with GlassFish v3).
  2. Using NetBeans 6.8 M1, in Services tab, right-click on "Databases" and select "New Connection…" as shown:

  3. Expand "Name:" and select "New Driver…":

  4. Click on "Add…" and choose the recently downloaded JDBC driver JAR file as shown below:

    and click on "OK".

  5. Enter the database values as shown below:

    The password is "hr" for the sample HR database. Clicking on "Show JDBC URL" also shows the complete JDBC URL. Click on "OK".

    You may have to unlock the "hr" user by giving the command:


    as explained in TOTD #106.

  6. Select the "HR" schema as shown below:

    and click on "OK". The complete list of schemas is now shown in the "Databases" node as shown below:

  7. Expand the "HR" node and the complete list of tables is visible now:

    Expanding each table shows you the complete definition as shown:

  8. Right-click on "COUNTRIES" table and select "View Data…"

    and the result is shown as:

    Additionally, you can execute any SQL command by selecting "Execute Command…":

A complete archive of all the TOTDs is available here.

Subsequent blogs will show how to write a Java EE application to access the Oracle database.

Technorati: totd oracle database netbeans

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • Facebook
  • Google Bookmarks
  • DZone
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

September 28, 2009

TOTD #106: How to install Oracle Database 10g on Mac OS X (Intel) ?

Filed under: General — arungupta @ 11:32 pm

This Tip Of The Day (TOTD) will explain how to install Oracle Database 10g on Mac OS X.

The official documentation is available here and is very well suited for folks with lots of time and patience. But all I wanted was to install Oracle database server up & running on my localhost so that I can start experimenting with it. All my previous entries have used either JavaDB or MySQL so far, but it’s about time ;-)

I started preparing a brief tutorial after following the lengthy documentation but then found this excellent blog entry. And realized the content is looking exactly similar :-) Anyway, below are the instructions I followed and additionally also provide a snapshot of the installer windows.

For the brave of heart, complete installation guide is available in HTML and PDF. Read on for an abbreviated, and yet working version, of the instructions.

  1. Download Oracle database 10g R2 ( from here and unzip.
  2. Check hardware/software requirements. (10.5.4+ required)
  3. Create required groups/users (complete details):
    1. Create Oracle inventory group as:

      # dscl . -create /groups/oinstall
      # dscl . -append /groups/oinstall gid 100
      # dscl . -append /groups/oinstall passwd "*"
    2. Create Oracle software owner as:
      # dscl . -create /users/oracle
      # dscl . -append /users/oracle uid uid_number
      # dscl . -append /users/oracle gid oinstall_gid
      # dscl . -append /users/oracle shell /bin/bash
      # dscl . -append /users/oracle home /Users/oracle
      # dscl . -append /users/oracle realname "Oracle software owner"
    3. Create the home directory for Oracle user as:
      # mkdir /Users/oracle
      # chown oracle:oinstall /Users/oracle
    4. Set the password for Oracle user:
      # passwd oracle
  4. Configure kernel parameters (complete details) by editing "/etc/sysctl.conf" and adding the contents:

    and reboot the machine for these parameters to take effect.

  5. Configure Oracle user’s environment (complete details). In the "oracle" user’s home directory, create ".bash_profile" and add the following lines:
    export DISPLAY=:0.0
    export ORACLE_BASE=$HOME
    export ORACLE_SID=orcl
    umask 022
    ulimit -Hn 65536
    ulimit -Sn 65536
  6. The "Basic Installation" of "Standard Edition" in an "Interactive" mode can be performed using the "Oracle Universal Installer". This installer is invoked using the script "db/Disk01/runInstaller" (complete details). The screen snapshots are shown below:

    Choose "oracle" as the database password for simplicity.

    and finally click on "Install" to begin the installation.

    Click on "Password Management…" to unlock the sample database user …

    The output of these scripts look like:

    ~ > sudo /Users/oracle/oraInventory/
    Changing permissions of /Users/oracle/oraInventory to 770.
    Changing groupname of /Users/oracle/oraInventory to oinstall.
    The execution of the script is complete


    ~ > sudo /Users/oracle/product/10.2.0/db_1/
    Running Oracle 10g script ...
    The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME= /Users/oracle/oracle/product/10.2.0/db_1
    Enter the full pathname of the local bin directory: [/usr/local/bin]:
    Copying dbhome /usr/local/bin ...
    Copying oraenv to /usr/local/bin ...
    Copying coraenv to /usr/local/bin ...
    Creating /etc/oratab file...
    Entries will be added to the /etc/oratab file as needed by
    Database Configuration Assistant when a database is created
    Finished running generic part of script.
    Now product-specific root actions will be performed.

    Click on "Installed Products…" to see the list of Oracle products installed.

  7. There are some more steps before you can start the Oracle listener process.
    1. Edit ".bash_profile" of "oracle" user and add the following settings:
      export ORACLE_HOME=/Users/oracle/oracle/product/10.2.0/db_1
      export PATH=$PATH:$ORACLE_HOME/bin

      Not setting DYLD_LIBRARY_PATH gives the following error:

      ~ oracle$ lsnrctl start
      dyld: Library not loaded: /b/227/network/lib/libnnz10.dylib
      Referenced from: /Users/oracle/oracle/product/10.2.0/db_1/bin/lsnrctl
      Reason: image not found
      Trace/BPT trap

      This was not obvious but Googling helped. Make sure to relogin for these changes to take effect.

    2. If your Mac is using DHCP (most likely) then you may see the error shown below:
      ~ oracle$ lsnrctl start
      LSNRCTL for MacOS X Server: Version - Production on 28-SEP-2009 14:48:49
      Copyright (c) 1991, 2007, Oracle.  All rights reserved.
      Starting /Users/oracle/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...
      TNSLSNR for MacOS X Server: Version - Production
      System parameter file is /Users/oracle/oracle/product/10.2.0/db_1/network/admin/listener.ora
      Log messages written to /Users/oracle/oracle/product/10.2.0/db_1/network/log/listener.log
      Error listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dhcp-usca14-133-197.SFBay.Sun.COM)(PORT=1521)))
      TNS-12545: Connect failed because target host or object does not exist
      TNS-12560: TNS:protocol adapter error
      TNS-00515: Connect failed because target host or object does not exist
      MacOS X Server Error: 49: Can't assign requested address
      Listener failed to start. See the error message(s) above...

      This error occurs because your MacBook may be running on a different IP address if rebooted after the installation and before starting the server. Fortunately, the error message is very intuitive and it’s easy to fix the error by editing "$ORACLE_HOME/network/admin/listener.ora" as shown below:

      # listener.ora Network Configuration File: /Users/oracle/oracle/product/10.2.0/db_1/network/admin/listener.ora
      # Generated by Oracle configuration tools.
      (SID_LIST =
      (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = /Users/oracle/oracle/product/10.2.0/db_1)
      (PROGRAM = extproc)
         (SID_DESC =
      (SID_NAME = orcl)
      (ORACLE_HOME = /Users/oracle/oracle/product/10.2.0/db_1)
      LISTENER =
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))

      The changes are highlighted in the bold. Basically, add a new SID referring to "orcl". And for DHCP users the value of HOST key needs to be changed from dynamically assigned IP address to "localhost". Strangely, the Installing on DHCP Computers section of the installation guide says nothing about it :(

    3. Additionally, for DHCP users, you need to change "$ORACLE_HOME/network/admin/tnsnames.ora" as:
      # tnsnames.ora Network Configuration File: /Users/oracle/oracle/product/10.2.0/db_1/network/admin/tnsnames.ora
      # Generated by Oracle configuration tools.
      ORCL =
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
      (SERVICE_NAME = orcl)

      The changes are highlighted in bold. And here as well change the value of HOST key to "localhost".

  8. And finally, start the database using SQL*Plus as:
    ~ oracle$ sqlplus "/ as sysdba"
    SQL*Plus: Release - Production on Mon Sep 28 17:44:40 2009
    Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.
    Connected to an idle instance.
    SQL> startup nomount
    ORACLE instance started.
    Total System Global Area  612368384 bytes
    Fixed Size                  2085872 bytes
    Variable Size             167775248 bytes
    Database Buffers          436207616 bytes
    Redo Buffers                6299648 bytes
    SQL> alter database mount;
    Database altered.
    SQL> alter database open;
    Database altered.
    User altered.
    SQL> exit
    Disconnected from Oracle Database 10g Release - Production

    The last step of unlocking the account should not be required because we explicitly unlocked the account during installation but that apparently didn’t work. And I hit ORA-01033, ORA-01034, ORA-12514, ORA-12541, ORA-12547, and ORA-27101 trying different combinations to get the app working.

    Anyway now re-connect to the HR sample database as:

    ~ oracle$ sqlplus hr/hr@orcl
    SQL*Plus: Release - Production on Mon Sep 28 17:46:19 2009
    Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.
    Connected to:
    Oracle Database 10g Release - Production
    SQL> select table_name from user_tables;
    7 rows selected.
    SQL> desc regions;
    Name                                      Null?    Type
    ----------------------------------------- -------- ----------------------------
    REGION_ID                                 NOT NULL NUMBER
    REGION_NAME                                        VARCHAR2(25)
    SQL> select * from regions;
    ---------- -------------------------
    1 Europe
    2 Americas
    3 Asia
    4 Middle East and Africa

    Note: If the database is not shutdown properly then it can be forced to do so using the command "shutdown abort" using SQL*Plus.

A complete archive of all the tips is available here.

Technorati: totd oracle database mac osxtips leopard installation

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • Facebook
  • Google Bookmarks
  • DZone
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

September 24, 2009

Q&A Transcript from “Develop, Deploy, and Scale your Rails app with GlassFish” webinar

Filed under: General — arungupta @ 10:37 am

I delivered a "Develop, Deploy, and Scale your Rails app on GlassFish" webinar earlier today. There were over 300 unique attendees. A complete replay of the webinar is available at

Many thanks to all the attendees for showing their interest in the technology and the panelists who relentlessly answered all the questions. The demos shown are available at:

An edited transcript of the Q&A session is available below. All the names have been removed for privacy reasons.

Q: I took leave from office to attend ur seession..:)
A: Thanks a lot, hopefully you’ll enjoy it :)

Q: Is Rails an abbreviation?

Q: can you explain the difference b/t jruby and ruby
A: Ruby is a language and it’s original interpreter is written in C. JRuby is pure Java based Ruby interpreter.

Q: What are the added benefits of installing JRuby on Glassfish – in compared to having it always in Rails app WAR?
A: What you get is the Ruby way of developing apps, code-save-refresh or agile experience

Q: Is it true on GF v2.1 as well – since the Rails app will anyway have to be packaged in a war?
A: On glassfish v2.x only WAR style Rails deployment is supported.

Q: Can I run existing rails application on GlassFish?
A: Yes. sure.

Q: is there support for rails 2.3.2? having trouble getting glassfish to run anything higher than 2.2.x
A: Yes, it is there.
A: Please send an email to dev@glassfish with your issue, we would be happy to help you

Q: what additional config is rerquired to support rails?
A: checkout

Q: what I really was after is this: what is the difference of including JRuby (and dependent gems) inside your app war in compared to installing JRuby on GF and having only your own app in the war?
A: When you go in to production , you freeze your gems with app. The thing with glassfish v3 is that you can deploy rails app as WAR as well as directory deployment

Q: on jboss, i have to patch activerecord to use jndi style datasources. is that necessary on glassfish, too ?
A: No, you dont need to.

Q: do you have easy to follow lessons or tutorial for user to try a small real workable application to repeat what you are talking about from your website?
A: Check out checkout

Q: y glass fish used only in java
A: GlassFish is a Java EE App Server

Q: Does Glassfish still have the PermGem out of memory issue when you deploy and undeploy applications.
A: There is a reasonable default setting for PermGen in Glassfish but it depends on your app. You can always set the PermGen to higher value
A: We have run significant number of tests to address this issue. If you do run into it, please let us know by sending an email to dev@glassfish

Q: what is mean by rails

Q: what is jruby?
A: Pure Java based Ruby interpreter. Checkout

Q: what if i have glassfishv2 installed? is there any problem to install jruby gem glassfish?
A: GlassFish gem can be installed in an existing JRuby installation only. For GlassFish v2, Rails applications can only be deployed as WAR file.

Q: so the PermGen out of memory issue is supposedly fixed in Glassfish v3? Or should be fixed also in Glassfish v2.1?
A: when you start JVM there is PermGen space, scripting language interpreteres such as JRuby require higher perm gen. You just need to set it accordingly

Q: This may be a little off topic, but what are the Cons of using JRuby and glassfish? Because everything I’ve read is great
A: There might be some ruby gems that have native extensions that do not work on JRuby. Having said that, most of the ruby gems that we come across at work on JRuby just fine.

Q: on jboss, serveral jruby runtimes are added. same thing on glassfish ?
A: yes. you can configure the jruby runtime pool. See

Q: so why doesn’t everyone use Jruyb? (over ruby MRI?)
A: Its a choice and really depends on personal preference. BTW as a datapoint, hosting company such as has jruby based Ruby/Rails hosting

Q: is this presentation only for mac users? I am a bit shocked with this OSX desktop. I was hoping seeing some Opensolaris etc.
A: No, it is not only for mac users

Q: does glassfish v3 already support cluster profiles?
A g>: glassfish v3 does not support clustering

Q: i always asked myself if the multiple jruby runtimes write to the same log file.
A: yes they do.

Q: so do you know when (in which release) will the clustering support be added to glassfish v3?
A: It is planned for glassfish v3.1.

Q: apart from glass fish any other server supports
A: mongrel, web rick work on jruby just fine.

Q: can we get support for jruby on jrails on glassfish?
A: Yes you can.
A: Sid, for details on GlassFish subscription support options, please email glassfish

Q: yeah I saw that, a great option I think. I’m just at a state where I can pick either Ruby or JRuby, and JRuby seems far superior and can’t really see any of it’s fautls
A: yeah, pick JRuby!

Q: Does Ruby create for us the basic GUI for each table?
A: It’s Rails that is creating the basic GUI for each table.

Q: why doesn’t glassfish support clustering
A: GlassFish v2.1 supports clustering and can be run in production environment.

Q: apart from glass fish any other server supports j2ee
A: Which version of EE are you talking about?

Q: 1.6
A: 1.6 is not final yet, so glassfish is the only implementation of EE6 right now

Q: can you please email me the presentaion slides?
A: Please see – the slides maybe there.

Q: i heard that apache and tomcat server not used for j2ee? is it so?
A: Tomcat implements a subset of the Java EE specifications. It is not a fully compliant Java EE server. GlassFish is fully compliant (it’s the reference implementation)

Q: We’ve been having some issues running Capistrano under JRuby on cygwin — it gets confused about whether it’s in a Windows or Unix-like environment. Any tips?
A: Could be cygwin issue? If not please report with details to [email protected]

Q: What is Rail Application
A: Check out for more details.

Q: sometimes, you might want to define a dedicated log file per deployed app. jboss logs everything to server.log by default. is it possible to define a dedicated log per app on glassfish
A: I dont have an answer to this, you may like to bring this question to [email protected]
A: I still dont see why this would an issue. As long as your logs shifts correctly and there is no locking etc. it should be fine. BTw, in production you limit your log anyway to severe error for perf reasons.

Q: so what’re the benefits of using the glassfish gem versus mongrel or thin?
A: High performance, jruby runtime pool, daemon mode etc.

Q: Is the v3 Glassfish gem considered to be production ready?
A: Many users that I know already use in production.

Q: nginx or apache is recommended? can glassfish act as the comlete server?
A: GlassFish v3 does not support clustering. It will be coming up in a future release. So you may like to use squid or nginx etc to scale your app

Q: this update is shown how it is updated on mac OSX?
A: Update Center works on all platforms

Q: i’m new to glass fish beacuse i’m just a student….any websites or links that which makes 2 gain more knowledge on it…..
A: can lead you to more details

Q: hey i missed the earlier part of this presentation..!
A: You can look at the recorded session later

Q: what is the built-in web server in glassfish used in the demo? wht would i use apache?
A: grizzly + v3 kernel+ jruby container. You can use Apache to front-end a bunch of GlassFish instances running at the backend.

Q: how to add extra gems in directrory-based deployment?
A: Just how you would use with any Rails app. gem install ‘your gem’

Q: this is off the topic, is v3 glassfish going to implement directory based deployment for grails?
A: GlassFish embedded is in works and yes in will support grails directory deployment or ‘grails run-app’

Q: Is there a major performance difference between the gem and the standalone war-style deployments?
A: Not much, With glassfish gem or glassfish v3 directory deployment, you are serving the requests at pretty low level. With war deployment its served by the web container

Q: in net beans only glassfish sever is implemented?if any other severs r there in net beans what are they…..
A: There are many other servers supported by NetBeans

Q: can i get the replay after the webinar?
A: Yes, the recorded session will be posted later at

Q: in my company, we use a jboss / jruby / oracle setup. we have issues with newer version activerecord-jdbcadapter (> 8.1.0). is this a known problem ?
A: No idea, consider switching to GlassFish as it works fine there :)

Q: ok, so how does glassfish handle updating the source for your rails app? will it fulfill existing requests and smoothly ‘seesaw’ to updated instances? …or does it just drop everything, redeploy and start over?
A: The experience is what you will get on native/MRI Ruby/Rails. glassfish embeds jruby using its internal API and rest is all Rails.

Q: so are gems pre packages apps to deploy?
A: think of gem like packages for Ruby/JRuby platforms.

Q: Please send me a link where I can retrieve the replay of this audio and presentation coz the buffering is really disturbed out here..
A: – recording of this session will be made available

Q: Regarding java gc/memory flags, is there a recommended set of flags for optimal glassfish performance
A: has a White Paper that shows how to tune GF. Although if you get the supported version, you get an add-on called Enterprise manager that can tune the server automatically.

Q: where will jruby be located when I install Jruby glassfish admin web page?
A: glassfish-install-dir/glassfish/jruby

Q: can I use Netbeans to set up my JRuby on Rails app and Glassfish server, but then use another editor or cmd prompt to edit/add to my app?
A: yes you can, although NetBeans provide a functionally complete IDE and serves all your needs.

Q: You are assuming that your server can access the internet. For example, to get the glassfish and Ruby and all upgrades and updates your update program gets the items from your server there on the internet. A secure vault does not have access to the intern
A: True. But you can prepackage everything.

A: GlassFish runs on java.

Q: is it possible to somehow change the rails.env setting _after_ a WAR has been generated? Or does it always require re-warblerizing?
A: warble config; edit config/warble.config to change. Otherwise export RAILS_ENV=production

Q: How would you debug if you packaged the Rails app as a warfile?
A: Thats an issue with the WAR based deployment. You should use directory deployment, specially for your development.

Q: all the server and application for jruby, integration also work on Windows XP professional?
A: Yes, it should work on Windows XP

Q: so jruby is really ready for primetime? good compatibility with existing gems and plugins?
A: yes it is.

Q: A different take on my blog post of the same topic
A: thanks!

Q: Who is the best person to talk to about Grizzly failing to handle multi-part posts in a jruby rails app?
A: Please send email to dev@glassfish. Vivek Pandey is the lead for scripting in GlassFish

Q: are there any supports for pre-compiling ruby code to java byte code?
It would be great if I can hide my ruby code when I release my apps as war.
A: I know there is some jruby option that lets you do it. Either check on or post it to users@jruby or #jruby on irc

Q: while we are using netbeans no problem because servers are inbuilt in the netbeans itself while we usin the ordinary notepad how the servers are to be implemented
A: I do not understand what you mean by implementing a server. A server implemention is implementing to the JavaEE spec. I assume you mean deploying on a server

Q: can anyother scripts can be used instead of javascript
A: Not yet. Ruby and groovy will be coming out in a future release

Q: is it possible to get access to the glassfish admin console using the gem?
A: Sorry, not yet.

Q: so NewRelic is jruby and glassfish compatible?
A: yep

Q: is there any way I can monitor server.log in glassfish admin web interface?
A: – See bottom of URL.

Q: what is the preferred hardware for jruby and rails ? our experience is: sparc is slow and 86based sun hardware is fast for jruby
A: Not required but dual core or higher means better performance

Q: it is possible to implemet content management and ERP application with glassfish and has SUN such applications?
A: We know users deploying Ruby/Rails apps in OpenESB or in SOA env. For ERP or other content management system, as long as you can run these on Glassfish you can surely host Ruby aps there as well

Q: do you have the recommendation for jruby on rails book and good glassfish book?
A: There are several GlassFish books as listed at: Practical JRuby on Rails is a nice book as well (

Q: Does Eclipse incorporate Ruby as NetNeans?
A: Both Eclipse and NetBeans are IDEs. Both support ruby development

Q: any other new servers r gonna compatible with glassfish
A: Once EE6 is final many other application servers will work towards being compatible with EE6

Q: what is the difference in case of performance between standlone war style deployement and gem deployement
A: Not much. gem will give you faster development cycle, easier deployment beside being very light weight (4MB) vs for WAR you need full server.

Q: is there any other IDE which supports ruby dev
A: Not integrated deployment and server side debugging. You can develop Ruby app on IDEA/Aptna studio etc. Typicaly you just need vi or text mate etc.

Q: why can’t i run a project developed in netbeans 6.1 on netbeans 6.5
A: Please send an email to the netbeans forum

Q: can I deploy any ruby app I find on jruby?
A: JRuby 1.3.1 is 1.8.6 compliant and going to be using 1.8.7 as the baseline for upcoming JRuby 1.4. The JRuby team is also working on adding Ruby 1.9 compatibility.

Q: i’ve seen in netbeans at the end of netbeans it is end with IDE what is meant by IDE
A: IDE = "Integrated Development Environment"
A: There is a JRuby-specific distribution of NetBeans IDE

Q: why can’t i run a project developed in netbeans 6.1 on netbeans 6.5?
A: You should be able to. If not, try posting to the Netbeans User’s alias.

Q: We’ve been using JRuby on Windows, and are deploying to Solaris using Capistrano. We get mysterious problems establishing an ssh connection that we don’t get when we use native Ruby. Any ideas on this?
A: Please send more details to [email protected]
A: I guess I would need more details on this. you may like to post more info to users@jruby or #jruby irc
A: Paul: if you have purchased support – go through the support channel to address the issue quickly.

Q: Programming wise: are there any differences between ruby and jruby? b/c i think I’m now set on using glassfish, but I’d like to follow a lot of the tutorials out there, but almost all are for ruby
A: JRuby can run any Ruby application 1.8.7 and even 1.9

Q: are there any good books on the topic ?
A: There are several GlassFish books as listed at: Practical JRuby on Rails is a nice book as well (

Q: the ide was complaining that some of the ‘items’ in the project are missing, how do i do it – netbeans 6.1 to 6.5
A: Sounds like a question that should be posted to the Netbeans email aliases. Sorry, the folks chatting away are GlassFish-centric.

Q: how i can more info about the EE6 and about the jruby
A: EE6 can be obtained from

Q: can JRuby run on Windows 7 and Windows Server 2008?
A: The only requirement for JRuby is JDK which is supported on those platforms, so yes JRuby should work there too.

Q: thanks! I was about to release my Jruby on rails glassfish in production. it encouraged me a lot!
A: Good to know, please send feedback to [email protected].

Q: opensource+jruby+glassfish resources on the web?
A: for JRuby, for GlassFish.

Q: so again there’s full support for rails edge (2.3.2+) with the glassfish v2 server?
A: yes, you need to use warbler gem

: so since we already have a support contract with Sun we can also call you and ask about how to best deploy into production?
A: please email [email protected] and we will immediately reply with a call or answers to your questions.

Q: Is jruby compatible with all its older versions
A: They do maintain backwards compatibility. Ask this question at [email protected] for a normative answer.

Q: does dun provide jruby training?
A: "Ruby, JRuby, and Rails development Development (with Passion!)" is a free course that offers that training. More details at:

Q: can we deploy EAR on glassfish?????
A: Yes, GlassFish is a Java EE compliant app server so any standard EE artifact, such as EAR, can be easily deployed.

Q: would purchased support require us to deploy on v2?
A: No, you can choose the version of GlassFish you would like to deploy

Q: Can i build complex web system with glass fish, using such things as corba?
A: Very much, feel free to ask detailed question at [email protected].

Q: I would like to know what would be best platform to use Glassfish on?
A: Being Sun, we prefer Solaris or OpenSolaris, but GlassFish also works well on Linux and Windows.

Q: how does jruby compare to ruby 1.9?
A: JRuby team is working on improving compatibility with Ruby 1.9. Ask your specific question to [email protected].

Q: Great job guys! I am excited to use this.
A: Thanks, let us know your feedback on [email protected].

Q: can glassfish be installed on amazon ec2?
A: Yes. There is an AMI with GlassFish, OpenSolaris, and MySQL

Q: is it very easy to deploy on glassfish
A: asadmin deploy yourrailsapp-dir/

Q: So what is the real advantage using ruby? Why not just use java script or some existing language, and what does the Rails part refer to?
A: Its Rails that makes it interesting. Rails is a complete MVC framework

Q: from where could i got jruby
A: JRuby can be downloaded form

Interested in watching a replay of the webinar ? Go to for all the details.

Technorati: glassfish rubyonrails jruby webinar netbeans

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • Facebook
  • Google Bookmarks
  • DZone
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

September 23, 2009

TOTD #105: GlassFish v3 Monitoring – How to monitor a Rails app using asadmin, JavaScript, jConsole, REST ?

Filed under: General — arungupta @ 6:00 am

Monitoring infrastructure in GlassFish v3 is getting an extreme makeover. Prashanth defines it very nicely in his detailed introduction:

We provide a way to dynamically and non-intrusively generate monitoring events from any of the GlassFish runtime classes, the ability to listen to these events, collect the statistics and expose these statistics through various standard clients.

The "dynamic" nature indicates that monitoring can be turned ON or OFF in a GlassFish instance running in production environment. It also means the granularity to which the monitoring information can be generated. This information can be generated for not only a traditional Java EE applications, but Rails, Django and other type of applications that can be easily deployed on GlassFish v3. And that is extensible for other pluggable containers too. The data can be accessed using multiple mechanisms providing the administrator a wide variety of choice for tools, e.g. DTrace, JMX, REST, asadmin CLI, and Admin Console and thus another point in favor of "dynamic".

The "non-intrusive" behavior means that monitoring can be used in production environment with minimal overhead. It also means that there is no overhead when monitoring is not enabled. Anyway, monitoring needs to be explicitly enabled as explained below.

As mentioned above, there are multiple ways to access the monitoring data. The different ways to access the monitoring data are:

  1. DTrace scripts (only on Solaris)
  2. asadmin CLI
  3. Admin Console
  4. JMX/jConsole
  5. REST
  6. Custom client using a 3rd party scripting language (available as value-add feature to paid customers only)

This Tip Of The Day will describe how to access the monitoring data using asadmin CLI and a JavaScript client. Note that the JavaScript client feature is available as a value-add to the community version of GlassFish and available only to the paid customers.

This tip will use a pre-deployed Rails application as (Redmine as described in TOTD #104) on a nightly GlassFish v3 build (CI, nightly, or promoted) and explains how to monitor this application.

Using the terminology defined in Monitoring in GlassFish v3 blog, the JRuby subsystem in GlassFish has multiple probe providers and each provider has multiple probes. The JRuby subsystem also provides multiple stats providers with probe listeners. All of these elements are linked using the monitoring infrastructure in GlassFish.

Lets monitor our Rails application

Monitoring using asadmin CLI

By default the monitoring is turned OFF for all the components. Lets enable monitoring for the JRuby container as:

asadmin enable-monitoring --level jruby-container=HIGH

The other possible values are "LOW" and "OFF". All the probes publishing monitoring data can be listed as:

~/tools/glassfish/v3/9-18/glassfishv3 >./bin/asadmin list --monitor=true "*"
Command list executed successfully.

A snapshot of the monitoring data can be obtained as:

~/tools/glassfish/v3/9-18/glassfishv3 >./bin/asadmin get --monitor=true "*jruby*"
server.containers.jruby.applications.activerubyapplications.redmine-0.8.5-appName = redmine-0.8.5
server.containers.jruby.applications.activerubyapplications.redmine-0.8.5-description =
server.containers.jruby.applications.activerubyapplications.redmine-0.8.5-environment = development
server.containers.jruby.applications.activerubyapplications.redmine-0.8.5-jrubyVersion = 1.3.0
server.containers.jruby.applications.activerubyapplications.redmine-0.8.5-lastsampletime = 1253322280437
server.containers.jruby.applications.activerubyapplications.redmine-0.8.5-name = redmine-0.8.5
server.containers.jruby.applications.activerubyapplications.redmine-0.8.5-rubyFramework = rails
server.containers.jruby.applications.activerubyapplications.redmine-0.8.5-starttime = 1253322280437
server.containers.jruby.applications.activerubyapplications.redmine-0.8.5-unit =
server.containers.jruby.applications.activerubyappscount-count = 1
server.containers.jruby.applications.activerubyappscount-description = Number of currently loaded Ruby applications
server.containers.jruby.applications.activerubyappscount-lastsampletime = 1253322279921
server.containers.jruby.applications.activerubyappscount-name = ActiveRubyApplications
server.containers.jruby.applications.activerubyappscount-starttime = 1253322279922
server.containers.jruby.applications.activerubyappscount-unit = count
server.containers.jruby.http.redmine-0.8.5.address = null
server.containers.jruby.http.redmine-0.8.5.averageprocessingtime = 0
server.containers.jruby.http.redmine-0.8.5.count200-count = 0
server.containers.jruby.http.redmine-0.8.5.count200-description = Number of responses with a status code equal to 200
server.containers.jruby.http.redmine-0.8.5.count200-lastsampletime = 1253322280245
server.containers.jruby.http.redmine-0.8.5.count200-name = Count200
server.containers.jruby.http.redmine-0.8.5.count200-starttime = 1253322280245
server.containers.jruby.http.redmine-0.8.5.count200-unit = count
server.containers.jruby.http.redmine-0.8.5.count2xx-count = 0
server.containers.jruby.http.redmine-0.8.5.count2xx-description = Number of responses with a status code in the 2xx range
server.containers.jruby.http.redmine-0.8.5.count2xx-lastsampletime = 1253322280245
server.containers.jruby.http.redmine-0.8.5.count2xx-name = Count2xx
server.containers.jruby.http.redmine-0.8.5.count2xx-starttime = 1253322280245
server.containers.jruby.http.redmine-0.8.5.count2xx-unit = count
server.containers.jruby.http.redmine-0.8.5.count302-count = 0
server.containers.jruby.http.redmine-0.8.5.count302-description = Number of responses with a status code equal to 302
server.containers.jruby.http.redmine-0.8.5.count302-lastsampletime = 1253322280245
server.containers.jruby.http.redmine-0.8.5.count302-name = Count302
server.containers.jruby.http.redmine-0.8.5.count302-starttime = 1253322280245
server.containers.jruby.http.redmine-0.8.5.count302-unit = count
server.containers.jruby.http.redmine-0.8.5.count304-count = 0
server.containers.jruby.http.redmine-0.8.5.count304-description = Number of responses with a status code equal to 304
server.containers.jruby.http.redmine-0.8.5.count304-lastsampletime = 1253322280245
server.containers.jruby.http.redmine-0.8.5.count304-name = Count304
server.containers.jruby.http.redmine-0.8.5.count304-starttime = 1253322280245
server.containers.jruby.http.redmine-0.8.5.count304-unit = count
server.containers.jruby.http.redmine-0.8.5.count3xx-count = 0
server.containers.jruby.http.redmine-0.8.5.count3xx-description = Number of responses with a status code in the 3xx range
server.containers.jruby.http.redmine-0.8.5.count3xx-lastsampletime = 1253322280245
server.containers.jruby.http.redmine-0.8.5.count3xx-name = Count3xx
server.containers.jruby.http.redmine-0.8.5.count3xx-starttime = 1253322280245
server.containers.jruby.http.redmine-0.8.5.count3xx-unit = count
server.containers.jruby.http.redmine-0.8.5.count400-count = 0
server.containers.jruby.http.redmine-0.8.5.count400-description = Number of responses with a status code equal to 400
server.containers.jruby.http.redmine-0.8.5.count400-lastsampletime = 1253322280245
server.containers.jruby.http.redmine-0.8.5.count400-name = Count400
server.containers.jruby.http.redmine-0.8.5.count400-starttime = 1253322280245
server.containers.jruby.http.redmine-0.8.5.count400-unit = count
server.containers.jruby.http.redmine-0.8.5.count401-count = 0
server.containers.jruby.http.redmine-0.8.5.count401-description = Number of responses with a status code equal to 401
server.containers.jruby.http.redmine-0.8.5.count401-lastsampletime = 1253322280245
server.containers.jruby.http.redmine-0.8.5.count401-name = Count401
server.containers.jruby.http.redmine-0.8.5.count401-starttime = 1253322280245
server.containers.jruby.http.redmine-0.8.5.count401-unit = count
server.containers.jruby.http.redmine-0.8.5.count403-count = 0
server.containers.jruby.http.redmine-0.8.5.count403-description = Number of responses with a status code equal to 403
server.containers.jruby.http.redmine-0.8.5.count403-lastsampletime = 1253322280245
server.containers.jruby.http.redmine-0.8.5.count403-name = Count403
server.containers.jruby.http.redmine-0.8.5.count403-starttime = 1253322280245
server.containers.jruby.http.redmine-0.8.5.count403-unit = count
server.containers.jruby.http.redmine-0.8.5.count404-count = 0
server.containers.jruby.http.redmine-0.8.5.count404-description = Number of responses with a status code equal to 404
server.containers.jruby.http.redmine-0.8.5.count404-lastsampletime = 1253322280245
server.containers.jruby.http.redmine-0.8.5.count404-name = Count404
server.containers.jruby.http.redmine-0.8.5.count404-starttime = 1253322280245
server.containers.jruby.http.redmine-0.8.5.count404-unit = count
server.containers.jruby.http.redmine-0.8.5.count4xx-count = 0
server.containers.jruby.http.redmine-0.8.5.count4xx-description = Number of responses with a status code in the 4xx range
server.containers.jruby.http.redmine-0.8.5.count4xx-lastsampletime = 1253322280245
server.containers.jruby.http.redmine-0.8.5.count4xx-name = Count4xx
server.containers.jruby.http.redmine-0.8.5.count4xx-starttime = 1253322280245
server.containers.jruby.http.redmine-0.8.5.count4xx-unit = count
server.containers.jruby.http.redmine-0.8.5.count503-count = 0
server.containers.jruby.http.redmine-0.8.5.count503-description = Number of responses with a status code equal to 503
server.containers.jruby.http.redmine-0.8.5.count503-lastsampletime = 1253322280245
server.containers.jruby.http.redmine-0.8.5.count503-name = Count503
server.containers.jruby.http.redmine-0.8.5.count503-starttime = 1253322280245
server.containers.jruby.http.redmine-0.8.5.count503-unit = count
server.containers.jruby.http.redmine-0.8.5.count5xx-count = 0
server.containers.jruby.http.redmine-0.8.5.count5xx-description = Number of responses with a status code in the 5xx range
server.containers.jruby.http.redmine-0.8.5.count5xx-lastsampletime = 1253322280245
server.containers.jruby.http.redmine-0.8.5.count5xx-name = Count5xx
server.containers.jruby.http.redmine-0.8.5.count5xx-starttime = 1253322280245
server.containers.jruby.http.redmine-0.8.5.count5xx-unit = count
server.containers.jruby.http.redmine-0.8.5.countother-count = 0
server.containers.jruby.http.redmine-0.8.5.countother-description = Number of responses with other status codes
server.containers.jruby.http.redmine-0.8.5.countother-lastsampletime = 1253322280245
server.containers.jruby.http.redmine-0.8.5.countother-name = CountOther
server.containers.jruby.http.redmine-0.8.5.countother-starttime = 1253322280245
server.containers.jruby.http.redmine-0.8.5.countother-unit = count
server.containers.jruby.http.redmine-0.8.5.errorcount-count = 0
server.containers.jruby.http.redmine-0.8.5.errorcount-description = Number of responses with a status code greater than 400
server.containers.jruby.http.redmine-0.8.5.errorcount-lastsampletime = 1253322280245
server.containers.jruby.http.redmine-0.8.5.errorcount-name = ErrorCount
server.containers.jruby.http.redmine-0.8.5.errorcount-starttime = 1253322280245
server.containers.jruby.http.redmine-0.8.5.errorcount-unit = count
server.containers.jruby.http.redmine-0.8.5.requestcount-count = 0
server.containers.jruby.http.redmine-0.8.5.requestcount-description = Number of HTTP requests received
server.containers.jruby.http.redmine-0.8.5.requestcount-lastsampletime = 1253322280243
server.containers.jruby.http.redmine-0.8.5.requestcount-name = RequestCounter
server.containers.jruby.http.redmine-0.8.5.requestcount-starttime = 1253322280243
server.containers.jruby.http.redmine-0.8.5.requestcount-unit = count
server.containers.jruby.http.redmine-0.8.5.requestpersecond = null
server.containers.jruby.runtime-pool.redmine-0.8.5.activeruntimes-count = 1
server.containers.jruby.runtime-pool.redmine-0.8.5.activeruntimes-description = Currently active runtimes
server.containers.jruby.runtime-pool.redmine-0.8.5.activeruntimes-lastsampletime = 1253322280241
server.containers.jruby.runtime-pool.redmine-0.8.5.activeruntimes-name = activeRuntimes
server.containers.jruby.runtime-pool.redmine-0.8.5.activeruntimes-starttime = 1253322280241
server.containers.jruby.runtime-pool.redmine-0.8.5.activeruntimes-unit = count
server.containers.jruby.runtime-pool.redmine-0.8.5.applicationname = redmine-0.8.5
server.containers.jruby.runtime-pool.redmine-0.8.5.contextpath = /redmine-0.8.5
server.containers.jruby.runtime-pool.redmine-0.8.5.hardmaximum-count = 1
server.containers.jruby.runtime-pool.redmine-0.8.5.hardmaximum-description = Maximum active runtimes
server.containers.jruby.runtime-pool.redmine-0.8.5.hardmaximum-lastsampletime = 1253322280241
server.containers.jruby.runtime-pool.redmine-0.8.5.hardmaximum-name = hardMaximum
server.containers.jruby.runtime-pool.redmine-0.8.5.hardmaximum-starttime = 1253322280241
server.containers.jruby.runtime-pool.redmine-0.8.5.hardmaximum-unit = count
server.containers.jruby.runtime-pool.redmine-0.8.5.hardmminimum-count = 1
server.containers.jruby.runtime-pool.redmine-0.8.5.hardmminimum-description = Minimum active runtimes
server.containers.jruby.runtime-pool.redmine-0.8.5.hardmminimum-lastsampletime = 1253322280241
server.containers.jruby.runtime-pool.redmine-0.8.5.hardmminimum-name = hardMinimum
server.containers.jruby.runtime-pool.redmine-0.8.5.hardmminimum-starttime = 1253322280241
server.containers.jruby.runtime-pool.redmine-0.8.5.hardmminimum-unit = count
Command get executed successfully.

The command asadmin get --monitor=true "*jruby*" dumps a snapshot of the monitoring data such as the number of Ruby currently applications loaded, application name, JRuby version, environment (development / test / production), currently active runtimes, min/max runtimes, number of HTTP requests / responses with a certain HTTP code and much more information. It basically dumps all the JRuby monitoring information captured so far.

An alternate regular expression may be specified such as:

asadmin get --monitor=true "*jruby*runtime-pool*"

to gather only the runtime pool specific values.

Monitoring using JavaScript client

Third-party scripting client are a value-add to the community versions. Just like Enterprise Manager, the value-add will be available as a patch to the users who purchase commercial support. Lets see what can be done with it though.

First of all you can type the command "list-probes" to see a list of all the probes that are available. A typical output will look like:

~/tools/glassfish/v3/9-18/glassfishv3 >./bin/asadmin list-probes
glassfish:kernel:connections-keep-alive:decrementCountConnectionsEvent decrementCountConnectionsEvent(java.lang.String)
glassfish:web:web-module:webModuleStoppedEvent webModuleStoppedEvent(java.lang.String, java.lang.String)
glassfish:jca:connection-pool:connectionValidationFailedEvent connectionValidationFailedEvent(java.lang.String, int)
glassfish:jca:work-management:workWaitedFor workWaitedFor(java.lang.String, long)
glassfish:jdbc:connection-pool:connectionTimedOutEvent connectionTimedOutEvent(java.lang.String)
glassfish:security:ejbpolicy:ejbPCCreationEvent ejbPCCreationEvent(java.lang.String)
glassfish:kernel:thread-pool:threadReturnedToPoolEvent threadReturnedToPoolEvent(java.lang.String, java.lang.String)
glassfish:web:session:sessionPersistedEndEvent sessionPersistedEndEvent(java.lang.String, java.lang.String, java.lang.String)
glassfish:web:http-service:requestStartEvent requestStartEvent(java.lang.String, java.lang.String, java.lang.String, int, java.lang.String, java.lang.String)
glassfish:jdbc:connection-pool:connectionsFreedEvent connectionsFreedEvent(java.lang.String, int)
glassfish:jdbc:connection-pool:toString toString(java.lang.String, java.lang.StringBuffer)
glassfish:jca:connection-pool:decrementFreeConnectionsSizeEvent decrementFreeConnectionsSizeEvent(java.lang.String, int)
glassfish:kernel:connections-keep-alive:incrementCountFlushesEvent incrementCountFlushesEvent(java.lang.String)
glassfish:webservices:109:deploy deploy(com.sun.enterprise.deployment.Application, com.sun.enterprise.deployment.WebServiceEndpoint)
glassfish:jca:connection-pool:connectionAcquiredEvent connectionAcquiredEvent(java.lang.String)
glassfish:web:http-service:requestEndEvent requestEndEvent(java.lang.String, java.lang.String, java.lang.String, int, java.lang.String, java.lang.String, int)
glassfish:kernel:connections-keep-alive:incrementCountRefusalsEvent incrementCountRefusalsEvent(java.lang.String)
glassfish:kernel:connections:connectionConnectedEvent connectionConnectedEvent(java.lang.String, int)
glassfish:kernel:file-cache:addHeapSizeEvent addHeapSizeEvent(java.lang.String, long)
glassfish:jruby:runtime-pool:runtimePoolUpdateEvent runtimePoolUpdateEvent(java.lang.String, int, int, int, int, int)
glassfish:security:web:securityManagerCreationEvent securityManagerCreationEvent(java.lang.String)
glassfish:security:web:securityManagerDestructionEvent securityManagerDestructionEvent(java.lang.String)
glassfish:webservices:ri:undeploy undeploy(
glassfish:web:session:sessionPersistedStartEvent sessionPersistedStartEvent(java.lang.String, java.lang.String, java.lang.String)
glassfish:ejb:pool:objectAddedEvent ejbObjectAddedEvent()
glassfish:ejb:bean:methodStartEvent ejbMethodStartEvent(java.lang.String, java.lang.String, java.lang.String, java.lang.reflect.Method)
glassfish:jdbc:connection-pool:connectionRequestServedEvent connectionRequestServedEvent(java.lang.String, long)

All the JRuby probes can be easily listed as:

~/tools/glassfish/v3/9-18/glassfishv3 >./bin/asadmin list-probes | grep jruby
glassfish:jruby:runtime-pool:runtimePoolUpdateEvent runtimePoolUpdateEvent(java.lang.String, int, int, int, int, int)
glassfish:jruby:http:requestStartEvent requestStartEvent(java.lang.String, java.lang.String, int)
glassfish:jruby:jruby-container:jrubyModuleStartedEvent jrubyModuleStartedEvent(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
glassfish:jruby:jruby-container:jrubyModuleStoppedEvent jrubyModuleStoppedEvent(java.lang.String, java.lang.String, java.lang.String)
glassfish:jruby:http:requestEndEvent requestEndEvent(java.lang.String, int)
glassfish:jruby:runtime-pool:runtimePoolStartEvent runtimePoolStartEvent(java.lang.String, int, int, int, int, int, int, int)

More detailed information about each probe can be easily found by giving the command:

~/tools/glassfish/v3/9-18/glassfishv3 >./bin/asadmin list-probes --manpage=true glassfish:jruby:runtime-pool:runtimePoolUpdateEvent

This will show the detailed information ("man" pages) about the specific probe. A JavaScript client to monitor the deployed Rails application and gather the relevant statistics can be written using these pages as shown below:

moduleStarted = function(appName, appType, env, jruby) {
client.print( '\n log> Deployed a \'' + appType + '\' app named \'' + appName + '\' in \'' + env + '\' environment with JRuby \'' + jruby + '\'.');
moduleStopped = function(appName, appType, env) {
client.print( '\n log> Undeployed a \'' + appType + '\' app named \'' + appName + '\' in \'' + env + '\' environment.');
requestStarted = function(contextPath, serverName, port) {
client.print( '\n log> Request started at \'' + contextPath + '\' hosted on \'' + serverName + ':' + port + '\'');
requestEnded = function(contextPath, statusCode) {
client.print( '\n log> Request stopped at \'' + contextPath + '\' with status code \'' + statusCode + '\'');
runtimePoolStart = function(appName, activeRuntimes, queueSize) {
client.print( '\n log> JRuby runtime pool started for the app \'' + appName + '\': active runtime - ' + activeRuntimes + ', queue size - ' + queueSize);
runtimePoolUpdate = function(appName, activeRuntimes, queueSize) {
client.print( '\n log> JRuby runtime pool updated for the app \'' + appName + '\': active runtime - ' + activeRuntimes + ', queue size - ' + queueSize);
moduleStartedParams = java.lang.reflect.Array.newInstance(java.lang.String, 4);
scriptContainer.registerListener('glassfish:jruby:jruby-container:jrubyModuleStartedEvent', moduleStartedParams, 'moduleStarted');
moduleStoppedParams = java.lang.reflect.Array.newInstance(java.lang.String, 3);
scriptContainer.registerListener('glassfish:jruby:jruby-container:jrubyModuleStoppedEvent', moduleStoppedParams, 'moduleStopped');
requestStartParams = java.lang.reflect.Array.newInstance(java.lang.String, 3);
scriptContainer.registerListener('glassfish:jruby:http:requestStartEvent', requestStartParams, 'requestStarted');
requestEndParams = java.lang.reflect.Array.newInstance(java.lang.String, 2);
scriptContainer.registerListener('glassfish:jruby:http:requestEndEvent', requestEndParams, 'requestEnded');
runtimePoolParams = java.lang.reflect.Array.newInstance(java.lang.String, 3);
scriptContainer.registerListener('glassfish:jruby:runtime-pool:runtimePoolStartEvent', runtimePoolParams, 'runtimePoolStart');
scriptContainer.registerListener('glassfish:jruby:runtime-pool:runtimePoolUpdateEvent', runtimePoolParams, 'runtimePoolUpdate');

This script register listeners for different probe events, pass a set of parameters that need to be captured, and print the information in a callback method specified during registration. The number of listeners and parameters / listener may be altered to meet your data capturing needs.

This script is stored in a file "monitor-rails.js" and used as described below. As a Rails application is deployed, requests invoked, and undeployed, the following messages are printed on the console:

~/tools/glassfish/v3/9-18/glassfishv3 >./bin/asadmin run-script monitor-rails.js

log> Deployed a 'rails' app named 'redmine-0.8.5' in 'development' environment with JRuby '1.3.0'.
log> JRuby runtime pool started for the app 'redmine-0.8.5': active runtime - 1, queue size - 0
log> Request started at '/redmine-0.8.5' hosted on 'localhost:8080'
log> Request stopped at '/redmine-0.8.5' with status code '200'
log> Request started at '/redmine-0.8.5' hosted on 'localhost:8080'
log> Request stopped at '/redmine-0.8.5' with status code '200'
log> Undeployed a 'rails' app named 'redmine-0.8.5' in 'development' environment.

Note "run-script" is the command that comes as part of the value-add. As described earlier, a snapshot of the monitoring information can be easily captured using asadmin as:

~/tools/glassfish/v3/9-18/glassfishv3 >./bin/asadmin get --monitor=true "*jruby*request*"
server.containers.jruby.http.redmine-0.8.5.requestcount-count = 2
server.containers.jruby.http.redmine-0.8.5.requestcount-description = Number of HTTP requests received
server.containers.jruby.http.redmine-0.8.5.requestcount-lastsampletime = 1253638362651
server.containers.jruby.http.redmine-0.8.5.requestcount-name = RequestCounter
server.containers.jruby.http.redmine-0.8.5.requestcount-starttime = 1253638362651
server.containers.jruby.http.redmine-0.8.5.requestcount-unit = count
server.containers.jruby.http.redmine-0.8.5.requestpersecond = 1
Command get executed successfully.

As you can see, the total number of requests is shown as "2".

Just for fun, I ran Apache ab with 20 requests and 4 concurrency ("-n 20 -c 4") on "http://localhost:8080/redmine-0.8.5" and saw the following results:

Monitoring OFF
(no data printed)
(data printed)
Time taken for requests (secs) 26.231 26.997 26.665
Requests per second 0.76 0.74 0.75
Time per request (ms) 1311.574 1349.859 1333.239

The server was restarted between each run. These numbers were generated on my development machine so they are most likely skewed. But as a development benchmark the numbers do indicate that GlassFish v3 monitoring is truly non-intrusive. The total time taken for requests, requests/second, and time/request is pretty much identical.

Future blogs will cover how to access this data using web-based DTrace scripts, web-based Admin Console, jConsole, and REST interface.

A complete archive of all the tips is available here.

Technorati: totd glassfish v3 monitoring asadmin javascript jruby rails redmine

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • Facebook
  • Google Bookmarks
  • DZone
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

September 21, 2009

TheRelay 2010 Rules Simplified – Are you interested in running ?

Filed under: Running — arungupta @ 11:38 pm
TheRelay-logo 12 runners run
200 miles in
36 segments (each in varying length of 3 to 8.9 miles)
through 36 cities (Calistoga to Santa Cruz)
on a moonlight weekend

Ultimate combination of cooperation, teamwork, endurance, and strategy to meet the goal.

TheRelay is a 200 mile, 12-member team run from Calistoga to Santa Cruz. The race is organized under full moonlight and is scheduled for May 1-2, 2010. The registration is already open and closes Mar 1, 2010.

The race is divided into 3 leg groups as explained here with each group consisting of 12 different legs. For competitive teams (desiring to be recognized as 1st, 2nd or 3rd winners), each runner must run every 12th leg. For non-competitive teams, it is not required but recommended for logistical purposes.

The start times are 7am – 5pm at Calistoga Beverage Company and calculated using the runners’ pace. The finish time is 10am – 8pm at the Santa Cruz Beach. Your team is penalized (even disqualified) and featured in "Sandbaggers Hall of Shame" if you finish more than 2 hours ahead of predicted time. So accurate timing of each member of your race team is essential. Read The Rules for more details.

Each team must provide 2 vehicles that are used to transport the runners. Van 1 carry (Active) runners 1-6 and required at the start point. Van 2 (Passive) carry runners 7-12 and is required at the first exchange point at the end of leg 6. The complete logistics of how runners exchange batons, how to take shower / eat / rest / play between your legs and other similar details are described in the Survival Strategies. The vans also must carry all supplies as there are aid stations during the course.

Each team must (if any runner lives within 50 miles of the course) provide two volunteers that sign up for a 5 hours shift on the course.

Here is the complete course map:

More details on the course (including elevation) are available here.

Each team must mail one non-refundable check of $960 ($80/runner) by Mar 1 and must raise $600 ($50/runner) for Organs ‘R’ Us.

Here are some more questions:

  • For a non-competitive team, can the team captain pick & choose the legs for each runner based upon their skill ?
    • Could it be a logistics mess ?
    • What if some variance is introduced between Runner 1-6 and 7-12 ?
  • Can the number of individual runners be less than 12 ? For example, one individual represents more than one runner.
  • What is the difference between Open, Submasters and Masters division ?

I may be forming a team to participate in this "California’s Longest Party" and 2 runners have already approached me. Are you interested ?

Do you have it in you to complete this adventure ?

Miles to go …

Technorati: therelay running endurance

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • Facebook
  • Google Bookmarks
  • DZone
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

September 18, 2009

Free Rails/GlassFish Webinar with live Q&A: Sep 23, 2009,10am PT

Filed under: General — arungupta @ 12:00 pm

Got the following message in my inbox today:

All details (including registration) are available here.

Looking forward to see you there!

Technorati: glassfish rubyonrails jruby webinar

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • Facebook
  • Google Bookmarks
  • DZone
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

TOTD #104: Popular Ruby-on-Rails applications on GlassFish v3 – Redmine, Typo, Substruct

Filed under: web2.0 — arungupta @ 6:14 am

GlassFish v3 is opening up new frontiers by allowing to easily deploy Rails, Grails and Django applications, in addition to Java EE, without any additional packaging. You can even write a custom container to support new types of applications. Numerous entries on this blog have talked about how to deploy Rails applications on GlassFish v3. This Tip Of The Day (TOTD) will recap them and, once again, demonstrate how to easily get started with deploying some popular open source Rails applications on GlassFish v3.

Lets prepare a GlassFish v3 build for deploying Rails applications. This blog is going to use 9/16 nightly but you should pick the latest nightly or promoted.

  1. Unzip the downloaded bundle as:
    ~/tools/glassfish/v3/9-16 >unzip ~/Downloads/
  2. Configure JRuby/Rails in GlassFish v3 – JRuby/rails can be configured three different ways – use a previously installed JRuby/Rails directory, install JRuby/Rails module using the graphical Update Center or the “pkg” binary. This Update Center module comes packaged with JRuby 1.3.1, Rails 2.3.2 and some other useful gems. Pick the option you are most comfortable with and use it for your GlassFish installation.
    1. Configure previously installed JRuby/Rails directory as:
      ~/tools/glassfish/v3/9-16/glassfishv3/bin/asadmin create-jvm-options -Djruby.home=/Users/arungupta/tools/jruby
      Authentication failed with password from login store: /Users/arungupta/.asadminpass
      Enter admin password >
      created 1 option(s)
      Command create-jvm-options executed successfully.

      That’s it!

    2. Install JRuby/Rails module using graphical Update Tool
      1. The graphical Update Tool tool can be invoked as:
        ~/tools/glassfish/v3/9-16/glassfishv3 >./bin/updatetool
        The software needed for this command (updatetool) is not installed.
        If you choose to install Update Tool, your system will be automatically
        configured to periodically check for software updates. If you would like
        to configure the tool to not check for updates, you can override the
        default behavior via the tool's Preferences facility.
        When this tool interacts with package repositories, some system information
        such as your system's IP address and operating system type and version
        is sent to the repository server. For more information please see:
        Once installation is complete you may re-run this command.
        Would you like to install Update Tool now (y/n): y
        Proxy: Using system proxy settings.
        Install image: /Users/arungupta/tools/glassfish/v3/9-16/glassfishv3
        Installing pkg packages.
        Installing updatetool packages.
        Registering notifier: Already registered.
        Initialization complete.
        Software successfully installed. You may now re-run this command (updatetool).
      2. The first invocation of the command installs the Update Tool and the second invocation shows the following screen after “JRuby on GlassFish” module is selected:

        Click on green button in the top left to install the module and it picks up the dependencies as well as shown below:

        Click on “Install” to start the installation and click on “Accept” to accept the license.

      3. Close the Update Tool window once the installation is completed. The module creates “glassfish/jruby” directory.
    3. Install JRuby/Rails module using “pkg” binary
      1. Install the JRuby/Rails bits using the “pkg” binary. Invoke the command as:
        ~/tools/glassfish/v3/9-16/glassfishv3 >./bin/pkg
        The software needed for this command (pkg) is not installed.
        When this tool interacts with package repositories, some system information
        such as your system's IP address and operating system type and version
        is sent to the repository server. For more information please see:
        Once installation is complete you may re-run this command.
        Would you like to install this software now (y/n): y
        Proxy: Using system proxy settings.
        Install image: /Users/arungupta/tools/glassfish/v3/9-16/glassfishv3
        Installing pkg packages.
        Initialization complete.
        Software successfully installed. You may now re-run this command (pkg).
      2. The command “pkg list -a” shows all the modules available for installation and the output looks like:
        ~/tools/glassfish/v3/9-16/glassfishv3 >./bin/pkg list -a
        NAME (PUBLISHER)                              VERSION         STATE      UFIX
        ant (                   1.7.1-0.6       known      ----
        felix                                         2.0.0-0         installed  ----
        glassfish-appclient                           3.0-65          installed  ----
        glassfish-cmp                                 3.0-65          installed  ----
        . . .
        jersey-docs-and-examples                      1.1.2-1.0       known      ----
        jmaki (                 1.8.1-2.0       known      ----
        jruby                                         1.3.1-1.1       known      ----
        jruby (                 1.2.0-1.1       known      u---
        jruby-gems (            2.3.2-1.1       known      ----
        jython-container (      0.5.3-1.0       known      ----
        jython-runtime (        2.5.0-1.0       known      ----
        metro                                         2.0-19          installed  ----
        . . .
        updatetool                                    2.3.0-36.2403   known      ----
        updatetool (            2.2.2-30.2311   known      u---
        wxpython2.8-minimal                  known      ----
        wxpython2.8-minimal (   2.8.8-30.2311   known      u---
      3. Start the installation of “jruby” module as:
        ~/tools/glassfish/v3/9-17/glassfishv3 >./bin/pkg install jruby
        DOWNLOAD                                  PKGS       FILES    XFER (MB)
        Completed                                  2/2 14810/14810    37.0/37.0
        PHASE                                        ACTIONS
        Install Phase                            17273/17273
  3. Redmine on GlassFish – Redmine is an open source project management web application. The simplified steps to deploy Redmine on GlassFish v3 are given below (also on GlassFish Gem and on GlassFish v3 TP2):
    1. Download and unzip Redmine 0.8.5 (latest stable release).
    2. Change the database adapter from “mysql” to “jdbcmysql” as:
      sed s/'adapter: mysql'/'adapter: jdbcmysql'/ <config/ >config/database.yml
    3. Create the database manually as “sudo mysqladmin create redmine_development”. “db:create” fails because of JRUBY-3502.
    4. Migrate the database as “db:migrate”.
    5. Deploy the application as:
      ~/samples/jruby/redmine >~/tools/glassfish/v3/9-16/glassfishv3/bin/asadmin deploy redmine-0.8.5
      Authentication failed with password from login store: /Users/arungupta/.asadminpass
      Enter admin password>
      Command deploy executed successfully.
    6. Here are some snapshots from the deployed application:

  4. Typo on GlassFish – Typo is the oldest Ruby on Rails blogware. The simplified steps to deploy Typo on GlassFish v3 are given below (also on GlassFish Prelude):
    1. Download and unzip Typo 5.3 (latest stable release).
    2. Change the database adapter from “mysql” to “jdbcmysql” as:
      sed s/'adapter: mysql'/'adapter: jdbcmysql'/ <config/database.yml.example >config/database.yml
    3. Create the database manually as “sudo mysqladmin create typo_dev”. “db:create” fails because of JRUBY-3502.
    4. Typo runs using Rails 2.2.2 so lets install Rails 2.2.2 so lets install Rails 2.2.2 as:
      ~/samples/jruby/typo/typo-5.3 >~/tools/glassfish/v3/9-16/glassfishv3/glassfish/jruby/bin/jruby -S gem install rails -v 2.2.2
      JRuby limited openssl loaded. gem install jruby-openssl for full support.
      Successfully installed activesupport-2.2.2
      Successfully installed activerecord-2.2.2
      Successfully installed actionpack-2.2.2
      Successfully installed actionmailer-2.2.2
      Successfully installed activeresource-2.2.2
      Successfully installed rails-2.2.2
      6 gems installed
      Installing ri documentation for activesupport-2.2.2...
      Installing ri documentation for activerecord-2.2.2...
      Installing ri documentation for actionpack-2.2.2...
      Installing ri documentation for actionmailer-2.2.2...
      Installing ri documentation for activeresource-2.2.2...
      Installing ri documentation for rails-2.2.2...
      Installing RDoc documentation for activesupport-2.2.2...
      Installing RDoc documentation for activerecord-2.2.2...
      Installing RDoc documentation for actionpack-2.2.2...
      Installing RDoc documentation for actionmailer-2.2.2...
      Installing RDoc documentation for activeresource-2.2.2...
      Installing RDoc documentation for rails-2.2.2...
    5. Migrate the database as “db:migrate”.
    6. Deploy the application as:
      ~/samples/jruby/typo >~/tools/glassfish/v3/9-16/glassfishv3/bin/asadmin deploy typo-5.3
      Authentication failed with password from login store: /Users/arungupta/.asadminpass
      Enter admin password>
      Command deploy executed successfully.
    7. Here are are some snapshots from the deployed application:

  5. Substruct on GlassFish – Substruct is an open source E-Commerce project in Ruby-on-Rails. The simplified steps to deploy Substruct on GlassFish v3 are given below (also on GlassFish v3 Gem):
    1. Download and unzip substruct 1.0 a6 (latest stable release).
    2. Install the required gems as:
      ~/samples/jruby/substruct >~/tools/glassfish/v3/9-16/glassfishv3/glassfish/jruby/bin/jruby -S gem install RedCloth fastercsv mime-types mini_magick ezcrypto jruby-openssl --no-ri --no-rdoc
    3. Change the database adapter from “mysql” to “jdbcmysql” as:
      ~/samples/jruby/substruct/substruct_rel_1-0-a6>sed s/'adapter: mysql'/'adapter: jdbcmysql'/ <config/database.yml
      ~/samples/jruby/substruct/substruct_rel_1-0-a6>mv config/ config/database.yml
    4. Create the database manually as “sudo mysqladmin create substruct_development”. “db:create” fails because of JRUBY-3502.
    5. Initialize the database as:
      ~/samples/jruby/substruct/substruct_rel_1-0-a6 >~/tools/glassfish/v3/9-16/glassfishv3/glassfish/jruby/bin/jruby -S rake substruct:db:bootstrap
    6. Deploy the application as:
      ~/samples/jruby/substruct >~/tools/glassfish/v3/9-16/glassfishv3/bin/asadmin deploy substruct_rel_1-0-a6
      Authentication failed with password from login store: /Users/arungupta/.asadminpass
      Enter admin password>
      Command deploy executed successfully.
    7. Here is a snapshot of the deployed application:

So we deployed Redmine, Typo, and Substruct using JRuby/Rails on GlassFish without any additional packaging. There are several Rails applications deployed in production on GlassFish.

What Rails applications are you deploying on GlassFish ?

Technorati: glassfish v3 rubyonrails jruby redmine typo mephisto substruct

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • Facebook
  • Google Bookmarks
  • DZone
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

Twitter lost my profile photo!

Filed under: General — arungupta @ 1:42 am

Twitter has lot my (and several others too) profile photo. The main page look like:

The default user icons are shown instead and here is a sampling:

What color is your default icon ? :)

Alex says it’s not intentional.

UPDATE:Root cause of the problem identified.

Technorati: twitter

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • Facebook
  • Google Bookmarks
  • DZone
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

September 16, 2009

FishCAT – GlassFish v3 Community Acceptance Testing

Filed under: General — arungupta @ 12:32 pm

Would you like to influence the quality of GlassFish v3 ?

Do you have what it takes to provide feedback on stability and usability in GlassFish Beta Testing Cycle ?

GlassFish v3 Prelude Community Acceptance Testing boasts 36 FishCAT members from 18 different countries submitting 125 bugs.

GlassFish v3 is getting ready to be released later this year. Can you help us test the installation, features, samples, docs, I18N/L10N, or any thing else that comes to your mind ?

Fill out the application form and participate in shaping the future. Help us beat the numbers from last time and in the process learn the fine skills by interacting with the GlassFish Quality team.

More details about the program here.

Technorati: glassfish v3 fishcat quality testing community

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • Facebook
  • Google Bookmarks
  • DZone
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

September 15, 2009

Indian Public Broadcasting Television “Doordarshan” turns 50 today!

Filed under: General — arungupta @ 5:56 pm

Doordarshan – Indian public television broadcaster turns 50 today – congratulations!

The word "doordarshan" is in Hindi and made up of two words "door" (means "far" in English) and "darshan" (means "vision" in English). The word "doordarshan" literally means "tele vision". It started with a mere $20,000 and 180 Philips TV sets donated by UNESCO to Indian government on Sep 15, 1959.

If you grew up in India how can you forget soap operas like:

  • Pramita Puri as the first announcer and Salma Sultan the ever charming news reader
  • Aap ke Liye – the Sunday morning show by Vinod Dua
  • Phool Khile Hain Gulshan Gulshan featuring Tabassum and movie stars
  • Hum Log, Buniyaad, Nukkad, Rajani – legendary multi-months episode touching lives of common man
  • Ramayana and Mahabharat – great Indian mythological epics
  • Bharat Ek Khoj – shows 5000 years of Indian history
  • Chitrahaar – collection of Bollywood movie songs
  • Malgudi Days – collection of short stories by R. K. Narayan
  • Karamchand and Byomkesh Bakshi – Indian Sherlock Holmes
  • Comedy shows like Yeh Jo Hai Zindagi, Mungeri Laal ke Haseen Sapney, and Flop Show
  • Sunday evening movie (one of the biggest attractions)
  • and many others.

It’s a truly joyous and nosalgic moment and something to relish for all Indians.

Unlike today, there used to be a startup and shutdown time for TV channels. Enjoy the signature montage of Doordarshan below:

And couple more of my favorite videos:


What are/were your favorite serials from Doordarshan ?

Technorati: doordarshan india

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • Facebook
  • Google Bookmarks
  • DZone
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot
Older Posts »

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.
Powered by WordPress