Search This Blog

2009-12-28

High-Tech

Hello again,

Since I am somehow related to Sweden I travel to this country regularly.
Every time I go there I am astonished by the wide spread technological progress and its common use in every day life. Not only young people are using new technologies, but also grandmas, or grandpas!
To give you some examples.

Number 1: In the supermarket:
At ICA, the largest retail company in the Nordic countries, you can chose between paying your food the normal way (shopping cart, scanning, checkout) OR with a self scanning service. See the following video.



After you chose all of your things you have to go to one of those machines and pay: By the way, I didn't have any problems scanning the goods. And yes, you can cheat, but the Swedes are honest people.




Number 2: Virtual bus ticket (SMS)
If you want to purchase a bus ticket in a city in Sweden, you can send a text message to obtain your virtual ticket. After you receive the message (your ticket) you have to show it to the bus driver.


There's also a nice article about this topic.


Number 3: Facebook usage
Another amazing thing is the fact that in Sweden even grandmas have facebook accounts. They sometimes use facebook to invite their grandchildren for "fika" (the swedish word for coffee break). Unbeliveable! I have problems explaining my dad the difference between SMS, CD, DVD and Email :)

Last but not least, for all the statistics lovers, visit this link
For all the developers out there, the next possibility for a visit to sweden will be on March 16-17, at the Scandinavian Developer Conference 2010. By the way, the Swedes speak English very well, so there are no language barriers not to visit this country :)

Hälsningar/Greetings (from Sweden)
Daniel

2009-12-23

Java EE 6 - CDI (JSR 299) - my first impressions

Hi there!

After taking some time to go through various documents (see link list below) and do some coding samples about the topic CDI, the following things came into my mind:
"lots of annotations", "very abstract specification", "what role will CDI play in JavaEE within the next years?", "can become quite powerful", "I need some best practices".

The specification of CDI (CDI stands for Context and Dependency Injection) with its 92 pages is in my opinion not the right place to start if you want to learn CDI. It is an abstract specification, which shows all the elements a CDI capable container must implement. I really like the specification, but as the code samples didn't really help me (due to missing explanations), I think it is just not the best place to start.
Weld, the reference CDI implementation, offers a great documentation (see link below).
By the way, there are other implementations, too: Resin Candi and Apache Open Web Beans.
If you use Glassfish V3, Weld is included and if you develop using the WebProfile (see earlier post), Weld is even included.

But what is CDi all about? CDI offers..
- an improved lifecycle for stateful objects, bound to well-defined contexts
- a typesafe approach to dependency injection
- object interaction via an event notification facility
- a better approach to binding interceptors to objects, along with a new kind of interceptor, called a decorator, that is more appropriate for use in solving business problems
- an SPI for developing portable extensions to the container.

Gavin King mentioned in the interview:
Originally JSR 299 was called Web Beans, to emphasize its role in making the web technologies of Java EE 6 work better with the transactional access technologies. Originally, one of the key problems we wanted to solve was how can we build an application that uses JSF very easily together with technologies like EJB. So it was originally called Web Beans...It over‑emphasized that this was a web technology, when if you actually look at CDI, it's actually something much more general than that. So after much discussion, the name of the spec ended up being changed to “Context and Dependency Injection."

One of the main buzz words is (Managed) Bean. We have been using beans in Java a lot before. There are Enterprise Java Beans, Message Driven Beans or JSF managed beans. Now, in JavaEE 6 the word bean finally gets a well defined definition.
Managed Beans are defined as container managed objects which support a small set of basic services, such as resource injection, lifecycle callbacks and interceptors
With very few exceptions, almost every concrete Java class (also known as pojo) that has a constructor with no parameters (or a constructor designated with the annotation @Inject) is a bean. This includes every JavaBean and every EJB session bean.

To give you a short impression about what a Managed Bean can look like see my BeyonceBean :)

@Named
@SessionScoped
public class BeyonceBean implements Serializable {

@PrivateMusicLabel
@Inject
private Label label;

@Produces
@Named(value = "singBeyonce")
public String singBeyonce() {
return "Everywhere I am looking now, I am surrounded by your embrace...Halo Halo Halo";
}

public String getInjectedMusicLabelInfo() {
return label.toString();
}
}

If you want to learn CDI you should stick to the Weld Documentation provided by JBoss. There are many well described code samples. Maybe this code sample explains what first came into my mind: " lots of annotations" . I am sure it'll take some time to get used to this way of Java enterprise coding. With CDI you really focus on creating/using lots of annotations, either for type safety reasons, for interceptors or decorators.
UPDATE 01-23-2010
Reza Rahman, a Resin team member, provides some perfect articles for CDI beginners. I really like the way he explains the CDI features. So this link might be a perfect if you are new to CDI.

Another reflection I would like to share with you is my CDI experience with Netbeans 6.8 and Glassfish V3.
- If you don't annotate your Bean with @ManagedBean you don't get the JSF code completion feature. This is very inconvenient. But I am sure the Netbeans developers and community will provide a solution soon.
However, there is actually a more general problem with the @ManagedBeanAnnotation. The article Is @javax.faces.bean.ManagedBean Dead on Arrival?. describes that there are 3 different ways in JavaEE6 of how to define a ManagedBean in the source code: with JSR 316,250/JEE6Spec,AnnotationSpec javax.annotation.ManagedBean, with JSR 314/JSF2Spec javax.faces.bean.ManagedBean and with JSR299/CDISpec javax.inject.Named. So which one should we use? Use the @Named annotation!
- Then I had some problems with the Deploy on Save. When I changed the scope of the bean from request to session, I had to do a clean, otherwise I got a deployment error "Managed bean declaring a passivating scope must be passivation capable" -- which means must implement serializable (even though I added the Serializable interface).
I am going to take a closer look at this and see if there already are some open issues. Otherwise I will submit this problem.

