Thursday October 08, 2009
TOTD #112: Exposing Oracle database tables as RESTful entities using JAX-RS, GlassFish, and NetBeans
This Tip Of The Day explains how to expose an existing Oracle database table as a RESTful Web service endpoint using NetBeans tooling and deployed on GlassFish.
Lets get started!















Do you have the need to expose your Oracle database tables as RESTful entities ?
A complete archive of all the TOTDs is available here.
This and other similar applications will be demonstrated at the upcoming Oracle Open World.
Technorati: totd oracle database glassfish v3 netbeans javaee jax-rs jpa rest
Posted by Arun Gupta in General | Comments[0]
|
|
|
|
|
Wednesday October 07, 2009
TOTD #111: Rails Scaffold for a pre-existing table using Oracle and GlassFish
TOTD #110 explained how to create a brand new Rails application using Oracle database and run it using GlassFish v Gem. This Tip Of The Day explains how to create a scaffold for a sample schema that ships with Oracle database. Even though Rails Scaffold are good for, well, scaffolding but they do get you started easily. This blog will use the sample HR schema that comes along with Oracle database.
Lets get started!
development:
adapter: oracle_enhanced
host: localhost
database: orcl
username: hr
password: hr
~/samples/v3/rails/oracle/bookstore >~/tools/jruby/bin/jruby script/reverse_scaffold departments department
JRuby limited openssl loaded. gem install jruby-openssl for full support.
http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
JRuby limited openssl loaded. gem install jruby-openssl for full support.
http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
exists app/models/
exists app/controllers/
exists app/helpers/
create app/views/departments
exists app/views/layouts/
exists test/functional/
exists test/unit/
create test/unit/helpers/
exists public/stylesheets/
create app/views/departments/index.html.erb
create app/views/departments/show.html.erb
create app/views/departments/new.html.erb
create app/views/departments/edit.html.erb
create app/views/layouts/departments.html.erb
create public/stylesheets/scaffold.css
create app/controllers/departments_controller.rb
create test/functional/departments_controller_test.rb
create app/helpers/departments_helper.rb
create test/unit/helpers/departments_helper_test.rb
route map.resources :departments
dependency model
exists app/models/
exists test/unit/
exists test/fixtures/
create app/models/department.rb
create test/unit/department_test.rb
create test/fixtures/departments.yml
set_primary_key "department_id"
~/samples/v3/rails/oracle/bookstore >~/tools/jruby/bin/jruby -S glassfish -l
Starting GlassFish server at: 129.145.133.197:3000 in development environment...
Writing log messages to: /Users/arungupta/samples/v3/rails/oracle/bookstore/log/development.log.
Press Ctrl+C to stop.
Oct 6, 2009 2:14:19 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start
INFO: Listening on port 3000
. . .
~/samples/v3/rails/oracle/bookstore >~/tools/jruby/bin/jruby script/reverse_scaffold employees employee
JRuby limited openssl loaded. gem install jruby-openssl for full support.
http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
JRuby limited openssl loaded. gem install jruby-openssl for full support.
http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
exists app/models/
exists app/controllers/
exists app/helpers/
create app/views/employees
exists app/views/layouts/
exists test/functional/
exists test/unit/
exists test/unit/helpers/
exists public/stylesheets/
create app/views/employees/index.html.erb
create app/views/employees/show.html.erb
create app/views/employees/new.html.erb
create app/views/employees/edit.html.erb
create app/views/layouts/employees.html.erb
identical public/stylesheets/scaffold.css
create app/controllers/employees_controller.rb
create test/functional/employees_controller_test.rb
create app/helpers/employees_helper.rb
create test/unit/helpers/employees_helper_test.rb
route map.resources :employees
dependency model
exists app/models/
exists test/unit/
exists test/fixtures/
create app/models/employee.rb
create test/unit/employee_test.rb
create test/fixtures/employees.yml
set_primary_key "employee_id"

