Category: Java EE

  • JAX-WS Custom Exception with FaultBean in TomEE and WebSphere Application Server

    In our last post we were able to deploy a simple JAX-WS service on both TomEE and WebSphere Application Server. JAX-WS Specification suggests that three thing should be followed for us to implement Custom Exception as SOAP Fault. WrapperException(String message, FaultBean faultInfo) A constructor where WrapperException is replaced with the name of the generated wrapper…

  • Java EE 6 Servlet – TomEE – Caused by: java.lang.IllegalArgumentException: Invalid in servlet mapping

    How bad a plain vanilla servlet can go with annotations??? Let’s see what happens if we miss a simple “/”. So I configured a simple Servlet in eclipse, see the code below [sourcecode language=”java”] package com.mumz.test.javaee.servlet; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Servlet implementation class MySecondServlet. */…

  • Spring Data JPA

    Spring Data JPA provides a more cleaner approach of using JPA for DAO layer. It removes boilerplate code and developers can concentrate on actual logic. Our DataModel First create a maven project and add below dependencies: [sourcecode language=”xml”] <project xmlns="http://maven.apache.org/POM/4.0.0&quot; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt; <modelVersion>4.0.0</modelVersion> <groupId>com.mumz.test.springdata.jpa</groupId> <artifactId>SpringDataJPA</artifactId> <version>0.0.1-SNAPSHOT</version> <properties> <spring.version>3.2.4.RELEASE</spring.version> <spring.data.version>1.3.4.RELEASE</spring.data.version> <hibernate.version>4.2.5.FINAL</hibernate.version> <jpa.version>1.0.1.FINAL</jpa.version> <querydsl.version>3.2.3</querydsl.version> <junit.version>4.8.2</junit.version> </properties>…

  • Integrating Primefaces and Spring Security

    Following all previous steps we always configured JSF and Spring. In case we use third party library like Primefaces you will have to configure resources required by Primefaces manually in Spring Security xml. Extending example at if we had Primefaces lib in our project we will have to add below configuration to jsfspring-sec-security-config.xml [sourcecode language=”xml”]…

  • Audit Framework with Spring AOP and JPA

    Every now and then we come across a common requirement of building an Audit framework. In simple words it means whenever a record is added, edited or removed there should be an entry made in a separate table so that different actions of users can be monitored. Today in this tutorial we will build an…

  • Secure your business layer with JSR-250 and Spring Security in a JSF application

    In the previouspost we looked at the different option that we have as part of Java EE and Spring security framework. In this tutorial we will see how we can leverage JSR-250 security annotation. To being with you need the source code from previous post. With some code behind us, let’s see how JSR-250 can…

  • Business Layer Security with Java EE and Spring

    If you have read previous tutorial about Spring Security and JSF you would have noticed that all this time we have been speaking about securing our web layer. What about business layer ? In this post we will go through few ways of securing our business layer, and then in subsequent post we will see…