My conclusion:
As I haven't figured out the full capacity of CDI and as it seems to have the power to change the way of writing Java EE applications essentially (or may even become the new JEE6 core programming model), I am very interested in CDI and I will continue reading about it.. As soon as ICEFaces 2.0 will be released I will update my training application from JavaEE5 to EE6 and focus on applying CDI features. As I will have to wait for at least another month I will keep an eye on how CDI is evolving.

Here are the links:
Specification - JCP 299 CDI
Weld documentation - JBOSS about CDI
Gavin King on CDI - tech discussion @ javalobby
CDI capable servers and deployment - see here

UPDATED 01-20-2010:
Java EE 6 Codecamp - Here you can do some CDI homework examples. A great way to learn Java EE.

2009-12-19

Java EE 6 - The WebProfile

Hi guys,

Within the next few weeks/months I will write about the new Java EE6 components.
The first new feature I am focussing on is the so called WebProfile.
The Web Profile is targeted at developers of modern web applications.
Within the last years developing web applications has become more and more important. However, there has also been a large number of technologies for the creation of web applications. All of them had to face similar challenges, like security handling, persitence or transaction handling. The WebProfile aims at defining a basic stack for developing web applications using the Java platform.

The following technologies are required components of the Web Profile:
•Servlet 3.0
•JavaServer Pages (JSP) 2.2
•Expression Language (EL) 2.2
•Debugging Support for Other Languages (JSR-45) 1.0
•Standard Tag Library for JavaServer Pages (JSTL) 1.2
•JavaServer Faces (JSF) 2.0
•Common Annotations for Java Platform (JSR-250) 1.1
•Enterprise JavaBeans (EJB) 3.1 Lite
•Java Transaction API (JTA) 1.1
•Java Persistence API (JPA) 2.0
•Context and Dependency Injection (JSR-299)

The maven repository offers the following jar for the WebProfile
(see maven repository url).
Include it into your pom like this:

<repositories>
<repository>
<id>java.net2</id>
<name>Repository hosting the jee6 artifacts</name>
<url>http://download.java.net/maven/2</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
</dependencies>

If you chose Netbeans 6.8 as your development environment you can create a maven built web project. In the project properties within the run menu you can switch between the different profiles (full and web).

After switching you see the difference in the libraries (the full profile uses the javaee-api-6.0.jar).

The Java EE6 reference implementation Glassfish V3, based on OSGI, allows the dynamic addition of new functionality both from Sun and third parties. Glassfish V3 offers both the Full JavaEE profile and the new WebProfile.
Based on internal Sun benchmarks, Sun GlassFish Enterprise Server v3 startup times are over twice as fast as v2 and in the case of the Web Profile offering, nearly three times faster.
The following glassfish page gives you a perfect overview between what is included in the Web Profile and in the Full Java EE Profile.


I really love the new WebProfile. Not only because of the performance boost, but also because of the simplified packaging (No EAR packaging needed anymore). So if you don't depend on JMS or remote EJBs, the new WebProfile is what you were looking for as a web developer. Give it a try.

2009-12-13

Java EE 6 - The Overview

Hi altogether,

While enjoying my christmas holidays in Sweden I have enough time to look at some of the new features Java EE 6 offers.
Here's the overview:

- JavaTM Platform, Enterprise Edition 6 (Java EE 6) Specification, JSR 316
- Contexts and Dependency Injection for the Java EE Platform (CDI), JSR 299
- Enterprise JavaBeans 3.1 (No Interface, Singelton, asynchronous EJBs vs MDBs, Timer), JSR 318
- Java API for RESTful Web Services (JAX-RS), JSR 311
- JPA 2.0 (Support for Pessimistic Locking), JSR 317
- Dependency Injection for Java, JSR 330:
- Bean Validation, JSR 303
- Servlet 3.0, JSR 315
- JSF 2.0, JSR 314
- new Deployment possibilities
- improved/simplified testing

Right now I am focussing on CDI (JSR 299), which is a pretty big new part in Java EE 6. It'll take some time to summarize. In the meantime, I hope you're enjoying your free days over christmas.

So God Jul, Merry Christmas, Frohe Weihnacht, Feliz navidad, Joyeux Noël! or if you need some more translations...

So JavaEE 6 and Glassfish V3 are ready to rock!

Hi guys,

I want to tell you my first experiences with JavaEE 6 and Glassfish V3.
By the way, I favor Netbeans over Eclipse because of the great JavaEE wizards and maven integration (Netbeans Version 6.8 was released on the same day as Glassfish V3)

The first thing I did was trying to deploy my JavaEE 5 application on glassfish V3. BUT, not as an EAR project, but as a Web Project.
I really like the fact, that you don't necessarily need the EAR packaging. If you put your packaged EJB Content (xxx.jar) into the folder WEB-INF/lib of your WebProject, Glassfish automatically recognizes that your application contains EJBs. The same if have JPA Entities.



One of the biggest benefits I get from using only the WAR file is the great deployment time and the Deploy on Save functionality. There are still problems with Netbeans if you want to use the deploy on save feature with maven built javaEE projects. (Ear, War, EJB), see this post. But with only one war file all the changes you do to your web project will be deployed automatically. You just have to turn on the Deploy on Save within the Projects Properties .



