Miles to go …

September 1, 2010

2-day Java EE 6 & GlassFish workshops in Germany, Czech Republic, Hungary – Register now!

Filed under: glassfish, javaee, javaserverfaces — arungupta @ 10:46 am
  • 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

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • email
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

August 23, 2010

TOTD #144: CDI @Produces for container-managed @Resource

Filed under: glassfish, javaee — arungupta @ 9:37 pm

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.

  1. 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.

  2. 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:

    1. 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 {
      }
      
    2. Add the type-safe definition of "EntityManagerFactory" in "ApplicationResources" bean (defined above) as:

      @Produces @PersistenceUnit(unitName="StatesPU") @StatesDatabase EntityManagerFactory statesEMF;
      

    3. The "EntityManagerFactory" can now be injected in the Servlet in a type-safe manner as:

      @Inject @StatesDatabase EntityManagerFactory emf;
      

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

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • email
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

August 22, 2010

IndicThreads Cloud Computing 2010 Trip Report

Filed under: glassfish, javaee — arungupta @ 4:46 am

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:

I 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 ?
  • 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 pune

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • email
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

August 2, 2010

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

Filed under: glassfish, javaee, screencast — arungupta @ 1:19 pm

Oracle Enterprise Pack for Eclipse 11.1.1.6 is now availabledownload 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:

  1. Getting started with GlassFish in OEPE
  2. A simple Java EE 6 application (JSP, Servlets, EJB)
  3. Reading database table using Java Persistence API 2
  4. Using Facelets with Java Server Faces 2
  5. 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

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • email
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

July 20, 2010

Screencast #30: Java EE 6 & GlassFish 3 using NetBeans 6.9 – 5 screencasts

Filed under: frameworks, glassfish, javaee, netbeans, screencast — arungupta @ 5:43 am

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:

  1. How to create a simple Java EE 6 application using JSP, Servlets 3, and EJB 3.1
  2. Reading values from a database table using Java Persistence API 2 POJO entities
  3. Create a template-based website using Facelets with Java Server Faces 2
  4. Use Contexts & Dependency Injection with JSF 2
  5. Publish a RESTful Web service using JAX-RS

Enjoy!

Please give us feedback on GlassFish Forums.

Technorati: screencast javaee6 glassfish tutorial netbeans

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • email
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

July 11, 2010

Java Road Trip 2010 – New Orleans Stop

Filed under: glassfish, javaee, netbeans — arungupta @ 12:28 am

Java Road Trip is a tour across 20 cities in the United States showcasing Oracle’s commitment to everything Java.

I talked about Java EE 6 & GlassFish 3 at the New Orleans yesterday. The day started with an overcast sky, caught up with heat wave around the country (around 91 degrees), showed a reflection of super humidity (about 80%), and then ended with a thunder, lightning, and a heavy downpour while I was boarding the flight to back home.

The venue of the event was University of New Orleans but the taxi driver had no clue, even after talking to multiple folks, on how to reach there. But finally we reached after calling up his taxi company, asking at a Shell station, entering a different university, and talking to a cop. I can only we did not loose any attendees because of the location.

There were about 30 attendees spread across 3 parallel running sessions. I talked about simplicity, light-weight, extensible, and power of Java EE 6. There were no slides and only demos – after all, code is king! The key points shown were:

  • Servlets 3.0 make "web.xml" optional and instead use annotations to specify that information
  • Enterprise JavaBeans (EJB) can be bundled in a WAR file.
  • Java Server Faces 2 uses Facelets as the templating language. This allows templates to be created and applied across different .XHTML pages easily. The different scopes allow the bean to be used appropriately.
  • Creation of Java Persistence API (JPA) entity classes from a database table.
  • Creation of RESTful resources – can be done as a simple root resource or generate from a database table or an entity.

All of these features were demonstrated using NetBeans although all of them can be easily achieved using Eclipse as well. A consolidated list of Java EE 6 & GlassFish 3 Demos will help you feel some of the features mentioned above.

