Yeoman behind a (corporate) proxy

After playing around with AngularJS and Yeoman at home I decided to try it out at work. To clarify @Home I use a Mac with OSX and use Homebrew to install additional packages. @Work I have a virtual workstation running Windows 7 installed. Trying out that setup on that configuration was, somewhat, of a challenge. Steps

  1. Install NodeJS
  2. Configure proxy for NPM and Bower
  3. (Optional) Configure NPM to store modules and cache on local drive instead of network
  4. Install Yeoman
  5. Configure GIT
  6. Add NPM Modules directory to PATH
  7. Test your installation

Lees verder Yeoman behind a (corporate) proxy

Hibernate Search by Example

In short Hibernate Search by Example is a great how-to guide if you quickly want to get started with Hibernate Search.

Hibernate Search by Example is a thorough how-to guide to Hibernate Search. It shows and explains by clear examples how to setup and use Hibernate Search.

The book is clearly written and a pleasant read. It is not a long read but it still covers the basic and advanced features of Hibernate Search. It is not a full fledged reference guide but it gives you more than enough information to integrate Hibernate Search into your application(s).

The sample application which accompanies the book has an implementation using plain Hibernate as well as JPA. The plain hibernate sample comes with an annotation as well as an XML version. Basically there is a sample for each technology, which is a great plus for the book.

At last the book also shows some of the more advanced features of Hibernate Search and again shows more than enough code and information on how to implement and use these features.

Pro Spring MVC: with Web Flow – Sample Application Fails To Start

Update (1-8-2012): Please download the most recent version of the sources from either the GitHub repository or from the Apress website. This version fixes the problem with the project dependencies.

You arrived at this page because of 2 reasons. First you bought Pro Spring MVC: with Web Flow for which I would like to thank you and I really hope it is a valuable addition to your book shelve. Secondly you are trying to run the sample application which ships with the book but the application fails to start/deploy (and sometimes also has some compilation errors), for this we are really sorry and we apologize for the inconvenience that has given you. We also read books and we know that there is nothing so frustrating as a book with source code and the sources don’t compile or the sample doesn’t work.

STS Startup Error

The Problem

For some reason the Gradle tooling we choose sometimes fails to correctly resolve and reference projects in the same workspace, this is either due to some error in our build file (despite all the testing we did) or it is an error/undocumented feature of the Gradle Tooling. However as a reader it doesn’t really help you. (See GRADLE-2409).

When one now deploys the application you get a nice stack trace as shown on the left (click for larger image). This is, believe us, not the experience we wanted you to have. Following are a couple of workarounds which can help you get it to work, meanwhile we will also try to fix the build script so that the tooling resolves correctly. You can always get the most recent sources from our GitHub repository this you can always fork or download as a ZIP file.

Lees verder Pro Spring MVC: with Web Flow – Sample Application Fails To Start

Spring Security 3

Spring Security 3 is a pretty decent book if you want to get started with Spring Security or want to know more of the internals or exotic features it has to offer.

The book starts with a brief explanation of the different parts of secutiry and after that explains how these are implemented/used in Spring Security. During the different chapters in the book they explain the different features of Spring Security with the use of a consistent sample (application) and security review. During the samples the issues of the security review are being solved, it is also explained why you should solve them and why they are a risk.

The sample application is being secured in a couple of chapters, each of the chapters explains a part of Spring Security. It starts simple and progresses to the more exotic features of the framework, however it doesn’t stop there. There is also a lot of explaining going on what is happening internally in the framework, which classes are used and why. In short you basically get an in depth explanation of the Spring Security namespace.

Another great thing about the book is that it covers, in quite some detail, some of the less well documented features of Spring Security. Spring Security has the notion of groups, which is pretty much unmentioned in the reference guide, this book explains it in quite a clear and concise way. Another feature explained quite well is the use of ACL, often asked in the forums and still undocumented in the reference guide. So this book also fills in those gaps. Next to those features it also explains how to use OpenID, SSO, Client Certificates and how to configure them (again in quite some detail).

