Java EE Articles

WebSphere Liberty Profile Webinar – Wednesday, May 28, 2PM Eastern

Although WebSphere Application Server is one of the most robust Java Enterprise Application Servers for deployment of mission critical applications, it is not always that easy to use in development. Often we see clients who deploy to WebSphere in production using Tomcat or some other server to test in development because it is "easier". The complaint is that the full WebSphere Application Server takes too long to start or redeploy applications and is not intuitive to configure for developers. To address these issues, IBM has created the WebSphere "Liberty Profile" server. This is a lightweight server, certified for Java EE 6, that starts much faster and is easier to configure.

 

In this webinar we will look at the features of the WebSphere Liberty Profile server, how it compares to the "full" WebSphere Application Server, and how you can use it to simplify the development and testing of Java EE applications. We will even show that with version 8.5.5 of the WebSphere Liberty Profile there are some intriguing new features that would even let you run the server as part of a cluster and use it for some production deployment scenarios. We will also highlight the use of FREE Eclipse development tools that are available since the cost of development tools for WebSphere Application Server has also been historically an issue.

 

Register for the webinar here

No Comments

Time for Spring …. 4!

On the first day of Spring 2014 (even though some of you may feel winter will never end) I think it is a good time to talk about what is going on with the Spring Java Framework.

Over the past year there have been some big things going on with Spring, probably the chief among them the move in April 2013 to place Spring under the control of the new company GoPivotal.  This spin-off from VMware, along with an investment from GE, is meant to support a new breed of applications where cloud and big data are a given not some afterthought on a platform not built for it.  With the ever-expanding broad ecosystem of Spring-related projects, in addition to the immense popularity of the core Spring Framework, Spring seems a natural fit as an application framework to support this.  Probably the most immediate change for those already using the Spring Framework day to day though was that there was a new web site to get Spring documentation, downloads, resources, etc:

http://spring.io/

Fast forward to the end of 2013 and we had the release of the Spring 4 Framework in December.  The release of Spring 4 fits nicely with the desire to support more modern applications as support for many new technologies has been added.  Among those are included support for Java EE 6 & 7, Java SE 8 (which was just released) and more recent versions of many optional third party libraries.  Spring 4 is also a new foundation for the expanding list of Spring-related projects, the following just a few key ones to mention now:

  • Spring Boot – Jumpstart on rapid development of Spring applications
  • Spring Data – An umbrella project with a number of useful utilities for popular data access technologies like MongoDB, Hadoop, and JPA
  • Spring XD – Unified system for big data ingestion, analytics, batch processing and export
  • Spring Security – Application security framework
  • Spring Mobile & Spring for Android – Support for developing mobile applications
  • Spring Integration – Implementation of well-known enterprise integration patterns
  • Spring Batch – Comprehensive batch application framework
  • and several more

As you start to look at the Spring 4 Framework and what it can do for you, we at Web Age Solutions would like to assist you in that discovery.  Below are some links to a webinar we will be giving next week on the changes in the Spring 4 release and a link to the new training category we have posted with Spring 4 training classes.

WEBINAR – What’s new in Spring 4, Thursday March 27th 1:30-2:30 PM Eastern

TRAINING CLASSES – Spring 4 Framework Training Classes

Here’s to hoping that your wait for using Spring 4 will not be as long as the wait for Spring 2014 has seemed!

,

No Comments

Testing Cordova Hybrid Apps in Worklight

Recently I worked on a project that introduced me to IBM® Worklight® mobile application platform. Among other things, I was pleasantly surprised at the price tag of the Developer Edition of this product: it is free. The Developer Edition comes with an Eclipse-based IDE called the Worklight Studio which offers support for authoring the client-side of your mobile web, hybrid and native apps as well as developing server-side components called adapters.

The Worklight Studio comes with a web application called the Mobile Browser Simulator that can help you with developing and testing your hybrid applications created using Apache Cordova framework. The Mobile Browser Simulator offers you a suite of visual controls for simulating a variety of native bridge APIs to such native device capabilities as accelerometer, camera, compass, file system, device info, contacts database, etc., without the need to run your apps directly on mobile devices or their emulators (which would require setting up specific run-time environments, such as ADT Eclipse plug-in for Android, Xcode for iPhone, etc.)