So we created a simple Rails CRUD application accessing information from a pre-existing table in the Oracle database server.
Thanks to @mediachk for all the help!
A complete archive of all the TOTDs is available here. The complete list of Rails blog entries are available here.
This and other similar applications will be demonstrated at the upcoming Oracle Open World.
Technorati: totd oracle database glassfish v3 jruby rails oow
Posted by Arun Gupta in General | Comments[0]
|
|
|
|
|
Tuesday October 06, 2009
TOTD #110: JRuby on Rails application using Oracle on GlassFish
GlassFish v3 is the Reference Implementation for Java EE 6. Following the "extensibility" principle of Java EE 6, it also allows Ruby-on-Rails, Groovy and Grails and Python/Django applications to be seamlessly deployed as well, without any additional packaging. This blog has published multiple entries on deploying a Rails application on GlassFish as given below:
All the existing applications have used JavaDB, SQLite3, or MySQL as the database so far. In the process of getting ready for the upcoming Oracle Open World 2009, this Tip Of The Day will show how to use an Oracle database with a JRuby-on-Rails application deployed on GlassFish v3.
Lets get started!
>./bin/jruby -S gem install glassfish
JRuby limited openssl loaded. gem install jruby-openssl for full support.
http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
Successfully installed rack-1.0.0
Successfully installed glassfish-0.9.5-universal-java
2 gems installed
Installing ri documentation for rack-1.0.0...
Installing ri documentation for glassfish-0.9.5-universal-java...
Installing RDoc documentation for rack-1.0.0...
Installing RDoc documentation for glassfish-0.9.5-universal-java...
Macintosh-187:~ oracle$ sqlplus "/ as sysdba"
SQL*Plus: Release 10.2.0.4.0 - Production on Thu Oct 1 12:32:33 2009
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Release 10.2.0.4.0 - Production
SQL> CREATE USER glassfish IDENTIFIED BY glassfish DEFAULT tablespace users TEMPORARY tablespace temp;
User created.
SQL> GRANT CONNECT TO glassfish IDENTIFIED BY glassfish;
Grant succeeded.
SQL> GRANT UNLIMITED TABLESPACE TO glassfish;
Grant succeeded.
SQL> GRANT CREATE TABLE TO glassfish;
Grant succeeded.
SQL> GRANT CREATE SEQUENCE TO glassfish;
Grant succeeded.
SQL> exit
Disconnected from Oracle Database 10g Release 10.2.0.4.0 - Production
The user name and password are chosen as "glassfish" for simplicity. This is not a recommended setting for production usage though.
rails (2.3.4)
activerecord-jdbc-adapter (0.9.2)
glassfish (0.9.5)
jruby -S gem install rails activercord-jdbc-adapter glassfish
jruby -S rails bookstore -d oracle
ActionView::TemplateError (book_url failed to generate from {:controller=>"books", :action=>"show", :id=>#<Book id: #<BigDecimal:3feef1eb,'10000.0',1(8)>, title: "Ultramarathon Man", author: "Dean Karnazes", created_at: "2009-10-06 00:03:14", updated_at: "2009-10-06 00:03:14">}, expected: {:controller=>"books", :action=>"show"}, diff: {:id=>#<Book id: #<BigDecimal:459bdb65,'10000.0',1(8)>, title: "Ultramarathon Man", author: "Dean Karnazes", created_at: "2009-10-06 00:03:14", updated_at: "2009-10-06 00:03:14">}) on line #13 of app/views/books/index.html.erb:
bookstore >~/tools/jruby/bin/jruby -S gem install activerecord-oracle_enhanced-adapter
JRuby limited openssl loaded. gem install jruby-openssl for full support.
http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
Successfully installed activerecord-oracle_enhanced-adapter-1.2.2
1 gem installed
Installing ri documentation for activerecord-oracle_enhanced-adapter-1.2.2...
Installing RDoc documentation for activerecord-oracle_enhanced-adapter-1.2.2...
development:
adapter: oracle_enhanced
host: localhost
database: orcl
username: glassfish
password: glassfish
bookstore >~/tools/jruby/bin/jruby script/generate scaffold book title:string author:string
JRuby limited openssl loaded. gem install jruby-openssl for full support.
http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
exists app/models/
exists app/controllers/
exists app/helpers/
create app/views/books
exists app/views/layouts/
exists test/functional/
exists test/unit/
create test/unit/helpers/
exists public/stylesheets/
create app/views/books/index.html.erb
create app/views/books/show.html.erb
create app/views/books/new.html.erb
create app/views/books/edit.html.erb
create app/views/layouts/books.html.erb
create public/stylesheets/scaffold.css
create app/controllers/books_controller.rb
create test/functional/books_controller_test.rb
create app/helpers/books_helper.rb
create test/unit/helpers/books_helper_test.rb
route map.resources :books
dependency model
exists app/models/
exists test/unit/
exists test/fixtures/
create app/models/book.rb
create test/unit/book_test.rb
create test/fixtures/books.yml
create db/migrate
create db/migrate/20091005233152_create_books.rb
bookstore >~/tools/jruby/bin/jruby script/generate jdbc
JRuby limited openssl loaded. gem install jruby-openssl for full support.
http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
exists config/initializers
create config/initializers/jdbc.rb
exists lib/tasks
create lib/tasks/jdbc.rake
~/samples/v3/rails/oracle/bookstore >~/tools/jruby/bin/jruby -S rake db:migrate
(in /Users/arungupta/samples/v3/rails/oracle/bookstore)
== CreateBooks: migrating ====================================================
-- create_table(:books)
-> 0.0740s
-> 0 rows
== CreateBooks: migrated (0.0750s) ===========================================
~/samples/v3/rails/oracle/bookstore >~/tools/jruby/bin/jruby -S glassfish -l
Starting GlassFish server at: 129.145.133.197:3000 in development environment...
Writing log messages to: /Users/arungupta/samples/v3/rails/oracle/bookstore/log/development.log.
Press Ctrl+C to stop.
Oct 6, 2009 9:45:51 AM com.sun.enterprise.v3.services.impl.GrizzlyProxy start
INFO: Listening on port 3000
. . .






So we created a brand new JRuby/Rails application and ran it using GlassFish and Oracle backend. A subsequent blog entry will show how to create a similar application using an existing database.
A complete archive of all the TOTDs is available here. The complete list of Rails blog entries are available here.
This and other similar applications will be demonstrated at the upcoming Oracle Open World.
Technorati: totd oracle database glassfish v3 jruby rails oow
Posted by Arun Gupta in General | Comments[0]
|
|
|
|
|
Sunday October 04, 2009
Silicon Valley Code Code Camp 2009 Trip Report
The Foothill college was sprawling with developers, architects, engineers, et al from all over the San Francisco Bay Area to attend the Silicon Valley Code Camp 2009. This was my third speaking engagement (2008, 2007) and the code camp has certainly matured over the last years. The attendance is steadily growing and the quality of sessions is become more mature as well.
I presented on Java EE 6, GlassFish, and Eclipse Tooling for GlassFish/Java EE 6 and the slides are available below:
and
Both the talks were demo intensive and showed Deploy-on-Save, Preserving session state across deployments, Java EE 6 wizards in NetBeans (1, 2, 3, 4, 5) and Eclipse (1, 2, 3), Metro JAX-WS Web services development in Eclipse, GlassFish v3 Monitoring, GlassFish v3 REST interface to management and monitoring and many others. All the demos are available as screencasts and/or blog entries and the complete set of links are listed in the presentations.
Here are some pictures from the event:
That's it folks, see ya next year!
Technorati: siliconvalleycodecamp svcc glassfish javaee eclipse
Posted by Arun Gupta in General | Comments[0]
|
|
|
|
|
Friday October 02, 2009
TOTD #109: How to convert a JSF managed bean to JSR 299 bean (Web Beans) ?
This entry is a follow up to TOTD #95 and shows how to use the recent integrations of JSR 299 in GlassFish v3 to convert a JSF managed bean to a JSR 299 bean (aka Web Beans). The TOTD #95 describes a simple Java EE 6 web application that uses Java Server Faces 2.0 components for displaying the results of a database query conducted by EJB 3.1 and JPA 2.0 classes.
The EJB class, which also acts as the JSF managed bean, looks like:
@javax.ejb.Stateless
@ManagedBean
public class StateList {
@PersistenceUnit
EntityManagerFactory emf;
public List getStates() {
return emf.createEntityManager().createNamedQuery(”States.findAll”).getResultList();
}
}
Three changes are required to convert this class into a JSR 299 compliant bean (Web Bean) as listed below:
@PersistenceUnit
EntityManagerFactory emf;
EntityManager emf = Persistence.createEntityManagerFactory("HelloEclipseLinkPU");

That's it, re-deploy your application and now you are using the Web Beans integration in GlassFish v3 instead of JSF managed bean. The output is available at "http://localhost:8080/HelloEclipseLink/forwardToJSF.jsp" as shown:
This is the exact same output as shown in TOTD #95.
Now, one-by-one, JPA, EJB, Transactions and other components will start working. Read Roger's blog for another example of Web Beans in GlassFish.
A complete archive of all the tips is available here.
Technorati: totd glassfish v3 mysql javaee6 javaserverfaces webbeans jsr299 netbeans
Posted by Arun Gupta in General | Comments[2]
|
|
|
|
|
Thursday October 01, 2009
TOTD #106 explained how to install Oracle database 10g R2 on Mac OS X. TOTD #107 explained how to connect this Oracle database using NetBeans. This Tip Of The Day will explain how to use the sample HR database (that comes with Oracle database server) to write a simple Java EE 6 application.
This application will use Java Server Faces 2.0 for displaying the results, Enterprise Java Beans 3.1 + Java Persistence API 2.0 for middle tier, and Oracle database server + GlassFish v3 as the backend. The latest promoted build (65 of this writing) will not work because of the issue #9885 so this blog will use build 63 instead.
Several improvements have been made over NetBeans 6.8 M1 build and this blog is using the nightly build of 9/27. The environment used in this blog is:
Lets get started!
./bin/asadmin start-domain --verbose &
./bin/asadmin create-jdbc-connection-pool --datasourceclassname oracle.jdbc.pool.OracleDataSource --restype javax.sql.DataSource --property "User=hr:Password=hr:URL=jdbc\:oracle\:thin\:@localhost\:1521\:orcl" jdbc/hr
./bin/asadmin ping-connection-pool jdbc/hr
./bin/asadmin create-jdbc-resource --connectionpoolid jdbc/hr jdbc/hr









@javax.ejb.Stateless
@javax.faces.bean.ManagedBean
@PersistenceUnit
EntityManagerFactory emf;
public List getEmployees() {
return em.createNamedQuery("Employees.findAll").getResultList();
}
@Stateless
@ManagedBean
public class EmployeesBean {
@PersistenceContext
EntityManager em;
public List getEmployees() {
return em.createNamedQuery("Employees.findAll").getResultList();
}
}
<h1>First Java EE 6 app using Oracle database</>
<h:dataTable var="emp" value="#{employeesBean.employees}" border="1">
<h:column><h:outputText value="#{emp.lastName}"/>, <h:outputText value="#{emp.firstName}"/></h:column>
<h:column><h:outputText value="#{emp.email}"/></h:column>
<h:column><h:outputText value="#{emp.hireDate}"/></h:column>
</h:dataTable>

So we can easily create a Java EE 6 application using NetBeans, Oracle, and GlassFish.
A complete archive of all the TOTDs is available here.
This and other similar applications will be demonstrated at the upcoming Oracle Open World.
Technorati: totd oracle database glassfish v3 javaee javaserverfaces ejb jpa netbeans oow
Posted by Arun Gupta in General | Comments[0]
|
|
|
|
| Running Summary Q3 2009 – 400 miles, 80% of running days
Here is the summary of my running logs from Q3 2009 (Jul - Sep):

Even though 3 days of less running than Q2, but the overall mileage was increased. Barely hit that 400 miles mark in Q3 and it did took some extra efforts to reach there ;-) But now tapering for the upcoming Rock-n-Roll 1/2 Marathon this weekend.

5 miles was the most favorite distance being run 17 times and 19.7 miles and 17.4 miles were run only once.
Would you like to generate similar charts for your running logs as well ?
This can be easily achieved using a Rails application or a Wicket application on GlassFish.
Technorati: rails wicket glassfish running rnrsj
Posted by Arun Gupta in Running | Comments[0]
|
|
|
|
|
Thursday September 24, 2009
Q&A Transcript from “Develop, Deploy, and Scale your Rails app with GlassFish” webinar
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 sun.com/software/webinars.
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?
A: http://rubyonrails.org/
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 http://wiki.glassfish.java.net/Wiki.jsp?page=GettingStartedGuide
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 http://wiki.glassfish.java.net/Wiki.jsp?page=GettingStartedGuide
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
A: http://rubyonrails.org/
Q: what is jruby?
A: Pure Java based Ruby interpreter. Checkout jruby.org
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 http://wiki.glassfish.java.net/Wiki.jsp?page=ConfiguringJRubyRuntimePool
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 engineyard.com 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: 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 @sun.com
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 www.sun.com/software/webinars - 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 users@glassfish.dev.java.net
Q: What is Rail Application
A: Check out http://rubyonrails.org 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 users@glassfish.dev.java.net
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: glassfish.dev.java.net 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 sun.com/software/webinars.
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: http://www.sun.com/software/webinars/ - 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: sun.com/glassfish/resources 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.
Q: JAVA AND JAVAC NO WHERE IN PICTURE
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 http://javaevangelist.blogspot.com/2009/08/redmine-084-deployment-on-glassfish-21.html
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 jruby.org 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: http://docs.sun.com/app/docs/doc/819-3656/6n5s3qjga?a=view - 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: http://blogs.sun.com/theaquarium/entry/more_glassfish_books. Practical JRuby on Rails is a nice book as well (http://www.rubyinside.com/practical-jruby-on-rails-book-by-ola-bini-625.html).
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 dev@glassfish.dev.java.net
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: http://blogs.sun.com/theaquarium/entry/more_glassfish_books. Practical JRuby on Rails is a nice book as well (http://www.rubyinside.com/practical-jruby-on-rails-book-by-ola-bini-625.html).
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 http://jcp.org/en/jsr/detail?id=313
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 users@glassfish.dev.java.net.
Q: opensource+jruby+glassfish resources on the web?
A: jruby.org for JRuby, glassfish.org 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
Q: 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 glassfish@sun.com 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 user@jruby.codehaus.org 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: http://www.javapassion.com/rubyonrails/.
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 users@glassfish.dev.java.net.
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 user@jruby.codehause.org.
Q: Great job guys! I am excited to use this.
A: Thanks, let us know your feedback on users@glassfish.dev.java.net.
Q: can glassfish be installed on amazon ec2?
A: Yes. There is an AMI with GlassFish, OpenSolaris, and MySQL
A: http://wikis.sun.com/display/sunsoftwareincloud/EC2+Glassfish
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 jruby.org.
Interested in watching a replay of the webinar ? Go to www.sun.com/offers/details/rails_apps.xml for all the details.
Technorati: glassfish rubyonrails jruby webinar netbeans
Posted by Arun Gupta in General | Comments[0]
|
|
|
|
|
Wednesday September 23, 2009
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:
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 "*"
server
server.containers
server.containers.jruby
server.containers.jruby.applications
server.containers.jruby.http
server.containers.jruby.http.redmine-0.8.5
server.containers.jruby.runtime-pool
server.containers.jruby.runtime-pool.redmine-0.8.5
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*"
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(com.sun.xml.ws.transport.http.servlet.ServletAdapter)
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);
moduleStartedParams[0]="appName";
moduleStartedParams[1]="applicationType";
moduleStartedParams[2]="environment";
moduleStartedParams[3]="jrubyVersion";
scriptContainer.registerListener('glassfish:jruby:jruby-container:jrubyModuleStartedEvent', moduleStartedParams, 'moduleStarted');
moduleStoppedParams = java.lang.reflect.Array.newInstance(java.lang.String, 3);
moduleStoppedParams[0]="appName";
moduleStoppedParams[1]="applicationType";
moduleStoppedParams[2]="environment";
scriptContainer.registerListener('glassfish:jruby:jruby-container:jrubyModuleStoppedEvent', moduleStoppedParams, 'moduleStopped');
requestStartParams = java.lang.reflect.Array.newInstance(java.lang.String, 3);
requestStartParams[0]="contextPath";
requestStartParams[1]="serverName";
requestStartParams[2]="port";
scriptContainer.registerListener('glassfish:jruby:http:requestStartEvent', requestStartParams, 'requestStarted');
requestEndParams = java.lang.reflect.Array.newInstance(java.lang.String, 2);
requestEndParams[0]="contextPath";
requestEndParams[1]="statusCode";
scriptContainer.registerListener('glassfish:jruby:http:requestEndEvent', requestEndParams, 'requestEnded');
runtimePoolParams = java.lang.reflect.Array.newInstance(java.lang.String, 3);
runtimePoolParams[0]="appName";
runtimePoolParams[1]="activeRuntimes";
runtimePoolParams[2]="queueSize";
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 (default) |
Monitoring=HIGH (no data printed) |
Monitoring=HIGH (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
Posted by Arun Gupta in General | Comments[0]
|
|
|
|
|
Friday September 18, 2009
Free Rails/GlassFish Webinar with live Q&A: Sep 23, 2009,10am PT
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
Posted by Arun Gupta in General | Comments[0]
|
|
|
|
| TOTD #104: Popular Ruby-on-Rails applications on GlassFish v3 – Redmine, Typo, Substruct
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.
~/tools/glassfish/v3/9-16 >unzip ~/Downloads/glassfish-v3-b64-09_16_2009.zip
~/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.~/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:
http://wiki.updatecenter.java.net/Wiki.jsp?page=UsageMetricsUC2
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).