Starting GlassFish V3 and deploying my application on my MacBook Pro takes about 19 seconds:
INFO: GlassFish v3 (74.2) startup time : Felix(3459ms) startup services(15633ms) total(19092ms)
Once started the redeployment due to deploy on save is so fast, i don't event see netbeans redeployment status window in the corner down right. :)
So to make my application be JavaEE 6 compatible I also had to do some changes on the Web Project itself. I had to update the web.xml and I moved the configuration within the faces-config.xml into the beans itself by using the following annotations:
@ManagedBean(name = "Login")
@RequestScoped

But as I use ICEFaces and ICESoft hasn't released the final JSF2.0 compatible version I still have to wait until I can benefit from this great perfomance boost, JavaEE6 will bring. There is a alpha release of ICEFaces V2.0 however, there's too much things to fix if you want to make it work. If you are interested in the latest problems see this post.

So this was just my first impression on JavaEE6 and glassfish. I will tell you more about the new features of JavaEE as soon as ICEFaces 2.0 is released.
Greetings and have a nice day!

2009-12-10

Waiting for JavaEE 6

Hi alltogether,

After the approval of the Java Enterprise Edition 6 (Java EE 6) Specification we are very close to the final release.
Roberto Chinnici writes in his blog that the release date will be december 10, 2009, when Glassfish V3 will be available.
I am really looking forward to these releases. However, as a user of the ICEFaces Framework, I still have to wait until ICEFaces 2.0 is going to be released. ICEFaces 2.0 will be the JSF2.0 compatible version. Right now there's only a alpha version available.

So, if you like to read more about the new features of JavaEE6 and Glassfish V3, check out the following links:
- JavaEE6 @Sun
- GlassFish V3

2009-11-30

Netbeans 6.8 Release Candidate 1 - my first impression

Hi there,

from now on you can download the release candidate 1 for Netbeans 6.8. download it here
For those who don't know anything about the build types for Netbeans releases here are the possible enums :)
- Milestone
- Early Access
- Beta
- Release Candidate
- Release

I was very curious about this release candidate. The most important feature I am missing / waiting for is the Compile on Save feature for Maven Java EE Projects (vote for it here) However, this feature hasn't been implemented yet. In my opinion, this is a must have feature if you develop javaEE projects with maven and netbeans. So hopefully it will be implemented in the 6.8 release version. Let's wait and see.

Another problem I faced with Netbeans 6.8 M2 was the very frequent Glassfish PermGen Out of memory exception. I've been getting it whenever I published too often (means after about 20 deployments of the ear project within an hour).
While working with this release candidate for the last hour this OutOfMemory Glassfish problem hasn't occured. Good news.

Another problem also vanished. Netbeans sometimes crashed when I was trying to insert jsf value binding in xhtml files.

All in all the Netbeans developers are doing a great work. Keep on developing!!! Thanks a lot for this great IDE.

2009-11-15

Netbeans 6.8beta, Glassfish V2.1, EJB 3.0 Deployment Problems

Hi alltogether,
Within the last few weeks I sometimes had to face with the following exception, which appeared out of nothing.

Exception occured in J2EEC Phasejava.lang.IllegalArgumentException: Invalid ejb jar [...EJB-1.1-SNAPSHOT.jar]: it contains zero ejb.
Note:
1. A valid ejb jar requires at least one session, entity (1.x/2.x style), or message driven bean.
2. EJB3+ entity beans (@Entity) are POJOs and please package them as library jar.
3. If the jar file contains valid EJBs which are annotated with EJB component level annotations (@Stateless, @Stateful, @MessageDriven), please check server.log to see whether the annotations were processed properly.

At first, I thought it was a problem with changing the snapshot version (see this post)) but this actually wasn't the problem. Maybe, it's a problem of Netbeans 6.8beta version. Anyway, I still haven't figured out the source of the problem, I can only tell you what you have to do to make it work again. Recreate your glassfish domain. Here is a how to link

I hope this is helpful for you. It took me some hours to fix the problem, which was very annoying.

2009-11-01

ICEFaces meets JSF2.0

Hello again,

As I have been developing most of my applications with ICEFaces as JSF implementation, I am very curious to test the first version of ICEFaces 2.0 Alpha. The ICEFaces core is now on the Mojarra JSF 2.0.1 runtime.
Read more about it
http://blog.icefaces.org/blojsom/blog/default/2009/10/30/ICEfaces-2-0-Alpha-1-is-out
As soon as I migrated from 1.8.2 to this Alpha version, I will tell you my experiences.

Netbeans, Maven, JavaEE, new snapshot version problem

Hi guys,
instead of celebrating Halloween I struggled with a problem building my maven based javaEE Trainer application in Netbeans 6.7.1. A few minutes ago, I finally found out what was wrong. The problem I am telling you took me about 3 hours to fix...grrrr

So, what was the problem?
I have an Ear project, consisting of a web project, an ejb project and a jar project, all maven projects created with Netbeans.
When I changed the IceFaces Libraries of the web project I also updated all of the projects pom.xml files, as I created a new snapshot version.
From this point on, I wasn't able to deploy/publish the application anymore! The error message I received was: invalid ejb jar it contains zero ejb