Here are some other relevant links for the Road Trip:

Many more cities (Austin, Houston, Denver, Salt Lake City, Seattle, and Portland) are planned before the trip makes it final stop at the San Francisco Bay Area. So make sure to catch up on a local or near by city and talk to speakers from Oracle. 

On a personal note, the hotel was in the French Quarter neighborhood so there was lot to see around. Being in the downtown, I had to restrict myself with indoor running only. The flight out of New Orleans got delayed because of thunder, lightning, and heavy downpour and so I missed my connection but caught the tail-end of a birthday party I was supposed to attend back home.

Anyway check out some pictures from the New Orleans stop:

Check out the complete album:

Technorati: conf neworleans javaroadtrip glassfish v3 javaee6 netbeans oracle

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • email
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

July 8, 2010

Java EE 6 & GlassFish 3 Demos

Filed under: frameworks, glassfish, javaee — arungupta @ 10:23 am

The is a consolidated list of all the Java EE 6 blog entries published on this blog so far:

  • TOTD #139: Asynchronous Request Processing using Servlets 3.0 and Java EE 6
  • TOTD #137: Asynchronous EJB, a light-weight JMS solution – Feature-rich Java EE 6
  • TOTD #136: Default Error Page using Servlets 3.0 – Improved productivity using Java EE 6
  • TOTD #135: JSF2 Composite Components using NetBeans IDE – lightweight Java EE 6
  • TOTD #133: JPA2 (JPQL & Criteria), JavaDB, and embedded GlassFish – perfect recipe for testing
  • TOTD #132: Servlets 3.0 in Embedded GlassFish Reloaded – lightweight Java EE 6
  • TOTD #128: EJBContainer.createEJBContainer: Embedded EJB using GlassFish v3
  • TOTD #123: f:ajax, Bean Validation for JSF, CDI for JSF and JPA 2.0 Criteria API – all in one Java EE 6 sample application
  • TOTD #120: Deployment Descriptor-free Java EE 6 application using JSF 2.0 + EJB 3.1 + Servlets 3.0
  • TOTD #112: Exposing Oracle database tables as RESTful entities using JAX-RS, GlassFish, and NetBeans
  • TOTD #109: How to convert a JSF managed bean to JSR 299 bean (Web Beans) ?
  • TOTD #108: Java EE 6 web application (JSF 2.0 + JPA 2.0 + EJB 3.1) using Oracle, NetBeans, and GlassFish
  • TOTD #102: Java EE 6 (Servlet 3.0 and EJB 3.1) wizards in Eclipse
  • TOTD #101: Applying Servlet 3.0/Java EE 6 “web-fragment.xml” to Lift – Deploy on GlassFish v3
  • TOTD #99: Creating a Java EE 6 application using MySQL, JPA 2.0 and Servlet 3.0 with GlassFish Tools Bundle for Eclipse
  • TOTD #98: Create a Metro JAX-WS Web service using GlassFish Tools Bundle for Eclipse
  • TOTD #95: EJB 3.1 + Java Server Faces 2.0 + JPA 2.0 web application – Getting Started with Java EE 6 using NetBeans 6.8 M1 & GlassFish v3
  • TOTD #94: A simple Java Server Faces 2.0 + JPA 2.0 application – Getting Started with Java EE 6 using NetBeans 6.8 M1 & GlassFish v3
  • TOTD #93: Getting Started with Java EE 6 using NetBeans 6.8 M1 & GlassFish v3 – A simple Servlet 3.0 + JPA 2.0 app
  • TOTD #91: Applying Java EE 6 "web-fragment.xml" to Apache Wicket – Deploy on GlassFish v3
  • TOTD #82: Getting Started with Servlet 3.0 and EJB 3.1 in Java EE 6 using NetBeans 6.7

Feel free to use any of them in your presentations or webinars or anywhere else.

What other Java EE 6 demos would you like to see ?

