Convert Image to byte array in Java

If you don’t want to make use of IOUtils from Apache Commons Lang, you should you know, the code in the finally block would be something like

UnknownHostException with ‘%’ in IPv6 address

dnsjava to resolve whatever address request.getRemoteAddr() would return. This worked very well in most cases. However, in some cases I would see something like: [quote]java.net.UnknownHostException: Invalid address: fe80::1d9:b65a:ed86:7940%11[/quote] Not being much of a networking expert I was puzzled about the ‘%11’. Once again superuser.com came to rescue: http://superuser.com/questions/99746/why-is-there-a-in-the-ipv6-address

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 […]