2-day Java EE 6 & GlassFish workshops in Germany, Czech Republic, Hungary - Register now!
- Are you interested in learning the nuts and bolts of the Java EE 6 platform ?
- Do you want to learn on how Servlet 3.0, Java Server Faces 2.0, Context & Dependency Injection 1.0, Enterprise JavaBeans 3.1, Bean Validation 1.0, Java Persistence API 2, RESTful Web services and other new technologies in Java EE 6 provide a complete stack for building your Web & Enterprise applications ?
- GlassFish 3.1 adds clustering, high availability, application versioning and other interesting featuresm, above light-weight, OSGi-based modularity, and embeddability, making it the richest open source application server.
- Did you know that NetBeans, Eclipse, and IntelliJ provide comprehensive tooling around Java EE 6 and would like to learn it ?
If you are interested in learning any of these details then I'll be delivering 2-day workshops in 3 countries across Europe. The complete details about the venue and cost are available in the links below:
This is going to be a complete deep dive for 2 days and extensive hands-on experience.
Be ready to drink from the fire hose and learn how you can leverage Java EE 6 in your next project to boost the productivity and simplify the development and deployment of your applications.
Register now!
Technorati: conf javaee6 glassfish workshop germany czech hungary
Java EE 6 & GlassFish workshop delivered at San Francisco JUG - Slides & Demos available
Roberto and I delivered a 2-part Java EE 6 & GlassFish 3 workshop to a packed San Francisco JUG meetup last week. There were about 80 attendees on Day 1 and about 40 on Day 2. Over approximately 7 hours, we gave a preview of Java EE 6, explained the key technologies introduced in the platform, and did lot of coding using NetBeans IDE.
Roberto's slides are given below:
Overview of Java EE 6 by Roberto Chinnici at SFJUGAnd my slides are next:
JavaEE 6 and GlassFish v3 at SFJUGThe completed project from the workshop is now available here. This bundle contains the entire code sample built through out the workshop. The coding sessions are also available in screencast #30, also shown below:
Here is some feedback from the attendees:
The best JUG meeting I've ever attended. It was very informative, helpful and relevant. I particularly liked Arun's follow-along coding demonstrations. I would suggest that the speakers be encouraged to use a mic. If I had not been sitting two rows from the front, then I would have had a hard time hearing Roberto.
It was interesting to hear from the source which parts of EE6 they thought were most valuable, and where new things overlapped with old, and what advantages there were in using standards-based solutions over frameworks like Spring, even when they tend to be behind in usability and power. Also liked the taste of NetBeans, being an Eclipse user.
Very fruitful evening. Thanks so much to the speakers and organizers.
I really enjoyed both nights. There were several JEE 6 (now I now the correct way to say it) technologies that I had heard of but quite didn't understand ... especially in regards to how they integrate. Now I do.…
Thanks aleksandar for organizing this JavaEE6 learning series. It was very helpful and head start on the cool features of EE6. Thanks to arun and Roberto for there well written presentations and hands on workshop. Will look forward for part 2 of this series.
Really enjoyed. Roberto gave a good high level overview of JavaEE (and he was funny) and Arun's talk was educational and easy to follow along with. Very impressed with how easy it was to get the examples working with NetBeans. Looking forward to Thursday.
Really enjoyed both presentations. The fact that it was hands on added an extra dimension to the learning experience. Looking forward to the next session. Thanks to Roberto and Arun!
This was a fantastic intro to Java EE 6. I really liked Roberto's down-to-earth overview of Java EE and its role in the enterprise Java world. In his workshop, Arun did an amazing job making Java EE 6 on GlassFish with NetBeans feel really approachable - if not too easy. Great participation from the audience.
The hands-on component worked great for me.
And the ratings are encouraging too ...