Technorati: javaee6 glassfish v3 demos netbeans eclipse

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • email
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

July 7, 2010

QA#3: Java EE 6: Jigsaw puzzle, Modular, standard, less xml, easy, easy – by Antonio Goncalves

Filed under: glassfish, javaee — arungupta @ 2:27 am

This blog entry is third (previous ones) in the Java EE 6 feedback from the 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 Antonio Goncalves – a senior software architect specialized in Java / Java EE working as a consultant. He started working with Java in 1998 and quickly with J2EE in 1999. He published a first book (in French) about Java EE 5 in 2007 and became a JCP Expert Member of various JSRs in 2008 (Java EE 6, JPA 2.0 and EJB 3.1). He is a member of the OSSGTP (Open Source Solution Get Together Paris), co-leader of the Paris JUG and has been awarded Java Champion. Follow him on Twitter (http://twitter.com/agoncal) and read his blog (http://agoncal.wordpress.com/).

Here is a short summary of Java EE 6 from him:

Jigsaw puzzle, Modular, standard, less xml, easy, easy, have I said easy?

Read on for other fun stuff …

1. How are you using Java EE 6 today? What limits your adoption ?

The first use case of using with Java EE 6 is to develop anything I need to develop, any prototype.

  • Need to write a quick task processing a database? Java EE 6.

  • Need to develop a quick admin site with a few pages interacting with an LDAP directory? Java EE 6.

  • Need to expose a RESTful web service? Java EE 6.

The platform became so integrated, as well as being so modular, and so simple to use, that any simple use case is a perfect excuse to use Java EE 6 (take a transactional EJB 3.1, a few JPA 2.0 entities, package everything in a war, no interfaces, no XML, and you are done).

The second use case is to use some bits of Java EE 6 as a jigsaw puzzle at my customers. The beauty of EE 6 is that most specifications can be used separately. At the moment I’m using Bean Validation and JPA 2.0 under Tomcat, no need to use the full platform not to deploy it to a full compliant application server.

In my case, Spring is limiting a wider adoption of Java EE 6. Only very recently Spring Web Flow has started to support bits of JSF 2.0. The day it fully supports it, I will be able to add a few extra specs in my applications.

Another technological limitation is the limited number of containers that implement Servlet 3.0 and EJB 3.1. Today, only GlassFish and Resin implement the Web Profile (and the full profile for GlassFish). But JSF 2.0 can run on Servlet 2.5 (i.e Tomcat 6.x).

2. What Java EE 6 technologies are you using and why ?

In fact, if the question was "What Java EE 6 technologies are you NOT using and why?" I would have answered Servlet 3.0 and EJB 3.1 because they need containers (even if EJB 3.1 has an embeddable container that goes with it) and as I said, there is still a lack of containers implementing them. The rest of Java EE 6 can be used on a per-specification basis. At my customers I use any piece of Java EE 6 that I can. Bean Validation 1.0 and JPA 2.0 are so easy and well integrated that I use them as much as I can. The integration between Bean Validation and JSF 2.0 is also very handy. JAX-RS is a fantastic RESTful web services API that you can use with Servlet 2.5 containers such as Tomcat 6.x. I’m not even talking about JMS, JAX-WS and JTA that I use on a day to day basis.

3. What is your development and deployment environment?

I am an IntelliJ Idea addict. I gave up trying to figure out how Eclipse tries to work and which plugins to install (sorry, it’s not called plugins now but OSGI bundles, the ones you start and stop at runtime… what a joke). Once in a while I use NetBeans, but the Java EE 6 support with Intellij is really amazing. And then, I really have two different kinds of usages: GlassFish, H2 and MySQL and at my customers it’s more Tomact, WebLogic, Websphere (unfortunately) and Oracle. Even if I have lots of complaints about Maven, I use it everywhere so I can be IDE-agnostic when I need to build my projects.

4. What previous versions of Java EE / J2EE have you used ? How has the migration to Java EE 6 benefited ?

Being a former BEA employee from 1999 and 2001, I can say that I’ve used all versions of the Java EE platform (from J2EE 1.2). The early versions being a very painful experience. I did a lot of Entity Beans CMP and it was a real nightmare. I remember the very first EJBs when the deployment descriptor was serialized and then it became XML files. Migrating from Entity CMPs to JPA was not easy as you had to go to your customer and say "sorry, we lied to you, Entity Beans CMP are not great and guess what? you need to throw your code to the bin and start with a fresh JPA 1.0 domain model". Like everybody I moved to Struts, Hibernate and Spring. But I quickly realized that I wasn’t an XML fan and found Spring was becoming too complex and messy for my needs. Since Java EE 5 development on server side has been simplified with convention over configuration with containers doing most of the work. Migration and portability has improved, I often work with customers who develop Java EE 5 application on one application server and deploy it in another. Java EE 6 goes even further in terms of portability.

5. Describe the benefits of Java EE 6 to you in 120 characters.

Jigsaw puzzle, Modular, standard, less xml, easy, easy, have I said easy?

6. Advice for anybody who is looking at Java EE 6 for their next project ?

Well, first of all you should buy my book ;o) (http://apress.com/book/view/1430219548) Java EE 6 is modular; don’t see it as a blob. Take the bits and pieces that you need. Start with JPA 2.0 and Bean Validation, that’s easy. If you can, add JSF 2.0 that will simplify configuration, resources management and component development. Take JAX-RS if you do RESTful applications. For injection, and many more, use Weld (the CDI implementation) that runs also on Tomcat. If you do Spring 3.x, think of using @Inject (unfortunately Spring doesn’t implement CDI). If you then can use GlassFish or Resin, these are the two implementations ready to execute your EJBs 3.1 (JBoss 6 is on the way). Because Java EE 6 is so simple, don’t over engineer your code: interfaces are not always needed; DAOs are not always needed either… KISS and refactor your code later if you really need it.

The final word is, add Java EE 6 specification to your project in an incremental way. When you can get rid of a proprietary framework and change it to a standard one, do so. You will avoid "vendor locking" (or "open source framework locking", as open source is different from open standard). And use design patterns when you really need them.

7. What new features you’d like to see in Java EE 7 ?

What I really miss in Java EE 6 is something similar to Spring Web Flow or Seam Page Flow. I hope that in Java EE 7 a new specification will come and standardize flow management (for JSF, of course, but something more general letting you manage different sorts of flows).

Batch processing is also something missing. Spring Batch is very good and defines well known principals such as jobs, steps and so one. With EJB 3.1 there is a new Timer Service (inspired from cron and as rich as Quartz). It’s time to get a Batch processing specification that can be easily scheduled.

Security is also a difficult point. JAAS is too low level. Even if there are some improvements in the Servlet 3.0 API, there is still room to tight the platform together in terms of security.

Packaging could also be changed in Java EE 7. We talk a lot about OSGi these days. As a developer I found it too difficult, I would like the EE 7 platform to simplify the creation of bundles (OSGi or something different but compatible). I’m also hoping that Java SE 7 will become more modular. Modularity in Java SE 7 + OSGi packaging in EE 7 would be a great combination.

And I remember talking to Adam Bien about it, JMS hasn’t changed for more than a decade, it should benefit from the novelties of the platform and get simpler.

In a word, I would like Java EE 7 to get richer (more specs), simpler (less code to write) and more integrated (security is one example)

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.

Technorati: javaee6 community feedback antoniogoncalves glassfish v3

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • email
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

June 23, 2010

QA#2: Java EE 6: Integrated specifications, simple and annotation driven, next level of industry standard – by Markus Eisele

Filed under: glassfish, javaee — arungupta @ 11:45 am

This blog entry is second (previous ones) in the Java EE 6 feedback from the 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 Markus Eisele – a senior technology consultant working for msg systems ag in Germany. The msg systems ag is one of the top 10 IT consulting and systems integration companies in Germany. Markus works as a software architect, developer and consultant. He also writes for German IT magazines. Markus joined msg in 2000 and has been a member of the
Center of Competence IT-Architecture since then. After being a Technical Director with BEA Systems, he has been a proud member of the Oracle ACE Directors program since 2008 (for Fusion Middleware and SOA). He works daily with customers and projects dealing with Enterprise Java and other new technologies, on a variety of platforms using different vendors. You can catch him on @myfear or read his blog.

Here is a short summary of Java EE 6 from him:

Higher integrated specifications, simple and annotation driven, single-classloader WARs, next level of industry standard

Read on for other fun stuff …

1. How are you using Java EE 6 today ? What limits your adoption ?

Enterprise Java has been my business since more than 9 years now. The first J2EE server I was using was the former BEA WebLogic 5.1. It supported Java 2 Platform, Enterprise Edition Specification, v. 1.2 (containing EJB 1.1, JDBC 2.0, JSP 1.1, Servlet 2.2). To be honest, it wasn’t big fun looking back into these days. There was lots of configuration and weird coding. And don’t even think about full-blown IDE support. It was very basic and lots of coding had to be done without any assistance.

Compared to that Java EE 6 seems to be this feels as if it is light years ahead. So many things happened to the standard in the past and it is still very exiting to see the ongoing changes. Even though I am not a member of any related expert group, I am closely monitoring the public discussions and outcomes. What I can evaluate more is the adoption in the enterprise with our customers. They are more like fast followers than early adopters. And that’s basically the setup I am looking at Java EE 6 today. More from an educational or research point of view. The goal is to be ready when first customers jump in. We have to answer questions for them, like:

- What can we do to migrate existing applications?
- What is the most standards compliant way of using this technology?
- What application servers should we use?
- What do the new specifications save in terms of time and/or money?
- How stable are new product versions?

If first projects start using new standards, we will be there to support them and already have answers at hand. At the moment we do not start over with Java EE 6 in projects. First projects are expected with the first commercial server versions from Oracle or IBM (WebLogic respectively WebSphere). Some of our customers are using GlassFish and they are sticking to the latest GlassFish 2.x versions while waiting for the clustering support coming in GlassFish 3.1. In the meantime we try to enable the developers with workshops and informative sessions about new features and updated specs.

2. What Java EE 6 technologies are you using and why ?

I am still working my way through the new features at the moment. Of both: GlassFish 3.x and Java EE 6. I started with the new CDI (JSR-299 + JSR-330) capabilities and looked at the improvements for implementing business logic with EJB 3.1 and JPA 2.0. The JSF 2.0 features gave a face to many of my prototypes.

The biggest improvements at the moment are the no-interface beans and the JPA 2.0 enhancements. In combination with the single-classloader model of WAR-deployment this is very handy for even the smallest applications. A situation we were forced to use Spring or other frameworks in the past. The ongoing annotation support is another feature-set I love to see. The reduced configuration effort with xml files seems handy but could bear risks for bigger applications using different frameworks and libraries. A big part of our daily work is cluster related. Therefore I am experimenting with the first 3.1 milestones at the moment.

3. What is your development and deployment environment ?

This is highly dependent on our customers. There is no single, company wide directive on what to use. The majority is using Eclipse. I personally prefer the latest Oracle Version (OEPE) but also have different plain Eclipse versions in use. Experimenting with GlassFish 3 I often use NetBeans 6.9 for demonstrations because of the very good GlassFish and Java EE 6 integration. I tend to be very close to productive environments in development. Therefore I am rarely using other databases than Oracle or DB2. I personally love to use MySQL for PoCs or demos.

In general we use lots of other environments based upon customer needs. Maven is the favorite build tool of choice at the moment. Longer running projects however still stick to ANT.

4. What previous versions of Java EE / J2EE have you used ? How has the migration to Java EE 6 benefited ?

I used J2EE since 1.2. Simple, technical migration from one product version to another was not too challenging at all in the past. Problems arose from switching vendors (Oracle/IBM) or updating specifications with major functional changes (CMP/JPA). Most challenging are customers staying with older product versions (and their bugs and needed workarounds). The pollution with workarounds and fixes never did any good in projects. Thankfully the times of custom frameworks to hide complexity seems to be up since Java EE 5. This was probably the most expensive part in many J2EE/Java EE 5 migrations in the past.

Seeing the advantages in OSGi based servers customers will hopefully be able to adopt new standards more easier in the future. Most valuable will be the new Web Profile. Most applications simply use the included specifications and could run on lighter environments. With the new CDI specifications we could remove some third party solutions and put it in the standard way. The so far missing JAX-RS closes a big gap left open by Java EE 5.

5. Describe the benefits of Java EE 6 to you in 120 characters.

Higher integrated specifications, simple and annotation driven, single-classloader WARs. Next level of industry standard.

6. Advice for anybody who is looking at Java EE 6 for their next project ?

If you are asking for available servers and the question, which specification is right for me today, I already tried to answering this in my blogpost http://blog.eisele.net/2010/05/java-ee-5-or-6-which-to-choose-today.html.

The programming approach itself is a advancement of existing Java EE 5 projects. Everything is pointing into the direction of POJOs and more Java SE like programming. Container services should be injected respectively annotated in a last step; if needed. Programming is getting more closer to solving business problems and not to the fulfillment of specification or container requirements.

7. What new features you’d like to see in Java EE 7 ?

I think the specifications are more or less feature complete. Of course I can think of a lot of improvements and I believe it’s important to stay up to date and integrate new approaches.

If you look at JSF and the RI for example, I am still missing a lot of more complex components. I always find myself implementing one or two own in my projects. If you work for  more restrictive enterprises, you are not always able to use the component suite of choice. If possible I still prefer to work with either RichFaces or PrimeFaces. Further on the cooperation between JSR 299 and JSR 330 should be clearer in general. The interaction between all JSRs should be taken to a next level. Clear but abstract guidelines
have to be specified, who is working with whom and how. If you look at the @ManagedBean annotation for example, you have three different ways of defining beans that are managed (JSR-314, JSR-316, JSR-299). That’s not exactly what I would call intuitive ;)