Here is a screen-shot of the Mobile Browser Simulator that shows Cordova APIs’ visual controls/widgets on the left with the expanded Battery widget that helps simulate different battery levels and the battery plugged-in event (fired when the battery is plugged in for charging and stays in this state until un-plugged).
Worklight 6.0 Mobile Browser Simulator Screen

So, if you are interested in this approach to testing Cordova hybrid apps, below are a few simple steps to follow that will help you get up and running in no time.

Note: For this blog posting, I used Worklight ver. 6.0 which comes with Cordova framework ver. 2.6.
Read the rest of this entry »

1 Comment

Java EE 8 and beyond

Every new release of the Java EE platform makes it incrementally better by adding new features or simplifying its interfaces which was also the main theme of the latest Java EE ver. 7 release (Oracle press release can be found here).

Let’s review some of the aspects of the new release and touch on the subject of the platform’s potential growth vectors.

 Reduce the boilerplate code.   Is the mission finally accomplished?

One of the repeated topics in each and every Java EE release since version 5 has been “reducing the boilerplate code”.  And it looks like that with the help of meta programming facilities offered by annotations and Contexts and Dependency Injection (CDI) capability introduced in JEE6, this goal has been practically achieved. The latest beneficiary of this exercise is JMS that in EE7 underwent a major overhaul.  The incidental complexity of JEE programming has been reduced to the point beyond which it would require something conceptually similar to emoticons to make it even simpler.  As the old adage goes: “Make things as simple as possible, but not simpler.” So there is probably not too much to expect (or demand) in this department in future releases …

Caching

Java in-memory caching API (JCache) did not make it to the final release of Java EE7 and is likely to be included in the JEE8 release.  Not a big deal for those Java developers who know that they can always plug in ready-to-use in-memory cache solutions for Java objects such as the open-source Ehcache product (which is a version of the JCache specification as implemented by Terracotta).

More support for web technologies

JEE7 now offers support for a wider range of web technologies, such as HTML5, WebSockets, and JSON all of which will consolidate its position as a feature rich modern web server platform.  This is a big thing, no doubt.

Currently, JEE already has the servlets, JSPs, JSFs, and facelets with the overall trend toward increased sophistication of Web tier programming which is directly correlated with its growing complexity.

