Creating a sample Java EE 6 Blog Application with JPA, EJB, CDI, JSF and Primefaces on GlassFish

Java EE 6 is out and it indeed offers an interesting stack of technologies. So in today’s tutorial we are going to build a small sample web application that builds on this stack using Enterprise JavaBeans, Java Persistence API, Bean Validation, CDI and finally Java Server Faces and PrimeFaces. The application we’re going to develop is a simple blog app that allows us to create new articles, list them and – finally delete them. We’re also covering some additional topics like JSF navigation, i18n, Ajax-enabled components and the deployment on the GlassFish application server. ...

February 8, 2011 · 17 min · 3575 words · Micha Kops

Enterprise Java Bean EJB 3.1 Testing using Maven and embedded Glassfish

Are you playing around with the shiny new 3.1 EJB API? Using Maven for your Java projects? Need an easy way to write and execute tests for your EJBs that depends on an Java Application Server? No problem using Maven Archetypes, the Maven EJB Plugin and the GlassFish embedded Application Container.. Prerequisites For the following tutorial we’re going to need an installation of Maven and of course – the Java Development Kit! ...

January 1, 2011 · 5 min · 969 words · Micha Kops

Creating a REST Client Step-by-Step using JAX-RS, JAX-B and Jersey

Often in a developer’s life there is a REST service to deal with and nowadays one wants a fast and clean solution to create a client for such a service. The following tutorial shows a quick approach using JAX-RS with its reference implementation, Jersey in combination with JAX-B for annotation driven marshalling between XML or JSON structures and our Java-Beans. Prerequisites The following stuff is needed to run the following examples and code samples ...

November 25, 2010 · 8 min · 1630 words · Micha Kops

How to create a simple Messaging Application using RabbitMQ 2 and Maven

Having read an interesting comparison by Lindenlabs evaluating modern message broker systems like ActiveMQ, ApacheQpid and amongst others – RabbitMQ – I wanted to take a quick look at the last one and built a small application producing and consuming some sample messages. If you need some lecture on getting started with RabbitMQ or the key concepts of messaging I strongly recommend reading this list of introductional articles from the RabbitMQ homepage. ...

September 5, 2010 · 5 min · 990 words · Micha Kops

Spring 3, Maven and Annotation Based Configuration

There is still the urban myth that using Spring IoC container without thousands lines of XML code isn’t possible – so today we’re taking a look at annotation based configuration with Spring 3 and of course we’re using Maven.. Setup your project Create a simple Maven project using mvn archetype:generate // or mvn archetype:create Add a lot of dependencies and reference them to the Spring version defined as a property in your pom.xml. A good reference on Spring 3 and Maven artifacts can be found at Springsource.com <properties> <org.springframework.version>3.0.0.RELEASE</org.springframework.version> </properties> <dependencies> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>${org.springframework.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-expression</artifactId> <version>${org.springframework.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-beans</artifactId> <version>${org.springframework.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-aop</artifactId> <version>${org.springframework.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>${org.springframework.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context-support</artifactId> <version>${org.springframework.version}</version> </dependency> <dependency> <groupId>org.aspectj</groupId> <artifactId>com.springsource.org.aspectj.runtime</artifactId> <version>1.6.8.RELEASE</version> </dependency> </dependencies> ...

August 22, 2010 · 4 min · 795 words · Micha Kops

How to create a simple OSGi Web Application using Maven

In this tutorial we will take a look at the development of a simple OSGi Web Application and what tools can save us some time. The Maven Bundle Plugin makes our life much easier here as does the OSGi Bundle Repository that offers some nice bundles – in our case the servlet API and an embedded Jetty web server. So lets develop some bundles .. Prerequisites You are going to need a JDK (>=5), Maven2, the Apache Felix OSGi implementation and and text editor/http://eclipse.org/[IDE] of your choice. ...

July 25, 2010 · 8 min · 1505 words · Micha Kops

How to create a Template Bundle Plugin in Confluence

Since Confluence 3.2. there is a new plugin module type that allows you to deploy templates in a bundle via the plugin API. In addition it is possible to assign these templates to specific spaces and preview available templates in the Confluence administration area. So let’s build some sample templates.. Creating a Template Bundle Plugin Creating a template bundle is easy – just create a class implementing TemplatePackage – there are two methods: one returns a list of bundled PageTemplate Objects the other the name for the template bundle. ...

July 12, 2010 · 4 min · 675 words · Micha Kops

A look at Google’s Protocol Buffers

Protocol Buffers are a serialization format developed by Google- you might ask if another IDL is really needed here – is Google barking at the wrong tree? But protocol buffers offer some advantages over data serialization via XML or JSON – Google says they (compared to XML).. are 3 to 10 times smaller are 20 to 100 times faster provide generated data access classes for programmatic use provide backward compatibility ...

July 6, 2010 · 5 min · 1022 words · Micha Kops

Java Server Faces/JSF 2 Tutorial – Step 1: Project setup, Maven and the first Facelet

In this short tutorial we are going to build a Java Server Faces Web-Application using JSF2.0, Facelets, Maven and Hibernate as ORM Mapper. The goals for this first step are: Setting up the project structure using Maven, defining a frame template/decorator and a registration facelet, creating a managed bean and mapping it’s values to the facelet, adding some basic validation, displaying validation errors and finally adding a navigation structure. In step2 of this tutorial we are going to add persistence using Hibernate, add some security, create a custom UI component and add some AJAX. ...

June 5, 2010 · 9 min · 1841 words · Micha Kops

Dependency management in Grails 1.2

Sometimes I get the impression that there are many Maven haters in the Groovy/Grails community – now with version 1.2 of the Grails framework they are able to abandon the evil satanic Grails Maven Plugin and embrace the neverending joys of a slim, nice, sexy dependency resolution dsl .. here we go .. lets define some dependencies wheee … Our dependency configuration is defined in grails-app/config/BuildConfig.groovy as a property named grails.project.dependency.resolution: grails.project.dependency.resolution = { // here will be some dependencies } ...

May 23, 2010 · 2 min · 336 words · Micha Kops