Generally I would love to see the Managed Beans specification becoming the heart of enterprise java. Containers should belong to the past. Services should be available to POJOs and injected (and of course started) as needed. This could speed up the whole environment a lot and frees developers from having to implement interfaces. But the most important improvements would be administrative. Java EE 7 should put those pruning ideas forward and realy try to drop some old stuff. And finally it is time to
solve all those never-ending licensing discussions about the TCKs!

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.

Technorati: javaee6 community feedback markuseisele glassfish v3

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • email
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

June 18, 2010

Uber Conf 2010 – Day 4 Report – OSGi/Java EE in GlassFish and Getting Started with Clojure

Filed under: frameworks, glassfish, netbeans, running — arungupta @ 11:30 am

Uber Conf Day 4 (Day 3, 2, and 1) started with yet another 10 miler with fellow attendees in 1 hr 18 mins and 7:49 pace. It was slightly slower than the day before – guess physical exhaustion was setting in ;-) Here are the mile splits:

Thanks to Andy for showing how to turn on the Auto-Lap feature in Garmin 305 … really handy!

I gave a talk on how GlassFish provides a great execution environment for deploying OSGi, Java EE, and hybrid applications easily. The slides are given below:

The remainder of the day was spent in Clojure track by Stuart Halloway. Next are some basic notes for getting started with Clojure:

Why Clojure ?

  • Power (hosted on jvm)
  • Robustness (functional)
  • Concurrency (identity, state, time)
  • Abstraction (OO done right)
  • Focus (lisp)

Together, these features add up to simplicity. Simplicity means

  • absence of incidental complexity
  • sufficient to meet your design constraints

Simplicity does not mean

  • Familiarity has nothing to do with simplicity
  • its not superficial, goes to the bone (e.g. only simpler syntax is just a sugar wrapper, look for the supported idioms)
  • does not mean easy, its very hard to be simple

Lot of code in Clojure is not about "set" something, its about invoke a function on it.

How to get started ?

Download the latest stable release or cutting edge build. The Clojure REPL (Read-Evaluate-Print Loop) is the easiest way to run a Clojure program as shown below:

~/tools/clojure/clojure-1.1.0 >java -cp clojure.jar clojure.main
Clojure 1.1.0
user=> (print "Hello World")
Hello Worldnil
user=> ^D

OR

~/tools/clojure/jun7 >java -cp clojure.jar clojure.main
Clojure 1.2.0-master-SNAPSHOT
user=> (print "Hello World")
Hello Worldnil
user=> ^D

Notice, the first fragment shows how to run REPL using the latest stable release and the second fragment shows the same using the cutting edge build. "Ctrl+D" exits the REPL shell. Stuart mentioned that the Clojure community stays on the cutting edge build most of the times.