As always, there is room for improvement and lessons to learn. However I enjoyed the fact that most of the attendees were able to follow the instructions and able to reproduce the code samples. One of the attendees even told me "I've no reason to not try Java EE 6 & NetBeans now that there is a complete environment on my laptop". And that indeed was the intention ;-)
Check out some pictures:
Thank you Sasa for giving us an opportunity to talk about Java EE 6 & GlassFish 3 at San Francisco JUG! We had a great time and it seems like the attendees enjoyed too :-)
Technorati: conf sanfrancisco jug sfjug glassfish javaee6
TOTD #144: CDI @Produces for container-managed @Resource
Contexts & Dependency Injection (CDI) in Java EE 6 provides type-safe dependency injection. The type-safety part comes from the fact that no String-based identifiers are used for dependency injection. Instead CDI runtime uses the typing information that is already available in the Java object model.
Java EE 5 already had resource injection available in terms of PersistenceContext, PersistenceUnit, Resource, and others. But they require String-based identifiers to identify the resource to be injected. For example:
- @PersistenceUnit(unitName="SOME_NAME")
- @Resource(name="JNDI_NAME")
- @WebServiceRefs(lookup="JNDI_NAME_OF_WEB_SERVICE_REF")
The main proposition of CDI is type-safety. This Tip Of The Day explains how @Produces annotation provided by CDI can be used to centralize all these String-based resource injection and add a facade of type-safety on them. Specifically, it shows how type-safety can be achieved for @PersistenceUnit. A similar approach can be taken for other String-based resource injections as well.
-
Create a Singleton-scoped bean or Application-scoped bean as:
import javax.inject.Singleton; @Singleton public class ApplicationResources { }
All the Java EE component environment references can be centralized in this bean. -
If the PersistenceUnit is currently initialized as:
@PersistenceUnit(unitName="StatesPU") EntityManagerFactory statesEMF;
in other Java EE components, such as Servlet, then it can be alternatively defined in the type-safe manner using the following steps:-
Define a new Qualifier as:
import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.inject.Qualifier; @Qualifier @Retention(RUNTIME) @Target({METHOD, FIELD, PARAMETER, TYPE}) public @interface StatesDatabase { } -
Add the type-safe definition of "EntityManagerFactory" in "ApplicationResources" bean (defined above) as:
@Produces @PersistenceUnit(unitName="StatesPU") @StatesDatabase EntityManagerFactory statesEMF;
-
The "EntityManagerFactory" can now be injected in the Servlet in a type-safe manner as:
@Inject @StatesDatabase EntityManagerFactory emf;
-
Define a new Qualifier as:
This procedure can be repeated for other String-based resources as well and thus centralize all of them at one place. And now your application becomes more type-safe! With this TOTD, you can use @Inject for injecting your container- and application-managed resources easily.
Read the latest documentation on Weld (Reference Implementation for CDI and included in GlassFish) for more details.
Technorati: totd cdi javaee6 glassfish weld produces typesafety
IndicThreads Cloud Computing 2010 Trip Report
IndicThreads.com had their inaugural conference on Upcoming Technology on Aug 20/21 in the city of Pune, India. As the name says, the goal of this conference is to talk about upcoming technologies and Cloud Computing was the chosen topic this time. Harshad & Sangeeta Oak - the driving forces behind Rightrix and this conference made it clear that this conference is not intended to be a training and the aim is to present the latest happening in the cloud world and get the attendees thinking. BTW, Harshad is also an Oracle ACE Director and a Java Champion. The theme of the conference was easily summarized in "Learn, Discuss, Debate, Argue".
Please provide feedback for the sessions at http://u10.indicthreads.com/feedback.
I gave a session on "Running your Java EE 6 applications in the Cloud" and the slides are available below:
Running your Java EE 6 applications in the CloudI continue to stick to my philosophy of "Code is king" and showed several code samples & screen snapshots. Several attendees told me afterwards that they liked the session because it was well grounded.
The conference had a single track which gives you the ability to attend all the sessions, and there were several of them. Here are my brief notes from some of the sessions I attended. All the slides from different sessions are given below:
And now some notes ...
Cloud computing - making the right choice by Kalpak Shah
-
Why cloud ?
- No capital expenditure, only operational expenses
- Reduced IT administration
- Elasticity - Fast & inherent scale up/down
- Commoditization of IT - Only storage, only content delivery, only messaging
- Automation using APIs
- Pay-as-you-go for tools & ecosystem
- Reduced time to market, focus on core competency
-
Explained the concept of Iaas, PaaS, SaaS, and then Storage-as-a-Service (yet another SaaS)
-
Consideration for IaaS
- Combine Support & Infrastructure - Amazon is cheap for infrastructure, costly for support
- Cores are much slower on Amazon, faster on Rackspace
- Good matrix for comparing IaaS vendors
-
Comparing PaaS & SaaS vendors
- Development language & available skill sets
- Ease of deployment & maintenance
- Size of vendor & ecosystem maturity
- Tools, monitoring, connectors, adaptors
- Maturity of API & bindings available
- Does vendor allow private cloud integration ?
-
Consideration for IaaS
-
Ways to Cloudify
- Public clouds - Large datacenters, provide many services (CPU, storage, CDN, databases, etc), can try it, but comes with security, latency & bandwidth issues
- Private clouds Normal on-premise databcenters with cloud with all usual benefits of elasticity, self-service, pay-asyou-go, programmabilty, offerings from VMWare, IBM, Microsoft, Eucalyptus
- Hybrid clouds SaaS Virtual desktops for training Cloud storage for backup etc
-
Interesting private cloud platforms
- Eucalyptus - Open-source IaaS cloud computing platform, compatbile with AWS enabling almost seamless movement with AWS, Extremely flexible and easy to administer
- VMWare vCloud - Take the private cloud image, drag/drop on the public cloud and it just works. Platform is consistent & mature and it just works
- Appistry - Application platform for private, public, and hybrid clouds
- Rackspace - OpenStack compute and OpenStack storage
- VMOps
-
Azure
- Cloud services operating system
- Provide services across the entire cloud stack - IaaS, PaaS, SaaS
- Development, service hosting & management
- Integrated with exisitng on -premises environment
- Private cloud integration
- Reliance is using Azure for some of their projects
Architecture Challenges in Cloud Computing by Prabodh Navare
- Design for auto-scaling, high performance, failover, data portability, pay-as-you-go
- Vertical scalability - write algorithms that are efficient
- Horizontal scalability - Have the applications as simple/replicable as possible
- Options for private cloud in open Source - Eucalyptus, Ubuntu enterprise Cloud, Open nebula, Nimbus, redhat
Getting started with jClouds by Vikas Hazrati
- Fog, Deltacloud - Ruby-based multicloud library
- Libcloud - Python-based
- Dasein uses jclouds as their base API
-
jClouds easy to start
- Simple interface (Map object)
- OSS
- Runtime portability
- Java & Clojure
- Unit testability across clouds
- High performance because of NIO
- Blobstore (atmos, azure, rackspace, s3)
- Compute (vcloud, ec2, gogrid, ibmdev, rackspace, rimu)
- Not 100% but pragmatic portability, dig in with extensions
- Integration with Apache VFS to see the listing of Blobstore
Preparing data for your cloud by Narinder Kumar
-
Advantages of Non-relational DBMS
- Scalability
- Replication / Availability (less feature set but more performant)
- Performance
- Deployment flexibility
- Modeling flexibility
-
Disadvantages
- Lack of transactional support
- Data integrity is app's responsibility
- Data duplication is app dependent
- Eventual consistent
- No standardization
- New technology
-
RDBMS & Cloud
- MySQL, Oracle, PostgreSQL, DB2, SQL Server are cloud-capable RBDMS
- Microsoft SQL Services and AWS RDS are cloud native RDBMS
- SQL Azure is built on SQL Server and so very intuitive.
-
Non-relational DBMS
- Key value stores - Amazon Dynamo (not for public consumption), S3, Project Voldemort, Redis, Scalaris, MemCacheDB, Tokyo Tyrant
- Document stores - CouchDB, mongoDB, riak, Amazon SimpleDB
- Column stores - Google Column Store, Cassandra, HBase, Hypertable
- Graph stores
Day 2 had interesting sessions on Azure by Janakiram M from Microsoft, EC2 by Simone Burnozzi from Amazon and multi-tenancy by Vikas from Inphina.
The Unconference at the end of Day 1 had some interesting topics like Cloud Standards, how Cloud can help fight massive scale diseases, and what a Java stack needs to provide in the cloud.
Over all, I had a great time, enjoyed some great conversations with Dhananjay Nene, Vikas Hazrati, Narinder Kumar, Rohit Naik, Navin Kabra, Manju, Amarpal Singh, and several others. I hope more attendees can join us for an impromptu social gathering in the evening. Anyway, looking forward to participate in the future Upcoming Technology conferences and others hosted by IndicThreads.
Here are some pics from the event:
And the complete album:
Technorati: conf indicthreads cloud india puneTOTD #143: Retrieve Twitter user timeline using using Jersey and OAuth
The Basic Authentication for authorizing with Twitter API will be turned off on Aug 16th. After that OAuth will be the only way to invoke the API.
Beginner's guide to OAuth provide an excellent explanation to OAuth. The typical analogy for OAuth is a "valet key" to the car which is a stripped down version of your regular key. These keys are meant for valet drivers who don't need to open trunk or glove compartment and don't need to drive the car for longer distance. So even though they have access to the entire car but are restricted to the limited functionality.
OAuth is used to share your resources (photos, videos, bank accounts, etc) stored on one site with another site without having to share your username and password. The site storing the resources is "Service Provider", the site requesting the access is "Consumer", you are the "User", "Tokens" are "valet key" that provide required access to the resources.
This Tip Of The Day (TOTD) explains how Jersey, the Reference Implementation for JAX-RS, provides seamless support for OAuth by creating a simple desktop application that retrieves user timeline on Twitter using OAuth. This blog is going to combine the instructions outlined in Understanding the guts of Twitter's OAuth for client apps and Using Jersey client OAuth support with Smugmug to achieve that.
Lets get started!
-
Create a Maven project as:
mvn -DarchetypeVersion=1.0 -DgroupId=org.glassfish.samples -DarchetypeArtifactId=maven-archetype-quickstart -Dversion=1.0-SNAPSHOT -DarchetypeGroupId=org.apache.maven.archetypes -Dpackage=org.glassfish.samples.twitter -DartifactId=twitter
-
Update the generated "pom.xml" with the following fragments:
<repositories> <repository> <id>glassfish-repository</id> <name>Java.net Repository for Glassfish</name> <url>http://download.java.net/maven/2/</url> </repository> </repositories> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> <dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-client</artifactId> <version>1.1.3-SNAPSHOT</version> </dependency> <dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-json</artifactId> <version>1.1.3-SNAPSHOT</version> </dependency> <dependency> <groupId>com.sun.jersey.oauth</groupId> <artifactId>oauth-signature</artifactId> <version>1.1.2-ea-SNAPSHOT</version> </dependency> <dependency> <groupId>com.sun.jersey.oauth</groupId> <artifactId>oauth-client</artifactId> <version>1.1.2-ea-SNAPSHOT</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.0.2</version> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> </plugins> </build>
The Jersey dependencies add the core Jersey libraries and OAuth functionality in Jersey. - Register your app with Twitter - Register your application with Twitter by clicking on Register a new application >>. The complete list of registered applications can be seen at Applications using Twitter. Select "Client" as the app type, select "Yes, use Twitter for login" and leave the "Callback URL" empty. The registration gives you "consumer key" and "consumer secret". These are used to obtain temporary credentials (or request tokens) from Twitter.
-
Obtain Twitter OAuth credentials - Each OAuth request is an HTTP request with "Authorization" header specifying the information by OAuth service provider. Jersey provides a OAuthClientFilter to add this header to the outbound client request. Twitter API Wiki explains the authentication as multiple step process for desktop applications. Each step involves sending some parameters to twitter and getting a result back and the intent of each method/request is clearly explained in Understanding the guts of Twitter's OAuth for client apps. In our case, each request is created by using Jersey Client API and attaching OAuthClientFilter and is explained next.
-
Request temporary credentials, a.k.a request token, from Twitter using oauth/request_token.
-
In "App.java", create an instance of Jersey client in the constructor and attach a LoggingFilter to dump inbound/outbound messages as:
public App() { // Create a Jersey client client = Client.create(); client.addFilter(new LoggingFilter()); } -
Request temporary credentials by adding the following method:
public void getRequestToken() { client.removeAllFilters(); // Create a resource to be used to make Twitter API calls WebResource resource = client.resource(REQUEST_TOKEN_URL); // Set the OAuth parameters OAuthSecrets secrets = new OAuthSecrets().consumerSecret(CONSUMER_SECRET); OAuthParameters params = new OAuthParameters().consumerKey(CONSUMER_KEY). signatureMethod("HMAC-SHA1").version("1.0"); // Create the OAuth client filter OAuthClientFilter oauthFilter = new OAuthClientFilter(client.getProviders(), params, secrets); // Add the filter to the resource resource.addFilter(oauthFilter); // make the request and print out the result System.out.println(resource.get(String.class)); }Note, "OAuthClientFilter" is used to populate the "Authorization" header instead of handcrafting it. The REQUEST_TOKEN_URL is "http://twitter.com/oauth/request_token", CONSUMER_SECRET and CONSUMER_KEY are the values obtained from registering your application. -
Edit "AppTest.java" and change "testApp" method such that it looks like:
public void testApp() { App app = new App(); app.getRequestToken(); } -
Obtain the temporary credentials by running this application as:
mvn test
and see an output as:oauth_token=REQUEST_OAUTH_TOKEN&oauth_token_secret=REQUEST_OAUTH_TOKEN_SECRET&oauth_callback_confirmed=true
REQUEST_OAUTH_TOKEN, a temporary token, is used to authorize on twitter.com.
-
In "App.java", create an instance of Jersey client in the constructor and attach a LoggingFilter to dump inbound/outbound messages as:
-
Authorize the user and obtain PIN
- Go to "https://twitter.com/oauth/authorize?oauth_token=REQUEST_OAUTH_TOKEN" in a browser window.
- If not already logged in, enter your twitter credentials and click "Allow".
- Copy the PIN.
-
Request permanent credentials, a.k.a access token, from Twitter using oauth/access_token.
-
Request permanent credentials by adding the following method in "App.java"
public void getAccessToken() { client.removeAllFilters(); // Set the OAuth parameters OAuthSecrets secrets = new OAuthSecrets().consumerSecret(CONSUMER_SECRET); OAuthParameters params = new OAuthParameters().consumerKey(CONSUMER_KEY). signatureMethod("HMAC-SHA1"). version("1.0"). token(REQUEST_OAUTH_TOKEN). verifier(PIN); // Create the OAuth client filter OAuthClientFilter oauthFilter = new OAuthClientFilter(client.getProviders(), params, secrets); // Create a resource to be used to make Twitter API calls WebResource resource = client.resource(ACCESS_TOKEN_URL); // Add the filter to the resource resource.addFilter(oauthFilter); // make the request and print out the result System.out.println(resource.get(String.class)); }REQUEST_OAUTH_TOKEN is the temporary token obtained earlier, ACCESS_TOKEN_URL is "https://twitter.com/oauth/access_token".
Notice, REQUEST_OAUTH_TOKEN and PIN are now added to the OAuthClientFilter.
-
Invoke this method by editing "AppTest.java" as:
public void testApp() { App app = new App(); // app.getRequestToken(); app.getAccessToken(); } -
Obtain the permanent credentials by running this application as:
mvn test
and see an output as:
oauth_token=ACCESS_OAUTH_TOKEN&oauth_token_secret=ACCESS_OAUTH_TOKEN_SECRET&user_id=USER_ID&screen_name=USER_NAME
ACCESS_OAUTH_TOKEN is the authorized token that can be used for making any future requests, USER_ID and USER_NAME are identifiers for the user who signed in on twitter.com.
-
Request permanent credentials by adding the following method in "App.java"
-
Request temporary credentials, a.k.a request token, from Twitter using oauth/request_token.
-
Get the last 20 status messages for the user from Twitter
-
Add the following method in "App.java:
public void getUserTimeline() { client.removeAllFilters(); // Set the OAuth parameters OAuthSecrets secrets = new OAuthSecrets().consumerSecret(CONSUMER_SECRET); OAuthParameters params = new OAuthParameters().consumerKey(CONSUMER_KEY). signatureMethod("HMAC-SHA1"). version("1.0"). token(ACCESS_OAUTH_TOKEN); // Create the OAuth client filter OAuthClientFilter oauthFilter = new OAuthClientFilter(client.getProviders(), params, secrets); // Create a resource to be used to make Twitter API calls WebResource resource = client.resource(USER_TIMELINE_URL); // Add the filter to the resource resource.addFilter(oauthFilter); // Parse the JSON array JSONArray jsonArray = resource.get(JSONArray.class); List<String> statuses = new ArrayList<String>(); try { for (int i = 0; i < jsonArray.length(); i++) { JSONObject jsonObject = (JSONObject) jsonArray.get(i); StringBuilder builder = new StringBuilder(); builder.append(jsonObject.getString("text")). append(jsonObject.getString("created_at")); statuses.add(builder.toString()); } } catch (JSONException ex) { Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex); } }USER_TIMELINE_URL is "http://api.twitter.com/1/statuses/user_timeline.json". The "getTimelineElements" method can be updated to pick other elements from the return JSON object. The complete JSON schema for the response is described here.
-
Edit "AppTest.java" as:
public void testApp() { App app = new App(); // app.getRequestToken(); // app.getAccessToken(); app.getUserTimeline(); } -
Finally get the last 20 status updates by giving the command:
mvn test
and see the output similar to:Running org.glassfish.samples.twitter.AppTest [Developing OSGi-Enabled Java EE Applications- http://bit.ly/aOim34 (via @JavaOneConf) #javaone10Wed Aug 04 23:53:13 +0000 2010, Google Wave goes bye bye (via @google:)Update on Google Wave http://bit.ly/bIoDWAWed Aug 04 21:16:07 +0000 2010, @gdaniels Yeah, I expected #wave to bye bye as well, but this is fairly quick!Wed Aug 04 21:15:41 +0000 2010,
-
Add the following method in "App.java:
And that's it!
This Tip Of The Day explained how to use Jersey to retrieve last 20 status messages that a user posted on twitter. Here are some other future possible additions:
- POST status update
- Integrate Search API using OAuth (is it possible ?)
- Integrate Streaming API (need more investigation)
- Create a web-base client that automatically redirects the user from application to twitter.com and then back to the application.
Jersey and OAuth wiki provides more details about how to use OAuth with Jersey.
Technorati: totd jaxrs jersey restful webservices oauth twitter glassfish
Screencast #31: Java EE 6 using GlassFish and Eclipse 3.6 - Oracle Enterprise Pack for Eclipse 11.1.1.6 is now available - 5 new screencasts
Oracle Enterprise Pack for Eclipse 11.1.1.6 is now available - download here.
This is a set of plugins for Eclipse 3.6 that provide support for Oracle Coherence, Weblogic Scripting Tool (WLST), WebLogic server JDBC deployment descriptor and Web services annotation editor, and now Java EE 6 & GlassFish as well!
The plugins can also be downloaded from Eclipse Marketplace.
This video tutorial shows:
- Getting started with GlassFish in OEPE
- A simple Java EE 6 application (JSP, Servlets, EJB)
- Reading database table using Java Persistence API 2
- Using Facelets with Java Server Faces 2
- RESTful Web services using JAX-RS
Enjoy!
Note, this is a playlist of all the videos so click on little arrows (shown as "<" or ">") to view the different videos.
Please give us feedback on GlassFish Forums.
Technorati: screencast javaee6 glassfish tutorial eclipse oepe oracle
Screencast #30: Java EE 6 & GlassFish 3 using NetBeans 6.9 - 5 screencasts
This 5-part screencast shows how NetBeans 6.9 provides comprehensive tooling for Java EE 6 & GlassFish 3. The video tutorial starts with building a simple Java EE 6 application and evolves to add features from several new technologies such as Java Persistence API 2, Java Server Faces 2, Contexts & Dependency Injection, and Java API for RESTful Web services from the platform. Specifically, the different parts show:
- How to create a simple Java EE 6 application using JSP, Servlets 3, and EJB 3.1
- Reading values from a database table using Java Persistence API 2 POJO entities
- Create a template-based website using Facelets with Java Server Faces 2
- Use Contexts & Dependency Injection with JSF 2
- Publish a RESTful Web service using JAX-RS
Enjoy!
Note, this is a playlist of all the videos so click on little arrows (shown as "<" or ">") to view the different videos.
Please give us feedback on GlassFish Forums.
Technorati: screencast javaee6 glassfish tutorial netbeans
Dallas Tech Fest 2010 Trip Report
Oracle was a gold sponsor of Dallas Tech Fest 2010 - 9 parallel tracks and 5 sessions/track.
I gave a 3-hour hands-on workshop on Java EE 6, GlassFish, and NetBeans. The room was packed during the first part (about 60 or so) and most of the audience retained for second part. The workshop explained several advantages of Java EE 6 such as simplicity, ease-of-use, and richness of the platform. These concepts were demonstrated using multiple coding sessions involving several technologies from the platform. Specifically it showed:
- Creating simple Java EE 6 application using JSP, Servlets 3.0, Enterprise Java Beans 3.1
- Facelets-based page creation using Java Server Faces 2
- Contexts & Dependency Injection with Java Server Faces 2
- Accessing database table using Java Persistence API 2
- RESTful Web services using JAX-RS
NetBeans IDE specific features like Deploy-on-Save and Session-Preservation features that boosts your development productivity were also demonstrated using code samples.
The slides are now available:
Java EE 6 Hands-on Workshop at Dallas Tech Fest 2010
Watch Tim Rayburn (one of the conference organizers) talks about where Dallas Tech Fest is today and how they like to evolve it for next year:
One of the attendees mentioned after the workshop that it was like "drinking from the fire hose". The content could be overwhelming for users who are not familiar with NetBeans and new to Java EE 6. As repeated multiple times during the workshop, all the code shown in the workshop is clearly explained in screencast #30 (also in-lined below).
Feel free to re-run the workshop at your own pace and convenience. And you can always post any comment on this blog or GlassFish forum for question and/or clarifications.
Check out some pictures from the event:
On a personal front, met a few avid readers of my blog, connected with some Oracle folks, and barely met Ted Neward. I found Texas very humid and hot early in the morning for me. But still managed to squeeze in a 10K run, at a much slower pace:
One of the advantage of staying at Westin hotels is that they have a running map close to their hotel. And if not then their "Westin Workout" gyms are typically well equipped - even a stepper and exercise ball ;-) And a complimentary upgrade to United First both ways on both the legs certainly added to the overall great experience.
Thanks Erik & Tim for providing me the opportunity to speak, I definitely look forward to participating next year!
And here is the complete photo album below:
Technorati: conf dallastechfest dallas glassfish javaee6 netbeans
San Francisco 1/2 Marathon - 2010 Results
I ran San Francisco 1/2 marathon over the weekend and improved my timing from last year by 3 minutes. I guess dance at a pre-wedding ceremony and 4 hours of sleep the night before slowed me down otherwise could've pushed harder. Anyway the results are still encouraging and the bar is higher for the next time!

This makes me among top 1.2 % runners overall, top 2.5% for "Men", and top 2.3% in "M 30-39" category. Here is the overall leader board:

I'm about 20 minutes behind the winner (5:47 pace) and so need to push really hard to close the gap there. Who knows I may win one day, but for now the plan is to close the gap as much as possible. Seems really difficult, but not impossible!
And I almost made it to the women's leader board ;-)
Michael Wardian, a popular American marathoner and ultramarathoner came second in the full marathon. It was a pleasure to see him cruising back on the Golden Gate birdge.
Here are the mile splits:

One thing clearly evident from the splits is that any amount of hill training is less. This is all the more evident by looking at speed / elevation chart:

Click on the image to replay the race.
And finally here is race route:
Here is the cumulative result of all the marathons so far:
Marathon / Half Marathon Total Time Pace San Francisco 1/2 Marathon 2010 1:35:42 7:18 San Jose Rock-n-Roll 2009 1:30:59 6:57 San Francicsco 1/2 Marathon 2009 1:38:21 7:31 Kaiser Permanente San Francicsco 1/2 2009 1:41:30 7:45 Silicon Valley 1/2 2008 1:45:42 8:04 San Francisco 1/2 2008 1:52:44 8:25 San Francisco Full 2007 4:04:33 9:20 Silicon Valley Full 2006 4:06:57 9:25 San Francisco 1/2 2005 1:48:50 8:18
Technorati: running marathon results runsfm sanfrancisco
QA#4: Java EE 6: Developers focus on business logic, Much lower TCO - by Johan Vos
Jigsaw puzzle, modular, standard, integrated specifications, simple, annotation-driven, standards compliance, vendor independence, and light-weight deployment are some of the benefits highlighted by the Java EE 6 community.
In the Java EE 6 Feedback from Community series you can learn about how Java EE 6 is currently being used in production, development and deployment environments used within the community, and even feature requests for Java EE 7.
This entry comes from Johan Vos who started to work with Java in 1995. He worked on the Java Linux port with the Blackdown team. He has been doing Java consulting and development for a number of customers in completely different areas. Over the years, he has been active in a number of Java-based community projects, e.g. OSGi, the Glassfish project and JFXtras.org. With LodgON, the company he co-founded, he is mainly working on Java solutions for social networking software. Since he can't make a choice between embedded development and enterprise development, his main focus is on end-to-end Java, combining the strengths of back-end systems and embedded devices. His favorite technologies are currently Java EE / Glassfish at the backend and JavaFX at the frond-end.
Here is a short summary of Java EE 6 from him:
Developers can concentrate on business logic, Java EE 6 is providing a standard for the infrastructure
Read on for other fun stuff ...
1. How are you using Java EE 6 today ? What limits your adoption ?
I'm using Java EE 6 in most of the Enterprise projects I'm doing. This is not a requirement, but it turns out that when talking to people about what they really want, the Java EE 6 platform provides lots of the components that are needed to create an end-to-end solution.
Java EE 6 has evolved since the announcement of J2EE. It became more usable, and easier to develop and configure. In the past, a large number of non-standard libraries and frameworks have been developed since J2EE was too complex for most simple problems. The Java EE expert group clearly has learned from these evolutions, and the current Java EE 6 spec provides the functionality that is available in those frameworks, but as a standard. This is a huge benefit.
2. What Java EE 6 technologies are you using and why ?
I often use JPA. In earlier versions of the Java Enterprise standard, it was very hard to use the persistence layer in order to connect to a database. It was often easier to write your own connection pooling system, and perform SQL queries. But with JPA 2.0, it became much easier to manage the persistence.
I'm using (stateless) Session Beans as well, including the new Singleton Bean, combined with the @Startup annotation. The latter makes it much easier to perform tasks that need to be done only once.
I'm also using JAX-RS and Jersey frequently. In particular, I use Jersey for the communication with clients based on XML. The Transaction API is also something that I often use, either explicitly or implicitly.
3. What is your development and deployment environment ?
I'm mainly using NetBeans 6.9 on Linux. I download the full version of NetBeans, since I need both Java EE as well as JavaFX. NetBeans 6.9 comes pre-installed with Glassfish 3.0.1, so there is no need to download a whole application server to start Java EE 6 development.
4. What previous versions of Java EE / J2EE have you used ? How has the migration to Java EE 6 benefited ?
I've been working with Java EE since version J2EE 1.2. I have always avoided to migrate projects from older to newer versions, but I always start new projects on the latest released version. Early version of J2EE required more implementation-specific XML configuration (remember the sun-cmp-mappings.xml), and once you've done this you don't want to change this. Once projects are in deployment, you cannot easily change the runtime procedures.
Operations are often carried out by a different group than the development team. New versions of the J2EE/Java EE standard require changes in development but also in operations.
One of the benefits of Java EE 6, however, is that it also simplify the packaging and deployment procedures. Using annotations in JAX-RS and Servlets, for example, eliminates the need of XML-based configuration files. And often these configuration files make the handover from development to production deployment difficult. Clearly, the TCO for an average Enterprise project can be much lower when using Java EE6.
5. Describe the benefits of Java EE 6 to you in 120 characters.
Developers can concentrate on business logic, JavaEE6 is providing a standard for the infrastructure.
6. Advice for anybody who is looking at Java EE 6 for their next project ?
Use what you need. Nothing less, and nothing more. Although much easier than 10 years ago, Java Enterprise development can be complex. There are 2 situations you have to avoid:
- Sometimes, developers don't know about the infrastructure already provided by the Java EE platform, and they are duplicating functionality in their own code. If you look at the JPA and the JTA for example, that provides functionality that is needed in most projects.
- In a number of other cases, I see developers using features that are available in the appserver, but that are not needed in their application. The Java EE 6 spec is a composition of a number of specifications, and you don't have to use all the sub-specs.
7. What new features you'd like to see in Java EE 7 ?
Java EE 6 brought simplicity in complex enterprise applications, and made a significant move towards web-based projects. Indeed, the Java EE 6 specification is rather focused on the Web. While there are many usecases and real-world scenarios that have the Web as the most important client, I think there should be more attention for other clients, i.e. PDA, mobile phone, TV, JavaCard. Easy integration capabilities between those low-resource devices and high-end backend system will drive the adoption of Java EE.
From another point of view, more integration with the environment would be useful. For example, in a number of cases I would like to execute a specific EJB-call once CPU load is below 50%, or once disk usage is too high. I understand this is rather difficult to standardize in a non-platform dependent way.
Thanks you Johan for taking time to prepare the answers!
Are you using, consulting, training, authoring books, etc in Java EE 6 ? Drop a comment on this blog and I'll line you up for the Q&A session :-)
The Java EE 6 hub is your key resource to learn all about the technology.
And you can always try all Java EE 6 features in GlassFish. Here is an extensive of Java EE 6 & GlassFish demos is available.
Technorati: javaee6 community feedback johanvos glassfish v3
FISL 2010 Trip Report
I presented on the Java EE 6 Toolshow to an audience of approx 200. This slides-free session showed how NetBeans 6.9 provides comprehensive tooling around Java EE 6 and GlassFish 3. The session showed:
- Simplicity and ease-of-use for creating Java EE 6 web applications
- Boost productivity using Deploy-on-Save and Session-preservation across multiple redeployments
- JSP, Servlets 3.0, EJB 3.1 in Java EE 6 web apps
- Database access using Java Persistence API 2.0
- Using Facelets with Java Server Faces 2.0
- Contexts & Dependency Injection 1.0 with JSF 2
- RESTful Web services using JAX-RS
The screencast #30 made the session delivery quite a breeze and you can watch the entire session by watching the multi-part screencasts.
Meeting Bruno Souza and Fabiane Nardon was a good highlight of the trip. They are both fairly well known in the Brazilian community and we shared stories from last year's presence of Sun Microsystems at FISL. Check out their latest adventure at toolscloud.com where they provide open source tools-based development environment in the cloud.
Personally, I stayed for only couple of days because I had to come back to run a race (more on that in next blog) and attend a wedding over the weekend. A short trip but always good to spend face-to-face time with the local community.
Check out some pictures from the trip:
And the complete album at:
Technorati: conf fisl brazil oracle glassfish javaee6 netbeans