To reduce complexity of Web tier development and potentially draw additional interest in the platform, a move in the opposite direction – toward simplified Web programming models in JEE – may be a viable alternative.  Scripting support from web-aware components like Groovlets or the like may fit the bill.  Another area to explore could be simplified access to business logic via an AJAX-based bridge between JavaScript (or any other browser scripting language that may become popular in future, like Dart and Java modules.  Currently, there are quite a few Java Web Remoting frameworks such as DWR,  Apache Tuscany project (to some extent), and Google Web Toolkit, that can be used as a starting point for the analysis of such systems.

Embracing techniques and ideas from open source projects

Java EE has started to more willingly embrace proven techniques and ideas conceived and developed outside of the realm of Java EE specs.  Under this trend, JEE can effectively (and efficiently) leverage the know-how used in developing systems that are already enjoying a wide adoption in the Java community.  An example of this would be the Contexts and Dependency Injection (CDI) capability built on top of the ideas and concepts underlying the popular Spring and Guice dependency injection systems as well as the Seam context management framework.

Now, without much ado, JEE7 fast-tracked the Batch Processing spec based on the Spring Batch framework (batch jobs are tasks that can be executed without user interaction, such as ETL scripts, etc.).

Support for NoSQL Databases

NoSQL databases are on the curve of gradual adoption in the Enterprise world and this is one of the areas where JEE can take a big piece of the action.

One of the models to emulate is SpringSource’s Spring Data umbrella project that offers Spring-powered data connectors to NoSQL databases, map-reduce frameworks, and cloud-based data stores.

EIS vendors, who wish to expose functionality of their products to the JEE platform in a “standard JEE” way, are always welcome to create JCA-compliant resource adapters for their products thus lending credibility (in the eyes of some conservative executives) to their NoSQL solutions.

This activity needs to go along with an effort to standardize a “NoSQL language” (if one is ever accepted by the very diverse NoSQL database community).  Unstructured Query Language (UnQL) project is a step in this direction.
Read the rest of this entry »

No Comments

Create Better Web Applications With Java EE 6 Training

At Web Age Solutions, we have the challenging task of not only keeping up with technology specifications but whether clients are actually using those technologies.  We have started to see much more interest in Java EE 6 training on various platforms so this is obviously taking hold.

Java EE 6 had the unenviable distinction of being released pretty much right as companies were trying to dig out of the 2008-2009 economic downturn.  So even though it did take 1-2 years for all of the major server platforms to release versions that supported it, many clients were taking a “wait and see” approach to upgrading.  Since companies first have to upgrade to the most recent platform before they can even think about using the new technology that is available it has taken until now to really start seeing that take hold.  Even JBoss clients, which usually take a more “figure it out on our own” approach, are doing training to make sure they can fully take advantage of the latest JBoss version, including the very different administration model (which we cover in our WA2060 JBoss Administration and Clustering course).

One of the primary barriers to taking advantage of what the new platform can do is simply knowing what is available.  Quite often projects take an approach of “we do it this way because we’ve always done it this way” and don’t look for ways to improve and simplify their applications by leveraging new approaches to programming.  With Java EE 6 (and soon Java EE 7) continuing to expand the possibilities that are out there this is becoming more of an issue.  We are a long way from the days when only Servlets/JSP were “standard” and you needed a thick “patterns” book just to create your own web framework.

To further support those that might be looking for Java EE 6 training, I’ve updated all of our course maps for Java EE 6 training on the major platforms.  These course maps show a different path depending on if you are familiar with the big changes introduced in Java EE 5 since several clients often skip versions of a server and in particular we are seeing migration paths like WebSphere 6.1 –> WebSphere 8.x.  These course maps also mention some of the Spring 3 training classes we offer since clients sometimes do training in that area as well.

Java EE 6 Course Map for WebSphere 8.5

Java EE 6 Course Map for WebSphere 8.0

Java EE 6 Course Map for WebLogic 12c

Java EE 6 Course Map for JBoss

Looking to the future, the Java EE 7 specifications are finalized and servers are being updated right now to fully support them.  JBoss is as well and will probably be released early next year (they say this year but JBoss is always missing release deadlines).  The tricky thing is that the open source project is being renamed to “Wildfly” and the “JBoss” name will be reserved for only the supported version.  There is already a version mismatch between the two and now having two different names I think is going to cause more confusion but we will see.

As servers release support for Java EE 7 I think the goal is to try and release classes as early as possible.  This will depend somewhat of course on which servers release support first.  We are going to be working internally to develop ways where we can develop hands-on labs that are more modular and can be more easily reused in different courses so we can start developing those early and support more clients that are “early adopters” and want to upgrade quickly.  Java EE 7 contains a lot of updates as well so we are looking forward to introducing that to clients as they start moving to servers that support it!

Now we get to sit back and enjoy watching the “race” of which server supports Java EE 7 first.  Any bets?

No Comments

Accessing EJBs from Java SE Using WebSphere’s Embeddable EJB Container

Introduction

In this blog, we’ll explore how to employ the Embeddable EJB Container inside a Java SE application using WebSphere Application Server 8.x.

Embeddable EJB Container

One of the new features introduced in EJB 3.1 (part of Java EE 6) is the Embeddable EJB Container. The main two use cases for the Embeddable EJB Container are:

  1. Unit testing your EJBs without requiring a Java EE application server
  2. Embedding EJBs inside a Java SE application, which allows you to take advantage of their benefits (e.g., security and transactions)

The primary advantages of using the Embeddable EJB Container are:

  • You don’t need to install the application server if all you need to do is unit test or employ your EJBs within a Java SE-based application. You just need access to the vendor’s Embeddable EJB Container JAR file.
  • The Embeddable EJB Container starts almost instantaneously, unlike the server-based EJB container (which can take a minute or more to start up), since the Embeddable EJB Container initializes only EJB-related components.
  • The Embeddable EJB Container has a much smaller memory footprint than the equivalent server-based EJB container.

Read the rest of this entry »

1 Comment

WebSphere 9 Coming Soon?

UPDATE:  As it turns out my guess that there would be an “intermediate” release was correct.  WebSphere 8.5.5 was released recently which mostly has updates for the Liberty profile being a certified implementation of the Java EE 6 Web profile.  The Redbooks updates was obviously for this 8.5.5 version.  The other points are still true though and I would be surprised if there is not an announcement of WebSphere 9.0 at or before the Impact 2014 conference next spring.

ORIGINAL POST: I know for those of you out there using WebSphere, the initial reaction to the title of this blog post is probably “But we haven’t even finished migrating to WebSphere 8.0/8.5!”  I myself didn’t think a new WebSphere version could be waiting in the wings but there have been a few interesting data points to consider:

- Java EE 7 should be final by end of May this year (http://java.net/projects/javaee-spec/pages/Home).

- Many Java EE 7 JSRs are already in final review (http://jcp.org/en/jsr/stage?listBy=proposed).

- IBM Developerworks has betas of 9.0 versions of development tools (https://www.ibm.com/developerworks/mydeveloperworks/blogs/wasdev/entry/download?lang=en)

- IBM Redbooks had a residency open to update several core WebSphere Redbooks to “the latest release of WebSphere Application Server”.  This was only open to IBM employees since people who work on the Redbook would obviously get a “sneak peek” at the next WebSphere.

Although thinking about when WebSphere 9 might be released is interesting, I think there is another possibility, that there will be some “intermediate” release that includes updates mainly to the Liberty profile, the lightweight server that IBM is trying to tailor to developers.  Perhaps there will be something like an 8.5.5 release mainly to pick up updates to the Liberty profile.

Read the rest of this entry »

2 Comments

The Performance Evil that is JSF dataTable

In JSF 1.x, dataTable was bizarrely inadequate and unnecessarily complicated. Things have become much easier in JSF 2.0 and it’s a pleasure to work with. But, don’t let that lull you into a false sense of security. There are major performance issues larking behind.

Let’s say that you have a managed bean that returns a list of products from the database by using the ProductDAO class.

@ManagedBean
public class Controller {
    private Product item = new Product();

    public List<Product> getProducts() {
        return ProductDAO.getProducts();
    }

    public String edit(Product toEdit) {
        this.item = toEdit;

        return "edit_product";
    }

    //getItem/setItem...
}

Now, we can build a view that shows the product list.

<h:dataTable id="products" value="#{controller.products}" var="current">
    <h:column>
        <f:facet name="header">Product Name</f:facet>
         #{current.name}
        <h:commandButton value="Edit" action="#{controller.edit(current)}" />
    </h:column>
</h:dataTable>

When the view is rendered, it will look something like this.

image

Now, let’s reveal the performance horror that the dataTable is. During the rendering phase, getProducts() is called repeatedly, once for each item in the list. That means, you are loading the entire list repeatedly from the database. This seems prodigiously wasteful. I don’t see why JSF couldn’t get the list once and simply iterate through it to render the table.

Next, when you click the Edit button, things get even worse. The getProducts() method is called 2xN number of times where N is the number of items in the list. To render the edit form, all you really need from the database is the item that is being edited. Under this circumstances, dataTable is doing a terrible job.

OK, so, what can we do about this. First, you need to cache the list in a member variable and access the database only if we haven’t already done so.

@ManagedBean
public class Controller {
    private Product item = new Product();
    private List<Product> productList = null;

    public List<Product> getProducts() {
        if (productList == null) {
            productList = ProductDAO.getProducts();
        }
        return productList;
    }

    public String edit(Product toEdit) {
        this.item = toEdit;

        return "edit_product";
    }

    //getItem/setItem...
}

This will cure most of the ills. But, there is still the issue of unnecessarily loading the entire list just to render the edit form. The solution for that is to use a GET request. Get rid of the edit() method and instead add the loadProduct() method that will load the product being edited.

@ManagedBean
public class Controller {
    private Product item = new Product();
    private List<Product> productList = null;

    public List<Product> getProducts() {
        if (productList == null) {
            productList = ProductDAO.getProducts();
        }
        return productList;
    }

    public void loadProduct() {
        int productId = item.getId();
        item = ProductDAO.getProductById(productId);
    }

    //getItem/setItem...
}

In the edit form page, say, edit_product.xhtml, setup GET request by adding this metadata.

<f:metadata>
    <f:viewParam name="productId" value="#{controller.item.id}"/>
    <f:event listener="#{controller.loadProduct}" type="preRenderView"/>
</f:metadata>

Finally, change the dataTable to use <h:link> instead of a <h:commandButton>.

<h:dataTable id="products" value="#{controller.products}" var="current">
	<h:column>
		<f:facet name="header">Name</f:facet>
		#{current.name}
		<h:link outcome="edit_product" value="Edit">
			<f:param name="productId" value="#{current.id}"/>
		</h:link>
	</h:column>
</h:dataTable>

That should do it. If you are still hatin’ dataTable, then go with <ui:repeat>.

1 Comment

First Java EE 6 Web Service Class Released

We have just released our first web service class as part of our Java EE 6 courses:

WA2087 Programming Java SOAP and REST Web Services – WebSphere 8.0 / RAD 8.0

Java EE 6 contains two ways to write web services, JAX-WS for “classic” SOAP web services and JAX-RS for REST web services.  This class covers how to implement both styles.  The course also covers securing both types of services and compares the two styles so you can decide which might be appropriate for different situations.

I think this course will be especially useful for people that support JAX-RPC web services from J2EE 1.4 but need to look to what are the more recent Java standards for web services.  Java EE 6 put JAX-RPC on the “proposed optional” list of technologies which means in the future Java EE servers may not be required to support JAX-RPC.  Although I expect WebSphere will still support it now is a good time to start looking for how to migrate JAX-RPC web services to more recent standards like JAX-WS and JAX-RS.

This course is part of our WebSphere Application Server 8.0 Programming course map.  We have other courses that cover just JAX-RS or just JAX-WS as well as a course that covers REST services with JAX-RS and the AJAX clients that are most common for REST services.

If you have any questions about these courses feel free to contact us.

No Comments

Eclipse Juno is Here!

What does the end of June and Java development have in common?  Looking forward to the yearly coordinated release of all the latest Eclipse updates.  This year the release is code named “Juno”.  The release in June 2011 was “Indigo”. 

This year marks the 7th time that the “Simultaneous Release” approach has been used that lets a new version of the underlying platform and all of the projects that build on top of it release.  This has helped to greatly improve the compatibility between projects and the stability of the Eclipse platform as a whole.  It also helps the numerous commercial products that are based on Eclipse count on a consistent schedule and release updates quickly based on the new updates.  This year there were about 70 Eclipse projects part of the Juno release which expands on the 62 that were part of Indigo last year.

If you want to get started the first place to go is probably the usual Eclipse downloads page.  This has been updated for links to the Juno versions of several different “pre-configured” combinations of Eclipse tools besides just the “basics” of the core platform.  One of the most popular downloads is the “Eclipse for Java EE Developers”.

Now I will be the first to admit that like most of you, I can’t spend too much time looking at the new features that are coming out before they are released. So this post is more of a “news” post and future posts will dive into some of the details about what is new. Probably one of the best places to start for this kind of info are some of the “New and Noteworthy” pages like the one for the Java EE tools and the one for the core platform itself and the Java tools.

Probably one of the biggest changes is that the “default” version for the Eclipse SDK, which is the core of the platform is Eclipse 4.2.  The Eclipse 4.x platform has been in the works for over a year but this is the first release where it is the “default”.  All of the previous simultaneous releases were using the Eclipse 3.x platform so this has definitely been a measured process that Eclipse has gone through.  It appears the “regular” Eclipse user won’t notice this much though compared to Indigo except for an updated UI style.  For anyone developing Eclipse plug-ins or perhaps RCP (Rich Client Platform) applications using Eclipse there are more changes, although it is said that Eclipse plug-ins developed for previous Eclipse versions will have “binary compatibility” with the new version so hopefully this would be a smooth process.  Certainly anyone in these categories will want to check out the Eclipse 4.x SDK page for more details.

BTW, if you want to set your calendars now, the next major release will be June 26th, 2013.  This will be codenamed “Kepler” in keeping with the astronomical theme which has also recently started picking names that are alphabetical.

No Comments