1. A valid ejb jar requires at least one session, entity (1.x/2.x style), or
message driven bean.
2. EJB3+ entity beans (@Entity) are POJOs and please package them as library
jar.
3. If the jar file contains valid EJBs which are annotated with EJB component
level annotations (@Stateless, @Stateful, @MessageDriven), please check
server.log to see whether the annotations were processed properly.


The problem was, that I forgot updating the application.xml within the EAR project. In it, I was still using the older snapshot version of the EJB project. So in my projects target folder, the gfdeploy folder had both the older and the latest snapshot version, which made publishing to glassfish impossible. So never forget to update both your poms and your applicationx.xml, if you are creating a new snaphot version!

Enjoy your weekend!
Daniel

2009-10-23

It has been quite a while...

I has been quite a long time since I have published the last blog post.
As I did a few things I now have to think back what I actually did...:)
First of all, while developing my basketball application (see ) and working for my current customer I got the idea to write an article about best practices in agile software development, which was pretty tough, what I can say right now, because I finally completed it last week. However, it will take some months until it gets published. I will tell you more about it as soon as I have more information.

What about my basketball application?
My goal is to release a snapshot version 1 just before christmas :)
I set up the perfect infrastructure for the application with hudson and sonar and created the first few web pages. By the way, IceFaces won the race for the web framework. Whether I am happy with this choice or not... I don't know. I definitly had to deal with some basic JSF understanding problems, as I am no UI guy. But with the help of some colleagues I could fight my way through the UI jungle and I am happy to say, that the application is on stable ground and ready to be filled with more and more functionality. There's only one problem. I don't really like to develop web content. Apparently I am not getting comfortable with this xhtml code.
Before I decided to choose IceFaces, I also evaluated Adobe Flex in combination with JavaEE. But I broke up with it because it would have been way more work for me to get used to developing Adobe Applications.

Within the next weeks I will focus on posting more about my experiences with the development of my basketball application and because of the article I wrote, I will post some news and experiences about agile, test driven development.

That's all for today, have a great weekend.
Daniel

2009-08-28

Netbeans 6.7.1, Maven WebApp with IceFaces 1.8.1 - a setup guide

Hi guys,
the last few days I had some problems setting up the web part for my upcoming application.
As I know that some of you guys stumbled upon my blog because you were looking for ICE Faces 1.8.x integration, I thought it would be useful to post my 'set up configuration'.
I am using Netbeans 6.7.1 with Maven 2.2.0 and IceFaces 1.8.1 and glassfish V3 prelude.
Let's start with the faces-config.xml, where you have to add the ICEfaces specific view handler

<?xml version='1.0' encoding='UTF-8'?>
<faces-config version="1.2"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
<application>
<view-handler>
com.icesoft.faces.facelets.D2DFaceletViewHandler
</view-handler>
</application>
</faces-config>

(this page helps you add xml code to your blog: http://centricle.com/tools/html-entities/

The next important configuration file is the web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>ICEfaces 1.8.1</display-name>
<description>web.xml for a icefaces 1.8.1 application</description>

<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>

<context-param>
<param-name>com.icesoft.faces.synchronousUpdate</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>com.icesoft.faces.concurrentDOMViews</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>

<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>Persistent Faces Servlet</servlet-name>
<servlet-class>
com.icesoft.faces.webapp.xmlhttp.PersistentFacesServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>Blocking Servlet</servlet-name>
<servlet-class>
com.icesoft.faces.webapp.xmlhttp.BlockingServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>Persistent Faces Servlet</servlet-name>
<url-pattern>*.iface</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>Persistent Faces Servlet</servlet-name>
<url-pattern>/xmlhttp/*</url-pattern>
</servlet-mapping>


<servlet-mapping>
<servlet-name>Blocking Servlet</servlet-name>
<url-pattern>/block/*</url-pattern>
</servlet-mapping>

<session-config>
<session-timeout>
30
</session-timeout>
</session-config>

<welcome-file-list>
<welcome-file>justatest.iface</welcome-file>
</welcome-file-list>

<listener>
<listener-class>
com.sun.faces.config.ConfigureListener
</listener-class>
</listener>

<!-- Listener implementation to handle web application lifecycle
events -->
<listener>
<listener-class>
com.sun.faces.application.WebappLifecycleListener
</listener-class>
</listener>
<listener>
<listener-class>
com.icesoft.faces.util.event.servlet.ContextEventRepeater
</listener-class>
</listener>
</web-app>


I use xhtml files for developing the user interface. If I enter the URL http://...../justatest.iface , the corresponding xhtml file will be rendered and send back to the client. (see the highlighted parts)

Last but not least the maven pom.file for all the required libraries

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>yourGroupID</groupId>
<artifactId>YourApplicationID</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>YourApplicationName</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.icefaces</groupId>
<artifactId>icefaces</artifactId>
<version>1.8.1</version>
</dependency>
<dependency>
<groupId>org.icefaces</groupId>
<artifactId>icefaces-facelets</artifactId>
<version>1.8.1</version>
</dependency>
<dependency>
<groupId>org.icefaces</groupId>
<artifactId>icefaces-comps</artifactId>
<version>1.8.1</version>
<exclusions>
<exclusion>
<artifactId>jxl</artifactId>
<groupId>net.sourceforge.jexcelapi</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
<finalName>YourApplicationName</finalName>
</build>
</project>



So, have fun developing with ICEFaces and let me know if this configuration was helpful for you.
Greetings Daniel

2009-08-11

Which web application framework do you recommend?

Hi guys,
it has been quite a long time since I published my last post. Sorry for that. Now that summer has finally arrived in Germany, it seems that every day there is an event after work. So I haven't found much time for developing. But one of my goals for the next few weeks is to release the first version of a Basketball Software, which a friend of mine asked me to do develop. I am not happy with the progress I am making, but my real life projects have a higher priority.
Considering this Basketball App, I started setting up the entity model, set up the workspace including a hudson environment (I love hudson, even for a one man project) and wrote the first session beans. I chose EJB3 for the backend part. However, what I haven't decided yet is the front-end part. I have done some projects using different JSF implementations, but I am thinking about whether I should try out something else. Can anyone of you recommend me something?
What about JavaFX? How good is the integration with JavaEE?
What about Wicket, GWT or Google Gears?
I'd love to do an evaluation for all of the implementations. Maybe I ll find some time to create one feature (like the createNewPlayer userInterface) with each of the frameworks. But if anyone out there has already done this evaluation, I would be very grateful.
So..as soon as I reached a certain progress level, I will write something about the upcoming application.

Have a great day..
Daniel

2009-07-28

JavaEE with RAD 7.5 and WAS7

Hi guys,

as I promised to post my experiences with RAD7.5 (Rational Application Developer) and WAS7 (Websphere Application Server), I will now show you what I tried to implement during the WAS7 presentation/workshop using the RAD7 wizards and code snippets.

STEP1: I created a WebProject
STEP2: and added a Servlet

--> there was no code skeleton generated for the servlet. Netbeans generates you at least something like this.

protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
/* TODO output your page here
out.println("");
out.println("");
out.println("");
out.println("");
out.println("");
out.println("Servlet Testservlet at " + request.getContextPath ());
out.println("");
out.println("");
*/
} finally {
out.close();
}
}
STEP3: I tried to deploy the WebProject to WAS7
--> RAD only allows you to deploy EAR files, so if you want to deploy only the war or ejb, you have to use the admin console. Very inconvenient. If you try to use the context menu and select run on server on the web project, you get the following exception:
Could not find a valid parent module to add to the server.

