Maven hbm2ddl: fixing java.lang.ArrayStoreException: sun.reflect.annotation.EnumConstantNotPresentExceptionProxy

Creating a DDL in the Maven build with the hibernate3-maven-plugin fails if you explicitly configure an array of javax.persistence.CascadeType values in your JPA annotations. The stacktrace is similar to

Once I realized what the actual cause is, the fix was simple. Turns out that the CascadeType is not in the classpath when Maven runs […]

OpenID with Spring Security 3 and Google OpenID

So much information on Spring OpenID is outdated so quickly…Lots of articles and blog entries describe solutions with Spring Security 2.x which is slightly different from 3.x. I recommend sticking with the sample application at http://repo1.maven.org/maven2/org/springframework/security/spring-security-samples-openid/<your_version>/spring-security-samples-openid-<your_version>.war as a reference. Also, I found http://www.packtpub.com/article/opening-up-to-openid-with-spring-security quite helpful. One caveat though is worth mentioning here: the Spring sample […]

Using a custom SSLSocketFactory with Apache CXF

Java allows to use a custom VM-wide SSLSocketFactory implementation like so: HttpsURLConnection.setDefaultSSLSocketFactory(SSLSocketFactory). Thus, you can either implement your own SSLSocketFactory or you can configure a regular instance according to your needs/environment. You have to understand that there are probably very few use cases where this method actually really helps. Setting a static default SSLSocketFactory influences […]

Self signed certificates in Apache HttpClient

When you need to support self-signed SSL certificates in your Apache HttpClient based application you can use the contributed EasySSLProtocolSocketFactory as described in the HttpClient docs. Instead of using HttpClient’s HostConfiguration object directly you’d modify its protocol socket factory in your code like so:

Somewhere you’d instantiate a HttpClient object. Then you get its […]