Friday Jun 28, 2013

Java EE 7 Launch Replay


Java EE 7 was released final on Jun 12, 2013. A complete replay of Strategy and Technical Keynote can be seen below:



All the Technical Breakout sessions are now available on GlassFishVideos@YouTube and can be viewed in the following playlist:



Ready to try out Java EE 7 ?

Download Binaries

Tools

Docs


Do you feel enabled and empowered to start building Java EE 7 applications ?

Just download Java EE 7 SDK that contains GlassFish Server Open Source Edition 4.0, tutorial, samples, documentation and much more.

Enjoy!

Thursday Jun 27, 2013

Java EE 7 support in Eclipse 4.3




Eclipse Kepler (4.3) features 71 different open source projects and over 58 million LOC. One of the main themes of the release is the support for Java EE 7. Kepler specifically added support for the features mentioned below:
  • Create Java EE 7 Eclipse projects or using Maven
  • New facets for JPA 2.1, JSF 2.2, Servlet 3.1, JAX-RS 2.0, EJB 3.2
  • Schemas and descriptors updated for Java EE 7 standards (web.xml, application.xml, ejb-jar.xml, etc)
  • Tolerance for JPA 2.1 such as features can be used without causing invalidation and content assist for UI (JPA 2.1)
  • Support for NamedStoredProcedureQuery (JPA 2.1)
  • Schema generation configuration in persistence.xml (JPA 2.1)
  • Updates to persistence.xml editor with the new JPA 2.1 properties
  • Existing features support EE7 (Web Page Editor, Palette, EL content assist, annotations, JSF tags, Facelets, etc)
  • Code generation wizards tolerant of EE7 (New EJB, Servlet, JSP, etc.)

A comprehensive list of features added in this release is available in Web Tools Platform 3.5 - New and Noteworthy.

Download Eclipse 4.3 and Java EE 7 SDK and start playing with Java EE 7!

Oracle Enterprise Pack for Eclipse was released recently that uses Eclipse Kepler RC3 but will be refreshed soon to include the final bits.

Wednesday Jun 26, 2013

Java EE 7 support in NetBeans 7.3.1


NetBeans IDE provide tools, templates, and samples for building Java EE 7 applications. NetBeans 7.3.1 specifically added support for the features mentioned below:

  • Support for creating Java EE 7 projects using Maven and Ant
  • Develop, Deploy, and Debug using GlassFish 4
  • Bundled Java EE 7 javadocs
  • CDI is enabled by default for new Java EE 7 projects (CDI 1.1)
  • Create database scripts from Entity Classes (JPA 2.1)
  • Java Persistence Query Language (JPQL) testing tool (JPA 2.1)
  • RESTful Java client creation using JAX-RS 2.0 Client APIs (JAX-RS 2.0)
  • New templates for JAX-RS 2 Filter and Interceptor (JAX-RS 2.0)
  • New templates for WebSocket endpoints (WebSocket 1.0)
  • JMS messages are sent using JMS 2 simplified API (JMS 2.0)
  • Pass-through attributes are supported during Facelet page editing (JSF 2.2)
  • Resource Library Contracts(JSF 2.2)
  • @FlowScoped beans from editor and wizards (JSF 2.2)
  • Support for EL 3.0 syntax in editor (EL 3.0)
  • JSON APIs can be used with code completion (JSON 1.0)

A comprehensive list of features added in this release is available in NetBeans 7.3.1 New and Noteworthy.

Watch the screencast below to get a quick overview of the features and capabilities:



Download Netbeans 7.3.1 and start playing with Java EE 7!

Tuesday Jun 25, 2013

JMSContext, @JMSDestinationDefintion, DefaultJMSConnectionFactory with simplified JMS API: TOTD #213


"What's New in JMS 2.0" Part 1 and Part 2 provide comprehensive introduction to new messaging features introduced in JMS 2.0. The biggest improvement in JMS 2.0 is introduction of the "new simplified API". This was explained in the Java EE 7 Launch Technical Keynote. You can watch a complete replay here.

Sending and Receiving a JMS message using JMS 1.1 requires lot of boilerplate code, primarily because the API was designed 10+ years ago. Here is a code that shows how to send a message using JMS 1.1 API:

@Stateless
public class ClassicMessageSender {

@Resource(lookup = "java:comp/DefaultJMSConnectionFactory")
ConnectionFactory connectionFactory;

@Resource(mappedName = "java:global/jms/myQueue")
Queue demoQueue;

public void sendMessage(String payload) {
  Connection connection = null;
    try {
      connection = connectionFactory.createConnection();
      connection.start();
      Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
      MessageProducer messageProducer = session.createProducer(demoQueue);
      TextMessage textMessage = session.createTextMessage(payload);
      messageProducer.send(textMessage);
    } catch (JMSException ex) {
      ex.printStackTrace();
    } finally {
      if (connection != null) {
        try {
          connection.close();
        } catch (JMSException ex) {
          ex.printStackTrace();
        }
      }
    }
  }
}

There are several issues with this code:
  • A JMS ConnectionFactory needs to be created in a application server-specific way before this application can run.
  • Application-specific destination needs to be created in an application server-specific way before this application can run.
  • Several intermediate objects need to be created to honor the JMS 1.1 API, e.g. ConnectionFactory -> Connection -> Session -> MessageProducer -> TextMessage.
  • All APIs throw checked exceptions and so try/catch block must be specified.
  • Connection need to be explicitly started and closed, and that bloats even the finally block.
The new JMS 2.0 simplified API code looks like:


@Stateless
public class SimplifiedMessageSender {

  @Inject
  JMSContext context;