STEP4: I created a EJB Project
STEP5: and added a local stateless session bean, with some hello(String name) implementation
--> the wizard asks you to create a class diagram, which is a nice feature.
STEP6: I created a EAR project and added the EJB and the WebProject
STEP7: Invoke the local stateless session bean from the servlet
--> Of course, I could have coded this feature very easily by just adding the @EJB annotation but I wanted to see what the snippet produces, so I used the snippet: CALL a Session Bean Service method. The snippet wants to create an ejb reference and asks you to select the session bean. I selected my local stateless session bean and received the following error: Remote interface cannot be empty. So RAD tells me I can not invoke a local session bean from servlet where both projects are part of the same EAR? Interesting....
If I select remote even if the interface doesn't have a remote interface, RAD finally generates something...some code with compile errors...Welcome back to the world of EJB2.1 :) Feoijesfer is the name of the reference I had to enter... :)

protected FeoijesferRemote createFeoijesferRemote() {
= () ServiceLocatorManager.getRemoteHome(STATIC__REF_NAME, STATIC__CLASS);
try {
if ( != null)
return .create();
}catch (javax.ejb.CreateException ce) {
// TODO Auto-generated catch block
ce.printStackTrace();
} catch (RemoteException re) {
// TODO Auto-generated catch block
re.printStackTrace();
}return null;
}

private final static String STATIC__REF_NAME = "ejb/Feoijesfer_2";
private final static Class STATIC__CLASS = .class;

After this result I didn't want to waste any more time with RAD7.5. Of course it is now possible to create JavaEE applications with IBM products, but don't use the wizards I used. Do it yourself or switch to Netbeans.


2009-07-22

Free Sun webinar: Make Applications Highly Available: Load Balancing GlassFish Clusters

Hi guys,
today I attended at my first SUN webinar. Hopefully it won't be my last one with SUN, because I really liked it. It started very amusing with a hint regarding questions about Oracle. So, if you have questions regarding the Oracle Sun deal, please go to sun.com or oracle.com website. We won't respond on questions about this.

John Clingan, the GlassFish Group Product Manager, started this webinar with a presentation of the benefits of open source and keywords like: productivity focus, community and transparency, annual subscriptions, performance tuned and pay at point of value. Then he introduced the Sun GlassFish portfolio at a high level. The Enterprise Server, the Web Space Server (portal for website development and collaborative workspaces), Web Stack (a complete LAMP stack) and Glassfish ESB.

The main focus of this 1-hour webinar was on High Availability and Load Balancing with GlassFish V2.1. He quickly explained the features of the High Availability Database (HADB) with its 5-9s and the in-memory replication. If you want to have more information, I recommend reading the administration guide or this slideshow. After John, Shreedhar Ganapathy continued with his part about Load Balancing. He answered the question why Load Balancing is so important. If you want to meet business SLA's you have to have scalability to address any growth requirement. Fault tolerance is also very important to prevent any service degradation. Later he explained the GlassFish Load Balancing Plugin, which works with SunWebServer, Apache WebServer and Microsoft IIS.

Then it was time for the first demo. John showed us how to install Sun GlassFish Enterprise Server v2.1 with HADB on a Solaris platform. Apparently, it didn't work because of some problems while providing the path of the installed webserver. Therefore, this step was skipped and instead replaced with a demo deployment of a HA JSP Sample Application. The application was deployed on a cluster consisting of 2 instances. It showed us how to keep values in a HTTP session if one instance fails (they stopped one instance manually).

