Skip to content

Tag Archives: Java

Create ant task for Hibernate tools

Introduction In this blog we’ll be looking at how to use hibernate tools with just ant. This may be useful if you need to plug some hibernate tasks into your build system or have them scripted in any way. We will create a stand-alone ant build file with the minimum number of required libraries. Libraries [...]

Remember me in Spring Security 3

Introduction Remember me functionality is a mechanism that lets users log in automatically, even when they re-start their browser. In other words: after their session cookie is deleted by the browser (which is normally after closing the browser). This is implemented by setting up another cookie that will live in the browser’s database for a [...]

Remote debugging of web application deployed on Tomcat server or using Jetty Maven plugin with Eclipse

Sometimes it might be very convenient to be able to debug application deployed on web server. This tutorial presents how to do it, if the application is deployed using Jetty plugin for Maven or Tomcat servers. Jetty Maven plugin Set the following MAVEN_OPTS to the following: export MAVEN_OPTS=’-Xdebug -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=y’ Run Jetty Maven plugin: mvn jetty:run [...]

Spring Security 3 – basic integration and access decision manager

Introduction In the tutorial below we will look at a basic integration of a Java web application with Spring Security 3. In this particular scenario we’ll be integrating Spring Security with existing web application that uses Struts & Spring. However, similar steps can be applied to any other web framework you may be using. We [...]

Development environment setup for Eclipse, Maven, Spring 3, Struts 2, Hibernate and Jetty

Introduction When developing web application set up of convenient development environment might be crucial for more efficient work. Let’s consider web application that uses following frameworks: Maven Spring Struts2 Hibernate In addition we want to use Eclipse as our editor. This tutorial presents initial setting of Eclipse project to support all the frameworks mentioned above [...]

Using Apache log4j to log Apache CXF web service messages

Apache log4j is one of the most popular frameworks used for logging events within Java code. Apache CXF on the other hand is one of the most popular framework to support communication using web services. To monitor and debug Java application there might be a need to log inbound and outbound web service messages. If [...]

Spring, Hibernate, Maven, and Struts2 integration tutorial – part 5 – Hibernate update

This is part 5 of the Java Technologies Integration tutorial. The purpose of this part is to provide updates to Hibernate configuration in existing project to make the maintenance of the project more straight forward. Hibernate configuration files The description of Hibernate configuration was described here: Java Technologies Integration tutorial – part 2 – Hibernate [...]

Spring 3 transactions with Hibernate and AOP, without HibernateTemplate

In the tutorial below I will focus on transactions management with Spring 3. For the sake of simplicity, we will create a standalone Java application – but the same logic can be used in J2EE application. We will create: Entity objects (simple POJO) – the basic entities mapped to the relational database (via annotations). DAO [...]

Simple AOP tutorial with Spring 3

Simple Spring In this tutorial we will create, from the very beginning, a simple application that uses Spring and its Aspect Oriented Programming capabilities. We will use schema-based approach from Spring 2.0 to define the AOP configuration. I am not going to cover here the AOP or Spring basis, if you are interested what AOP [...]

Spring, Hibernate, Maven, and Struts2 integration tutorial – part 4

This is part 4 of the Java Technologies Integration tutorial Execution The final part of your development is to execute our project and see fruits of our hard work. To run our project we have to build war file/directory and deploy it on Tomcat server. War file/directory Building war file/directory is always the same. In [...]