  @Resource(mappedName="java:global/jms/myQueue")
  Queue myQueue;

  public void sendMessage(String message) {
    context.createProducer().send(myQueue, message);
  }
}

The code is significantly improved from the previous version in the following ways:
  • The JMSContext interface combines in a single object the functionality of both the Connection and the Session in the earlier JMS APIs.  You can obtain a JMSContext object by simply injecting it with the @Inject annotation. This of course works only in Java EE Web or EJB applications and does not apply in Java SE-based applications where injection is not available.
  • No need to explicitly specify a ConnectionFactory. A default ConnectionFactory under the JNDI name of
    java:comp/DefaultJMSConnectionFactory
    is used if no explicit ConnectionFactory is specified.
  • The destination can be easily created using newly introduced @JMSDestinationDefinition as:
    @JMSDestinationDefinition(name = "java:global/jms/myQueue",
            interfaceName = "javax.jms.Queue")

    It can be specified on any Java EE component and the destination is created during deployment.
  • Creating JMSConsumer also starts the connection so there is no need to explicitly start it.
  • JMSContext, Session, Connection, JMSProducer and JMSConsumer objects are now AutoCloseable. This means that these resources are closed automatically by the management of try-with-resources statement.
  • New simplified API throws a new unchecked exception, JMSRuntimeException. This means try/catch blocks are not required.
  • Method chaining on JMSProducers allows to use builder patterns.
  • No need to create separate Message object, you can specify the message body as an argument to the send() method instead.

Want to try this code ? Download source code!

Download Java EE 7 SDK and install.
Start GlassFish: bin/asadmin start-domain
Build the WAR (in the unzipped source code directory): mvn package
Deploy the WAR: bin/asadmin deploy <source-code>/jms/target/jms-1.0-SNAPSHOT.war

And access the application at http://localhost:8080/jms-1.0-SNAPSHOT/index.jsp to send and receive a message using classic and simplified API.

A replay of JMS 2.0 session from Java EE 7 Launch Webinar provides complete details on what's new in this specification:



Enjoy!

Wednesday Jun 12, 2013

Java EE 7 SDK and GlassFish Server Open Source Edition 4.0 Now Available


Java EE 7 (JSR 342) is now final!

I've delivered numerous talks on Java EE 7 and related technologies all around the world for past several months. I'm loaded with excitement to share that the Java EE 7 platform specification and implementation is now in the records.

The platform has three major themes:



  • Deliver HTML5 Dynamic Scalable Applications
    • Reduce response time with low latency data exchange using WebSocket
    • Simplify data parsing for portable applications with standard JSON support
    • Deliver asynchronous, scalable, high performance RESTful Service
  • Increase Developer Productivity
    • Simplify application architecture with a cohesive integrated platform
    • Increase efficiency with reduced boiler-plate code and broader use of annotations
    • Enhance application portability with standard RESTful web service client support
  • Meet the most demanding enterprise requirements
    • Break down batch jobs into manageable chunks for uninterrupted OLTP performance
    • Easily define multithreaded concurrent tasks for improved scalability
    • Deliver transactional applications with choice and flexibility
This "pancake" diagram of the major components helps understand how the components work with each other to provide a complete, comprehensive, and integrated stack for building your enterprise and web applications. The newly added components are highlighted in the orange color:




In this highly transparent and participatory effort, there were 14 active JSRs:
  • 342: Java EE 7 Platform
  • 338: Java API for RESTful Web Services 2.0
  • 339: Java Persistence API 2.1
  • 340: Servlet 3.1
  • 341: Expression Language 3.0
  • 343: Java Message Service 2.0
  • 344: JavaServer Faces 2.2
  • 345: Enteprise JavaBeans 3.2
  • 346: Contexts and Dependency Injection 1.1
  • 349: Bean Validation 1.1
  • 352: Batch Applications for the Java Platform 1.0
  • 353: Java API for JSON Processing 1.0
  • 356: Java API for WebSocket 1.0
  • 236: Concurrency Utilities for Java EE 1.0

The newly added components are highlighted in bold.

And 9 Maintenance Release JSRs:

  • 250: Common Annotations 1.2
  • 322: Connector Architecture 1.7
  • 907: Java Transaction API 1.2
  • 196: Java Authentication Services for Provider Interface for Containers
  • 115: Java Authorization for Contract for Containers
  • 919: JavaMail 1.5
  • 318: Interceptors 1.2
  • 109: Web Services 1.4
  • 245: JavaServer Pages 2.3

Ready to get rolling ?

Binaries

Tools

Docs


A few articles have already been published on OTN:

And more are coming!

This blog has also published several TOTD on Java EE 7:


All the JSRs have been covered in the Java Spotlight podcast:

The latest issue of Java Magazine is also loaded with tons of Java EE 7 content:



Media coverage has started showing as well ...
And you can track lot more here.

You can hear the latest and greatest on Java EE 7 by watching replays from the launch webinar:



This webinar consists of:
  • Strategy Keynote
  • Technical Keynote
  • 16 Technical Breakouts with JSR Specification Leads
  • Customer, partner, and community testimonials
  • And much more
Do you feel enabled and empowered to start building Java EE 7 applications ?

Just download Java EE 7 SDK that contains GlassFish Server Open Source Edition 4.0, tutorial, samples, documentation and much more.

Enjoy!

About

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


Java EE 7 Samples

Stay Connected

Search

Archives
« June 2013 »
SunMonTueWedThuFriSat
      
1
2
3
4
5
6
7
8
9
10
11
13
14
15
16
17
18
19
20
21
22
23
24
29
30
      
Today