The last 10 minutes of the webinar were dedicated to questions: Here are some examples: I asked what makes GlassFish clustering and Load Balancing better than what IBM Websphere offers? Answer: It is much easier to install and support and administer through a centralized UI. In addition, it is the only Open Source App Server that supports 5 9s availability. Another question was: What will healthchecking actually do? Check if there are any exceptions thrown? Healthchecking checks, whether instances in a cluster are alive, dead or slow. What is a node agent or what is IIOP or even what is EJB ;) ? There were many different questions. As John couldn't answer all of them, he got support from other experts.

As already mentioned, I really enjoyed this webinar. The skill of the speakers is amazing. You can ask questions to the real GlassFish experts. Of course you can't teach a topic like this in only one hour, but the speakers did a great job in giving an overview. I have to admit that I still have to learn a lot about High Availability and clustered environments. Until now, I didn't care much about this topic as it didn't affect my work as a developer that much. But there's lots of great documentation to read....which I will start with....tomorrow..





2009-07-21

Introducing Websphere Application Server V7 (or WAS 7 with RAD 7.5)

Today I took part at a workshop/introduction of Websphere Application Server V7 in Stuttgart, held by 2 very nice guys from Nice, France. As a convinced glassfish user I was very curious about the first IBM Product, which is completely JavaEE compatible. Version 6.1 with fix packs for EJB or JAX-WS had still some missing things, such as the administration of web services. As I have been working with Websphere in some projects I had lots of critical questions, like what about the bad server start up time or the installation size? But maybe it has become better and they did some improvements since WAS6.1? Let's see what they told us.

I have learned that Websphere is not just an Application Server. It's an ESB, a ProcessServer, an XD, a Portal, a Business Modeler... Great news, but what about the licenses? Is it all included :)

The installation of WAS 7 takes about 200-300 Megabyte of your hard disk and a installation time of about 10 Minutes, maybe a bit faster, depending on your machine. If you want to create a profile which takes about 20 MB, you need some additional time for its creation. At lunch i asked how it can take up to 10 Minutes for 200 MB???? The speaker told me he has been asking this question since 10 years.. It's unbelievable.. WAS7 is installable on Windows and Linux/Unix. But let's be honest. Windows, RedHat and AIX.

With the same license for WAS7 you get a RAD Assembly and Deploy version, which provides basic support for creating JavaEE applications, deployment and testing. You have to pay some extra money if you want to have the RAD for Websphere (Rational Application Developer) where you get extra features like Adapters, Portlets, Crystal Reports, RUP, ReqPro, etc.

Then they gave an overview over the new features of JavaEE 5. It was mainly about the changes/improvements between EJB2.1 and EJB3 and JPA. They agreed that the release of WAS7 is pretty late, as we are almost about the new release of JavaEE 6 this year.

The next topic was the first demo. It was about the creation of Jax-WS webservices.
I looked at the time, as I remembered having had some problems with creating webservices with WAS6.x and RAD7. He started at 10.22 am, created a HelloService POJO, and created a webservices from this pojo with the help of the IDE. Within this menue u can can choose to create a client as well, deploy everything and call the test page. At 10.26 he was done. This was pretty good, as he did some explanation in between. He could have been faster ;) After this he attached a policy set through the admin console, added WS-ReliableMessaging, assigned a binding for it and finally exported it (you could choose between WSDL or WS MetadataExchange). After this, the client was configured, using generated policy. This was a very nice demo.

After the demo, they showed us the huge configuration possibilities Websphere provides, like BLAs (I like this expression, Business Level Applications), Filtering Options, Security Settings, Messaging Improvements and Clustering Settings. After lunch they presented the second demo. Also a very nice one. They created a clustered environment with two laptops and two nodes. Then we finally had time on our own to do some labs, which were prepared for us. I took the time for developing some servlets, jsf pages and ejbs, which weren't part of the lab. More about my experiences in the next post.

So, what about my summary?
I was really impressed by the skill of the 2 speakers. I wasn't sure whether it would be a pure marketing event or not? And it was a very technical event, which I really liked. I see that Websphere has its strength in it's admin console, where you can configure like almost everything. They have a strong focus on security and clustering issues and they don't care much about start up time or deployment time. If everything is configured well and you have a well clustered environment, you will have a good running environment in the end. But I am not sure if they focused on how to get there. Server start up time or redeployments is what a developer does every day, and there you have other applications where you can develop much faster. In my opinion, a developer will definitely be happier with Netbeans and glassfish.

2009-07-17

ICEfaces-1.8.1 AND NetBeans-6.7

Hi guys,
for all of you who developed web applications using ICEfaces with Netbeans 6.5.1 and now switched to Netbeans 6.7, you will no longer find the ICE Faces Plugin within 'Plugins - Available Plugins'
Instead you have to download it manually from http://www.icefaces.org/main/downloads/
After downloading go to Netbeans>Plugins>Downloaded>Add Plugins...>
Select both org-icefaces-netbeans-modules-lib.nbm and
org-icefaces-netbeans-modules-web-frameworks.nbm
The first one provides the run-time-libraries whereas the second one is for the netbeans project integration.
And if you are now about to create a new WebProject, Select ICEfaces and under ICEfacesConfiguration, you can now make Netbeans create a welcomeICEfaces.xhmtl (Facelets only). You should focus on using Facelets, as jsp will probably vanish with JSF2.0

So have fun!

