11 Dezember 2014

Which parts of Java EE belong to the application server?

Yesterday I was at the Developer Day of Swiss Railways.

Florian Seidl talked about future enterprise software architecture where he doubt that the application still plays a central role in Java EE.

A lot of people argue that it is a pain to relay on a out dated full blown Java EE application server and therefore use a Spring/Tomcat stack or simply use Spring on top of the application server.

It seems that there is a problem in how Java EE is defined. In my opinion it would make sense to divide all the Java EE specs in two parts.

One part should contain all the specs that are directly related to the application server and on the other side there should be the specs where the application code is built on top.

App server related topics are web containter, threading, JTA, JCA, JAAS, JMS etc.
Application related are i.e. JPA, CDI, EJB, JSF.

The idea behind the separation is that one could update the application related implementations without changing the application server version.

For example I don't see any reason for not using JPA 2.1 in a Java EE 5 application server.

Sure these lists are just a first guess and incomplete but I would be interested what you think.

06 Dezember 2014

Contract First Web Service with NetBeans

From time to time I have to implement some SOAP based web services. Usually these web services are used for application integration so the contract first approach is used where one creates the WSDL  document first.

To create the server stub from the WSDL document I found out that using Maven in combination with NetBeans is the most straight forward approach.

Just choose "New File" from the menu:

After clicking on Next you need to enter the name of the service to create and provide the WSDL document:

Now just hit finish and have a look at what the wizard has generated.

First the web service server stub:

package ch.simas.demo.ws;

import javax.ejb.Stateless;
import javax.jws.WebService;

@WebService(serviceName = "CalculatorService", portName = "ICalculator", endpointInterface = "org.example.ICalculator", targetNamespace = "http://Example.org", wsdlLocation = "META-INF/wsdl/calculator.wsdl")
public class CalculatorService {

    public java.lang.Integer add(java.lang.Integer a, java.lang.Integer b) {
        //TODO implement this method
        throw new UnsupportedOperationException("Not implemented yet.");

    public java.lang.Integer subtract(java.lang.Integer a, java.lang.Integer b) {
        //TODO implement this method
        throw new UnsupportedOperationException("Not implemented yet.");

That's not very impressive but let's have a look at the pom.xml

  <configuration>                          <sourceDestDir>${project.build.directory}/generated-sources/jaxws-wsimport</sourceDestDir>

As you can see all the necessary configuration for the jaxws-maven-plugin is done!

In my opinion NetBeans has far the best integration of Maven and you don't have to configure both your IDE and Maven because NetBeans relays on the configuration in the pom.xml.