Thursday, 16 December 2010

iText beware!!!!

Even though it advertises itself as 'free' and 'open source'. If you use this library for commercial use you have to pay for it (and it is not cheap).

Friday, 3 December 2010

Spring MVC JSR 303 Empty Strings

/**
* Ensures empty strings come in as NULL's
*
* @param binder
*/
protected void initBinder(final WebDataBinder binder) {
binder.registerCustomEditor(String.class, new StringTrimmerEditor(true));
binder.registerCustomEditor(Date.class, new StringTrimmerEditor(true));
}

Wednesday, 24 November 2010

Monday, 1 November 2010

Trouble shooting class errors

1) You can turn on JVM switch to dump out all loaded classes

2) NoSuchMethodError? So where is that class coming from?

In your app, before the runtime exception, place this code:


getClass().getClassLoader().getResources("org/springframework/core/type/AnnotationMetadata.class");
while (urls.hasMoreElements()) {
System.out.println("******************* " + urls.nextElement());
}

Then determine class loader:

System.out.println("$$$$$$$$$$$ " + org.springframework.core.type.AnnotationMetadata.class.getClassLoader());
On a startup listener in your app (for example), type:



3) So I see the class getting loaded from a rogue jar file, but where is this jar file coming from? What is the classpath? Running jetty with -X dumps out all jar files in the classpath, and here we spot the rogue one..... It happens to come from a maven dependency....

Thursday, 19 November 2009

Weblogic 10 JSTL 1.2

taglib directive is:

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

EJB 3 JNDI Names

What is the default EJB JNDI name in JBoss?

If the application is deployed in a EAR file, the default JNDI name is the EAR-FILE-BASE-NAME/EJB-CLASS-NAME/local for the stub for local interface. For the remote interface (see below), it is EAR-FILE-BASE-NAME/EJB-CLASS-NAME/remote.


If the bean is deployed in a JAR file, the JNDI names are EJB-CLASS-NAME/local and EJB-CLASS-NAME/remote.

javaee.jar Maven 2

The Java 5 EE API jar file is available in the Java.Net repository here:

http://download.java.net/maven/1/

To use this in your pom file:

<repositories>
<repository>
<id>java.net</id>
<name>Java.Net Repository</name>
<url>http://download.java.net/maven/1//</url>
<!-- Maven 1 layout -->
<layout>legacy</layout>
</repository>
</repositories>

then:

<dependency>
<groupId>javaee</groupId>
<artifactId>javaee-api</artifactId>
<version>5</version>
<scope>provided</scope>
</dependency>

Links