For those who don't know ICEfaces (I really love this name..sounds pretty cool :) )
ICEfaces is an open-source Ajax application framework that enables JSF application developers to easily create and deploy thin-client rich Internet applications (RIA) in pure Java.

2009-07-13

Netbeans IDE 6.7 Refcard

Hi guys,
for those of you who don't know Netbeans development environment, there's a nice DZONE refcard available at
http://refcardz.dzone.com/
It gives you a very general overview about
  • What are the buttons for?
  • What does the editor look like?
  • What's new compared to the version before?
  • Some shortcuts for both PC and Mac users
  • and last but not least a list of links
My recommendation is just to download it from www.netbeans.org and test the features.
I switched from Eclipse to Netbeans about 2 years ago and I am completely happy with it.
What I like most is that this IDE gets better and better with every release, even with release candidates or master releases. I think the main difference between Eclipse and Netbeans is, that Netbeans focuses on providing the very basic functionality for a developer. It is very well tested and has a great integration with databases and application servers.
Eclipse, on the other hand, is more configurable and open for a lot of different plugins. The different download bundles indicate this.
I have met developers, who did a bit too much of eclipse customizing, which made their workspace get lots of problems at deploying and even compiling.
Netbeans also offers different bundles, but it's not about basic IDE features which differ, but support for other programming languages, such as PHP, groovy, C++ and some more.

I think there are different kind of developers, those who are happy with things that just work, and those who really love to customize and therefor accept some problems. Maybe comparable with MAC and PC discussions.
So feel free to tell me your opinion about your favorite IDE.

2009-07-10

Top Reasons for Glassfish V3

I have seen so many large Java projects where they used WebSphere Application Server.
Is there a link between the size of a project and the heavyweight of an application server?
The more people that are developing - the longer the server-start-time or deployment time?

Development Roundtrips beginning with cleaning up your workspace, rebuilding and redeploying your application can take more than 5 minutes, even if you just want to see some changes on the front end.

Switching between implementing with Glassfish and Websphere makes me feel like living in two different worlds. Future and Past.
However, I see that it is still difficult to convince a company or the decision makers, to use glassfish. Many times these decisions are not made for the developers sake and though for the success of a project. But if you are one who can choose the application server, consider these benefits, written down in the following blog:
I know, Glassfish V3 is not yet ready for productive use, but i also know how long it takes to make a decision :)


2009-07-05

Real World Java EE Patterns - Rethinking Best Practices

Adam Bien is a Java Champion and a well known author of a number of books and articles in the field of Java technology. In his most recent book, Real World Java EE Patterns - Rethinking Best Practices, Bien describes the development and main concepts of Java EE and introduces several best practices to create an easy and maintainable lean architecture.

The first part of the book covers the history and the Java EE core concepts. It is followed by the biggest part of the book, the patterns, which are divided into three categories: the business tier, the integration tier and infrastructural patterns and utilities. Finally Adam Bien rounds off the book by providing a discussion about pragmatic Java EE architecture, where he compares two approaches: service- and domain driven design styles.

I recommend this book to everyone who develops enterprise applications with Java. It covers the author’s real world experience with both theoretical background and technical examples. The patterns described in this book are published online at Project Kenai and discussed on Adam Bien’s blog.

In the past years J2EE has apparently often led to an unnecessary bloated architecture, consisting of a variety of layers and patterns, which were not only hard to test but also tough to maintain. This book offers the possibility to Rethink. Both experienced J2EE developers/architects and Java EE newbies with basic Java skills will benefit from this book. Due to a brief history on J2EE you get a great summary about the development of Java EE and you understand why some developers don’t talk positive about it. Particular mention deserves the first part, the brief history and the core concepts. Information about Java is virtually everywhere in the world wide web. The challenge is to bundle it and this is something that Adam masters perfectly. The patterns provide guidance for a lightweight architecture. Adam demonstrates the respective problem, the forces which led to this problem and offers different solutions with the help of code samples. I really like the fact that there is a testing example for every pattern, as testing is an inalienable part of software development.

2009-07-04

JavaEE server comparison and statistics

Hi guys,
in my last post I mentioned the great startup and deployment times of glassfish. The following article "JavaEE Containers - Heaven or Hell?" presents some charts.
The following app servers have been compared:
  • Tomcat
  • JBoss
  • Weblogic
  • IBM Websphere
  • Glassfish
  • Jetty
  • Oracle OC4J
  • Coucho Resin
Keep in mind that not every listed application server supports all the features within the JavaEE specification (e.g. EJB 3.0, JPA, etc).
In my opinion I only see JBoss, Weblogic and Websphere as comparable JavaEE products. And compared to them...glassfish made the first place :)
In order to compete with Tomcat, Glassfish V3 Prelude offers a modular, osgi based development and deployment platform. The first server start without any application will only conatin a lightweight webcontainer and takes about 3166ms. (for more details, look at this). If you want to deploy an EJB application, glassfish V3 will automatically add/load the EJB container.
You can already download and work with a V3 prelude version, but in order to use it for production, let's wait for the final release of V3.

GlassFish Clustering In Under 10 Minutes

John Clingon, the glassfish group product manager at Sun Microsystems (sooner or later Oracle, the deal is still pending) did a very nice presentation of how to
  • download glassfish (it is V2 ur2, if you are trying to do the same, i recommend downloading V2.1)
  • install glassfish
  • setup a cluster with two instances on a local macbookpro
  • deploy a sample application
  • and test the application by stopping one instance
He managed all of this in just about 10 minutes. Awesome!