So in short if you want to know how Spring Security 3 works internally, what the namespace actually does, how those undocumented features work, this book is a must read. I would say this book is a must read for all the Spring Security users out there.

Spring Persistence with Hibernate

This book sets out to explain the usage of hibernate with the spring framework. This is basically done in the first chapters. It explains how to configure hibernate from within a spring ApplicationContext and it explains how to write a dao. To bad that, for the dao, they still use the old technique with HibernateTemplate/HibernateDaoSupport which isn’t recommended anymore since the release of spring 2.0, it is still in the framework for backwards compatibility. The book would have been better if they would explain this.

The remainder of the book is more or less an introduction to hibernate and explains how to write and execute HQL based queries, use the (Detached)Criteria API. Next to that it tries to explain spring, dependency injection and Spring MVC. In short everything is touched upon, but all just to little.

If you need a kickstart into configuring hibernate and spring and don’t have an hibernate knowledge this book could be starting guide. If you already have some knowledge on how to do those things, I would suggest JPA persistency with Hibernate (although a bit dated) and the spring reference guide. For the other parts there are some great books out there.

Migrate classic J2EE to Spring (Step 1) (revised)

A couple of months ago I wrote a step 1 on migrating a classis J(2)EE application to a spring based application. Recently I had some time again on my hands and after studying the application and also after some discussions I had I decided to structure the project a little different.

“External” applications

The Adventure Builder applications uses 4 other applications to deliver its services. However in a normal real situation those 4 applications are outside of our control. We cannot change them nor redeploy them. So I decided to just include the ear files for those 4 projects instead of rebuilding them each time.

Generated stubs/skeletons

The application makes use of generated java and xml files. Also in a real situation you should generate those once and after that reuse. You should only (re)generate those files if the external interface changes (best would be to not generate at all). I decided to use the generated java files and xml files and include them in the project. They can be found in the src/generated directory.


Deployment is now maven based, maven can start and create a glassfish domain for you. It will create all jms/jdbc/mail resources and deploy the 4 external applications. After that setup you can choose to start glassfish with the normal startServ command or reuse maven to start it. Simply run the setup.bat/ file from the setup directory. To deploy our own 2 applications simply go to the apps directory and type mvn glassfish:deploy.


The initial project as is has some test classes available so that we can make sure that the application still behaves as it should behave after we are going to change it to use Spring and Hibernate.

Hopefully Step 2 will follow shortly and that we can have a look at the different steps and easier code.

Spring Web Flow 2 Web Development

A few weeks ago I was contacted by packt publishing to review one of their books. They asked me if I wanted to review Spring Web Flow 2 Web Development (sample chapter).

In short the book consists of 254 pages in all those pages they try to explain Spring Web Flow, Maven, Ant+Ivy, Spring Security and some basics (and also not all basics) about the Spring Framework it self. Ofcourse not to mention all the normal stuff like title pages and indexes. All the explaining of the added frameworks takes away from the actual goal and that is to cover and explain Spring Web Flow. I also found that there is no real layering/build up in the book, they directly start with FlowExecutionListeners even before they covered the basics. Another draw back is the samples used, they don’t really use one sample (application) but different snippets which make it harded for a new Spring Web Flow user to get an overall feel. So the short verdict I wouldn’t say the book is bad but it could be a lot better, most of the information to be found in the book but it can be quite a search at times. If you are a Spring Web Flow beginner I would try to find other books covering the basics of Spring Web Flow.
Lees verder Spring Web Flow 2 Web Development

Migrate classic J2EE to Spring (Step 1)

A few months ago SpringSource released a white paper describing the migration from J2EE to a Spring framework based application. Even before they wrote that white paper I already had the idea of writing something about how to migrate from J2EE to a Spring based application. However Colin Sampaleanu (at al.) beat me to writing the white paper :).

However I also had the idea of providing some practical information like a sample. The white paper gives some thought on what to do and where but it doesn’t give a clear sample. So I started writing a possible migration path (multi step sample) from a J2EE application to a Spring based application.
Lees verder Migrate classic J2EE to Spring (Step 1)