~/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:
http://wiki.updatecenter.java.net/Wiki.jsp?page=UsageMetricsUC2
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).
~/tools/glassfish/v3/9-16/glassfishv3 >./bin/pkg list -a
NAME (PUBLISHER) VERSION STATE UFIX
ant (contrib.glassfish.org) 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 (contrib.glassfish.org) 1.8.1-2.0 known ----
jruby 1.3.1-1.1 known ----
jruby (contrib.glassfish.org) 1.2.0-1.1 known u---
jruby-gems (contrib.glassfish.org) 2.3.2-1.1 known ----
jython-container (contrib.glassfish.org) 0.5.3-1.0 known ----
jython-runtime (contrib.glassfish.org) 2.5.0-1.0 known ----
metro 2.0-19 installed ----
. . .
updatetool 2.3.0-36.2403 known ----
updatetool (contrib.glassfish.org) 2.2.2-30.2311 known u---
wxpython2.8-minimal 2.8.10.1-36.2403 known ----
wxpython2.8-minimal (contrib.glassfish.org) 2.8.8-30.2311 known u---
~/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
sed s/'adapter: mysql'/'adapter: jdbcmysql'/ <config/database.yml.new >config/database.yml~/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.




sed s/'adapter: mysql'/'adapter: jdbcmysql'/ <config/database.yml.example >config/database.yml~/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.
http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
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...~/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.