I have been working with glassfish since nearly 2 years, and I can completely recommend it. No other java application server is so close to the latest technical developments. Great startup and deployment times (I will give you some data in another post) and an easy to use web based administration console. If you work with the Netbeans IDE, you will be able to do agile javaEE development at its best.
However, keep in mind that JavaEE development needs some RETHINKING. Forget about your old J2EE habits and patterns and start reading this book.

2009-06-24

Application Server Trends among Open Source Developers

Ohloh, now aquired by Sourceforge,performed a custom data analysis to determine the adoption of application servers among open source developers.
  • Of Java new project starts that target Java EE, GlassFish is the leading application server for new project starts with

    73% of all Java EE projects.

  • Of Java projects that target Java EE, GlassFish is the leading application server with just over 50% of projects targeting GlassFish

The pdf paper has some nice graphics illustrating the development of glassfish from 2004 until now.

2009-06-17

The Crisis of Credit

The amazing visualization of The Crisis of Credit makes me publish my first business related blog entry. Why not teaching IT related topics like this? Does anyone know which tool to use if you want to create something like this?

2009-06-06

Java One 2009

Unfortunately, I wasn't able to participate at the java one conference in San Francisco this year. But due to all of the bloggers and especially twitter it wasn't difficult to keep in touch.
This page shows all the real time tweets for java one.
Within the next few days and weeks i will look at the topics, which played an important role at java one, such as
Last but not least, I found a nice blog entry which explains how javaEE, spring and a OSGI Bundle, all work together with GlassFish V3.
So there's enough to read and code. Have fun!

2009-05-19

Very nice JavaEE blue sheet about the interaction between the tiers

While browsing for some articles about the JPA's EntityManager's detached and attached state, i stumbled upon a very nice blue sheet.
If you want to create a web application with JavaEE you should definitly read this article, as it shows you a way of how to work with enities on the front end layer without having DTOs.
If you talk to J2EE architectures about this topic and suggest a solution like this, you might have a tough discussion. I understand that there are several cases where it makes sense to introduce DTO's but in my opinion you should always start with the leanest solution. Every line of code you write may contain an error, even if it's just some 'mapping code' (DTO2EntitieHelper).
JavaEE has made the life of a backend developer way easier. So, if you want to get rid of all those layers in your application from one tier to another, read this article.

2009-05-16

How to integrate GlassfishV2.1 and Websphere MQV6

For my latest project I had to create a web application which integrates an existing Websphere Message Broker application.According to what is so important at developing software, i am talking about "keep it simple",  i chose to stick to the components described in the javaEE specification.
JSF for the front end development, local stateless session beans for the business logic, oracle's toplink as JPA Provider to provide access to an Oracle database. WebApp and EJBs deployed into one EAR to the application server glassfish V2.1, using my favorite IDE Netbeans 6.5.1. 
The only tricky thing was: How do i integrate this Broker Application? 
The customer decided to have a request reply message broker flow for the web application. So i created a facade for the web application to handle the messages between the web app and the broker application. This facade has the TransactionAttribute 'Not supported' and delegates to 2 stateless session beans with TransactionAttribute 'Requires New'. One bean is responsible for sending messages, the other for receiving. 

But back to topic of this post. I chose the jms ressource adapter 'generic ra', which is part of the glassfish v2.1 download. I followed installation steps described in this document. This is a amazing document. Everything is very well described and all the commands i had to execute were successfull. However there is one sentence which confused me:
If you have the MQ broker running on a different machine and need to access it remotly, please refere the WebSphere MQ documentation for configuration details.
Yes, i have MQ broker running on a different machine. So what do i have to do now? I just had to change localhost with the ip adress of the machine where mq is running to the following line
def qcf(QCF) hostname(localhost) port(1414) channel(SYSTEM.DEF.SVRCONN) transport(CLIENT) qmanager(QM1)
That's all. BUT there was one thing i had to struggle for 2 days. While trying to send messages i always received the following error message:
MQError in allocating a connection. Cause: null
With the help and awesome support of Ramesh Parthasarathy,  thank you again Ramesh, we finally found the problem. The ressource adapter is configured to look up the MQ configuration in a .binding file. I placed this file into /tmp and configured the ressource adapter like this:
java.naming.provider.url=file://tmp
This configuration did not work for me. I had to add another slash like this, and finally i got it working
java.naming.provider.url=file:///tmp
it was really tough to find out what the problem was. After I was able to send a message to MQ with a local jms client (java program) on a windows xp machine, I thought there must be something wrong with the file system configuration. I'll post the java code of this very useful client in the next blog message. Another hint: If you don't use XA transaction support, configure your connection pool with the settings
--transactionsupport . NoTransaction
If you just skip this line, you will get the following error while trying to send a message.
MQError in allocating a connection. Cause: SupportsXA is configured as false. Dont use the resource adapter in XA mode
Last but not least. Never forget to start and close the connection in your java code. Otherwise you won't be able to send or read/consume messages from a Queue, even though the connection is working :)

2009-05-15

Hello World

Hi guys,
i created this blog to share my informations as an IT-Consultant with you.
My main focus is on developing enterprise applications with JavaEE technology.
I've been doing this since 2004, especially within large projects for insurance companies or the automotive industry. 2 weeks ago  i got the great opportunity to build an application, where i was able to describe the architecture, set up the environment and enjoy agile java ee development.
I'll write more about it soon...
So...where ever you are, feel free to leave a message and have a good day!
Daniel