Alternatively, you can also clone "labrepl" from "http://github.com/relevance/labrepl" which is an environment for exploring the Clojure language. It also provides complete instructions for getting started with NetBeans/Enclojure, Eclipse/Counterclockwise, Maven, Max/Linux command line, Windows command line, IDEA/La Clojure, and Emacs.

Configuring Clojure in NetBeans using the Enclojure plugin with NetBeans 6.9 gives the following error:

but works easily with NetBeans 6.8. The IDE seem to support REPL, Java/Clojure integration, syntax highlighting, brace/paren/bracket matching, code navigation, debugger and lots of interesting features.

Here is a typical REPL getting started session with NetBeans and Enclojure:

Here are some equivalent syntax with Java:

Semantic Java Clojure
new new Widget("foo") (Widget. "foo")
Access static members Math.PI Math/PI
Access instance members rnd.nextInt() (.nextInt rnd)
Chaining access person.getAddress().getZipCode() (.. person getAddress getZipCode)
  • "defn" is a symbol so no new syntax for adding a method.
  • ^ introduces metadata for the next symbol, "greet" in this case. You can put metadata anywhere.
  • "clojure.core" is the core of Clojure’s implementation
  • "javadoc" knows the default JDK javadocs, can make a local copy and/or extend it
  • "show" is Java reflection
  • "dir", "show", "source" are promoted from community version to the bleeding edge build.
  • Source is not always exposed
  • [1 2 3] Call the function 1 with arguments 2 & 3.
  • ‘(1 2 3) don’t evaluate it and print as is, just tick it.
  • Idiomatically Clojure requires less parentheses than Java
  • Every single function in Clojure is Runnable and Callable

  • Java interop is simple, wrapper-free (raw), performant, complete

Compojure is a small, open source Web framework for Clojure based upon Ring (similar to Python’s WSGI and Ruby’s Rack). Otherwise Clojure apps are deployed as a JAR file.

A subsequent blog will show how to deploy a simple Clojure JAR file and a simple web app using Compojure on GlassFish.

And finally, here are my top-10 reasons (in no particular order) that I’d like to attend UberConf next year:

  1. Long 90 minute sessions
  2. Lots of hands-on workshops
  3. Fun Run as part of the formal agenda
  4. Beautiful location (Westin Westminster) with lots of running trails
  5. Great food (breakfast + lunch + dinner)
  6. Small attendance so intimate discussions with speakers
  7. Great set of speakers
  8. Rarely see session hopping
  9. Pure technology, no product pitching
  10. Swags are nice – bracelet-style USB stick with all the presos, 2 different tee-shirts, fancy folder and some additional goodies for speakers

See ya next year, hopefully!

Technorati: conf uberconf denver clojure compojure glassfish netbeans javaee osgi

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • email
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot
Older Posts »

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