~/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~/samples/jruby/substruct/substruct_rel_1-0-a6>sed s/'adapter: mysql'/'adapter: jdbcmysql'/ <config/database.yml
>config/database.yml.new
~/samples/jruby/substruct/substruct_rel_1-0-a6>mv config/database.yml.new config/database.yml
~/samples/jruby/substruct/substruct_rel_1-0-a6 >~/tools/glassfish/v3/9-16/glassfishv3/glassfish/jruby/bin/jruby -S rake substruct:db:bootstrap~/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.
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
Posted by Arun Gupta in web2.0 | Comments[0]
|
|
|
|
|
Wednesday September 16, 2009
FishCAT – GlassFish v3 Community Acceptance Testing

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
Posted by Arun Gupta in General | Comments[0]
|
|
|
|
|
Tuesday September 15, 2009
TOTD #103: GlassFish v3 with different OSGi runtimes – Felix, Equinox, and Knoplerfish
GlassFish v3 uses standard OSGi APIs to achieve modularity. It bundles Apache Felix 2.0 as the OSGi runtime and can run on any other OSGi R4.1 compliant runtimes as well. This blog will use previously described instructions and show how to run GlassFish v3 on Eclipse Equinox and Knoplerfish. The complete details about different OSGi runtimes is described here, this TOTD provide detailed steps and overrides the instructions defined here (and here and here).
This blog is using a CI build from last week but you should try the instructions on a promoted build.
GlassFish with Felix - Felix 2.0.0 is bundled with GlassFish v3 and requires no additional configurations.
~/tools/glassfish/v3/2269/glassfishv3/glassfish >./bin/asadmin start-domain --verbose
Sep 11, 2009 4:41:16 PM com.sun.enterprise.glassfish.bootstrap.ASMain main
INFO: Launching GlassFish on Felix platform
Welcome to Felix
================
. . .
Sep 11, 2009 4:41:30 PM com.sun.enterprise.v3.server.AppServerStartup run
INFO: GlassFish v3 startup time : Felix(9669ms) startup services(4453ms) total(14122ms)
Optionally, connect to Felix runtime using Apache Felix Remote Shell (described here) as:
~/tools/glassfish/v3/2269/glassfishv3 >telnet localhost 6666
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying fe80::1...
telnet: connect to address fe80::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Felix Remote Shell Console:
============================
->
and type "help" to see the list of commands available as:
-> help
bundlelevel
cd
find
headers
help
inspect
install
log
ps
refresh
resolve
shutdown
start
startlevel
stop
uninstall
update
version
Use 'help ' for more information.
-> ps
START LEVEL 1
ID State Level Name
[ 0] [Active ] [ 0] System Bundle (2.0.0)
[ 1] [Active ] [ 1] HK2 OSGi Main Bundle (0.3.91)
[ 2] [Installed ] [ 1] EclipseLink Core (2.0.0.v20090821-r4934)
[ 3] [Resolved ] [ 1] Hibernate validator library and Validation API (JSR 303) repackaged as OSGi and HK2 bundle (3.0.0.JBoss-400Beta3)
[ 4] [Installed ] [ 1] Connector (gluecode) for GlassFish Java EE Connector Architecture Runtime (3.0.0.SNAPSHOT)
[ 5] [Active ] [ 1] GlassFish Flashlight Framework (3.0.0.SNAPSHOT)
. . .
[ 201] [Resolved ] [ 1] glassfish-corba-asm (3.0.0.b024)
[ 202] [Resolved ] [ 1] MIME streaming extension (1.4)
[ 203] [Installed ] [ 1] Admin Console Connectors Plugin (3.0.0.SNAPSHOT)
[ 204] [Installed ] [ 1] Apache Felix Shell TUI (1.4.0)
[ 205] [Resolved ] [ 1] org.glassfish.core.glassfish-extra-jre-packages
GlassFish on Equinox
~/tools/glassfish/v3/2269/glassfishv3/glassfish >unzip ~/Downloads/equinox-SDK-3.5.zip -d ~/tools/equinox-3.5
~/tools/glassfish/v3/2269/glassfishv3/glassfish >cp ~/tools/equinox-3.5/plugins/org.eclipse.osgi_3.5.0.v20090520.jar ./osgi/equinox
~/tools/glassfish/v3/2269/glassfishv3 >GlassFish_Platform=Equinox ./bin/asadmin start-domain --verbose
Sep 11, 2009 5:11:13 PM com.sun.enterprise.glassfish.bootstrap.ASMain main
INFO: Launching GlassFish on Equinox platform
Listening on port 6667 ...
. . .
Sep 11, 2009 5:11:19 PM com.sun.enterprise.v3.server.AppServerStartup run
INFO: GlassFish v3 startup time : Equinox(3649ms) startup services(1843ms) total(5492ms)
~/tools/glassfish/v3/2269/glassfishv3/glassfish >telnet localhost 6667
Trying ::1...
Connected to localhost.
Escape character is '^]'.
osgi>
osgi> help
---Controlling the OSGi framework---
launch - start the OSGi Framework
shutdown - shutdown the OSGi Framework
close - shutdown and exit
exit - exit immediately (System.exit)
init - uninstall all bundles
setprop = - set the OSGi property
---Controlling Bundles---
. . .
---Controlling the Console---
more - More prompt for console output
disconnect - Disconnects from telnet session
osgi> ss
Framework is launched.
id State Bundle
0 ACTIVE org.eclipse.osgi_3.5.0.v20090520
Fragments=62, 128, 205
1 ACTIVE com.sun.enterprise.osgi-main_0.3.91
2 RESOLVED org.eclipse.persistence.core_2.0.0.v20090821-r4934
Fragments=136
. . .
203 RESOLVED org.glassfish.admingui.console-jca-plugin_3.0.0.SNAPSHOT
204 RESOLVED org.apache.felix.shell.tui_1.4.0
205 RESOLVED org.glassfish.core.glassfish-extra-jre-packages_0.0.0
Master=0
GlassFish with Knoplerfish - As mentioned here, GlassFish v3 requires at least R4.1 APIs. All Knopflerfish releases prior to 3.0.0 are R4 compliant and so will not work with the GlassFish v3 latest builds. Knopflerfish 3.0.0 beta1 is the first build that is R4.2 compliant but it does not start on Mac OS X 10.5.8 as described in issue #2858798. So until then, you you can follow the instructions documented at GlassFish v3 on OSGi KnopflerFish and Using KnopflerFish Desktop in GlassFish v3 to get them running on GlassFish v3 TP2 or Prelude.
Some additional details missing form the entries above
~/tools/glassfish/v3/2269/glassfishv3/glassfish >KNOPFLERFISH_HOME=/Users/arungupta/tools/knopflerfish_osgi_2.3.3/knopflerfish.org/osgi GlassFish_Platform=Knopflerfish ./bin/asadmin start-domain --verbose
and see the following messages in the log:
Knopflerfish OSGi framework, version 4.1.10
Copyright 2003-2009 Knopflerfish. All Rights Reserved.
See http://www.knopflerfish.org for more information.
Loading xargs url file:/Users/arungupta/tools/knopflerfish_osgi_2.3.3/knopflerfish.org/osgi/gf.xargs
Removed existing fwdir /Users/arungupta/tools/knopflerfish_osgi_2.3.3/knopflerfish.org/osgi/fwdir
Installed: file:/Users/arungupta/tools/glassfish/v3/glassfishv3-tp2/glassfish/modules/tiger-types-osgi-0.2.1.jar (id#1)
Installed: file:/Users/arungupta/tools/glassfish/v3/glassfishv3-tp2/glassfish/modules/auto-depends-0.2.1.jar (id#2)
Installed: file:/Users/arungupta/tools/glassfish/v3/glassfishv3-tp2/glassfish/modules/config-0.2.1.jar (id#3)
. . .
Started: file:/Users/arungupta/tools/glassfish/v3/glassfishv3-tp2/glassfish/modules/cm_all-2.0.1.jar (id#7)
Started: file:/Users/arungupta/tools/glassfish/v3/glassfishv3-tp2/glassfish/modules/console_all-2.0.1.jar (id#8)
Started: file:/Users/arungupta/tools/glassfish/v3/glassfishv3-tp2/glassfish/modules/desktop_all-2.3.11.jar (id#11)

The instructions will be updated after a more stable release of Knopflerfish is available.
A complete archive of all the tips is available here.
Technorati: totd glassfish v3 osgi apache felix eclipse equinox knopflerfish
Posted by Arun Gupta in General | Comments[0]
|
|
|
|
|
Monday September 14, 2009
TOTD #102: Java EE 6 (Servlet 3.0 and EJB 3.1) wizards in Eclipse
The Eclipse community's WTP release with Java EE 6 support has been delayed to Jun 2010. So how do you do Java EE 6 development in Eclipse until then ?
The GlassFish team is trying to bridge the gap by adding new Java EE 6 wizards that allows you to create Servlet 3.0- (JSR 315) and EJB 3.1- (JSR 318) compliant artifacts. So for the first time, in Eclipse, a Java EE 6 application can be created using the GlassFish plugin for Eclipse (ver 1.0.32)! GlassFish v3 is the Java EE 6 in making and so Eclipse and GlassFish v3 together provides you a good environment for your Java EE 6 development.
This Tip Of The Day (TOTD) explains how to use those wizards using Eclipse 3.4.2. If you have an earlier version of plugin already installed then update it as described in TOTD #66. Make sure to use ver 1.0.33 (recently released) if you are using Eclipse 3.5.x. If you have an earlier version of GlassFish plugin installed, then you may have to start Eclipse with "-clean" flag, basically as "eclipse -clean", after updating the plugin. This will allow the environment to detect the new plugins.






protected void doProcess(HttpServletRequest request, HttpServletResponse response) throws IOException {
ServletOutputStream out = response.getOutputStream();
out.print("<html><body>");
out.print("Request received at: " + request.getContextPath());
out.print("</body></html>");
}




public String sayHello(String name) {
return "Hello " + name;
}
@EJB HelloBean bean;
protected void doProcess(HttpServletRequest request, HttpServletResponse response) throws IOException {
ServletOutputStream out = response.getOutputStream();
out.print("<html><body>");
out.print("Request received at: " + request.getContextPath());
out.print("<br>" + bean.sayHello("Duke"));
out.print("</body></html>");
}

So we built a Java EE 6 application using the newly added Servlet 3.0 and EJB 3.1 wizards in GlassFish Plugin for Eclipse.
Please send your feedback and questions to users@glassfishplugins.dev.java.net. Let us know what other Java EE 6 features you'd like to see in Eclipse.
A complete archive of all the tips is available here.
Technorati: totd glassfish v3 eclipse javaee servlet3 ejb
Posted by Arun Gupta in General | Comments[0]
|
|
|
|
|
Friday September 04, 2009
TOTD #101: Applying Servlet 3.0/Java EE 6 “web-fragment.xml” to Lift – Deploy on GlassFish v3
TOTD #100 explained how to deploy Lift framework applications on GlassFish v3. As explained in TOTD #91, Java EE 6 defines how the framework configuration deployment descriptor can be defined in “META-INF/web-fragment.xml” in the JAR file of the framework instead of mixing it with "WEB-INF/web.xml" which is intended for application deployment descriptor aspects.
This Tip Of The Day (TOTD) explains how to leverage ”web-fragment.xml” to deploy a Lift application on a Java EE 6 compliant container. The original "lift-*.jar" files are untouched and instead a new JAR file is included that contains only the framework configuration deployment descriptor.
The generated "web.xml" from TOTD #100 looks like:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<filter>
<filter-name>LiftFilter</filter-name>
<display-name>Lift Filter</display-name>
<description>The Filter that intercepts lift calls</description>
<filter-class>net.liftweb.http.LiftFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>LiftFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
The deployment descriptor defines a Servlet Filter (LiftFilter) that registers the Lift framework with the Web container. And then it defines a URL mapping to "/*". All of this information is required by the Lift framework for request dispatching. And so that makes this fragment suitable for "web-fragment.xml".
Here are simple steps to make this change:
<dependencies>
. . .
<!– web-fragment –>
<dependency>
<groupId>org.glassfish.extras</groupId>
<artifactId>lift-web-fragment</artifactId>
<version>1.0</version>
<scope>runtime</scope>
</dependency>
</dependencies>
. . .
<repositories>
<repository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net Repository for Maven</name>
<url>http://download.java.net/maven/2/</url>
</repository>
</repositories>
This file contains only “META-INF/web-fragment.xml” with the following content:
<web-fragment>
<filter>
<filter-name>LiftFilter</filter-name>
<display-name>Lift Filter</display-name>
<description>The Filter that intercepts lift calls</description>
<filter-class>net.liftweb.http.LiftFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>LiftFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-fragment>
<build>
. . .
<plugins>
. . .
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1-beta-1</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
That's it, now now you can create a WAR file using “mvn package” and deploy this web application on GlassFish v3 latest promoted build (61 as of today) as explained in TOTD #100.
Technorati: totd glassfish v3 lift scala javaee6 servlet web-fragment
Posted by Arun Gupta in General | Comments[0]
|
|
|
|
|
Today's Page Hits: 1186
Total # blog entries: 1009