Absent Code attribute

By executing the Unit Tests with TestNG for this Maven2 Archetype here:

https://robert-reiz.com/2012/02/18/archetype-richfaces-4-1-0-final-spring-3-1-0-release-hibernate-3-3-0/

I got this Exception:

Absent Code attribute in method that is not native or abstract in class file javax/faces/lifecycle/Lifecycle

This project is annotation driven. The JSF Managed Beans are annotated with Spring Annotations:

@Component
@Scope("request")

in the applicationContext.xml I have this lines here to read the annotations:

<context:annotation-config/>
<context:component-scan base-package="com.versioneye" />

I created a second applicationContext.xml for the test environment and modified the annotation-config. In the test environment I am scanning now just the peristence package. Because there are anyway no Unit Tests for the JSF Managed Beans.

<context:annotation-config/>
<context:component-scan base-package="com.versioneye.persistence"/>

Since I am not scanning the Managed Beans in the test environment I didn’t get the Exception above.

Archetype: RichFaces 4.1.0.Final + Spring 3.1.0.RELEASE + Hibernate 3.3.0

This maven2 archetype contains a little sample web application with this Frameworks:

  • Spring 3.1.0.RELEASE Framework
  • Servlet-API 2.5
  • JSF 2.0 (mojarra 2.1.2)
  • RichFaces 4.1.0.Final
  • ploinFaces 1.6
  • ploinMailFactory 1.3.1
  • Hibernate 3.3.0
  • TestNG 5.8
  • Log4J 1.2.15
  • HSQLDB 1.8.0.7

The configuration is annotation-driven. It is deployed on the PLOIN Repository-Server

http://www.ploin-m2.de/nexus/content/groups/public/

you can create a project from the archetype with the following command:

mvn archetype:generate -DarchetypeGroupId=org.ploin.archetype -DarchetypeArtifactId=demoSpringRichHibernate-archetype -DarchetypeVersion=1.2 -DarchetypeRepository=http://www.ploin-m2.de/nexus/content/groups/public/ -DgroupId=com.versioneye -DartifactId=myNewWebApp

The created project is a very simple web-application with a login mask and 2 xhtml-sites. I have tested the app on a tomcat 6.0.35 and Java 1.6 on Mac OS X Lion.

On the second page there is a small demonstration of the JSF 2.0 AJAX feature. Every time you type something in into the first input field, there is a whole server roundtrip. The ManagedBean gets updated immediately.

On the same page there is a small demo for the RichFaces calendar.

After the creation the app is running with the HypersoniceSQL DBMS. But it is very easy to switch to MySQL or Oracle. I put the drivers for MySQL and Oracle as a comment in the pom.xml. So you just need to comment in the right lines in the pom.xml.

Unable to locate Spring NamespaceHandler for XML schema namespace

I am working on a backend Maven3 project. I am building an uber JAR which contains several other JAR files and resources. That worked pretty good. But than I tried to run the JAR file with

java -jar <uber-super-duper-jar-file>

I got this Exception:

INFO  org.springframework.beans.factory.xml.XmlBeanDefinitionReader  - Loading XML bean definitions from class path resource [applicationContext.xml]
Exception in thread "main" org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/context]

This is because I have several Spring Jar in my dependencies. Some of the spring jars contain meta info files with the same name. To avoid that some meta files are overridden you have to merge it. If you are using the maven shade plugin to build your JAR file you can do the merge with this xml snippet:

<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
  <resource>META-INF/spring.handlers</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
  <resource>META-INF/spring.schemas</resource>
</transformer>

Here is a more detailed description:

http://maven.apache.org/plugins/maven-shade-plugin/examples/resource-transformers.html

JRuby + Spring + AspectJ + Neo4J

I am playing around with JRuby and Neo4j as Graph Engine. My set up on the backend side contains a Java Application with Spring Annotations, AspectJ and Neo4J. In the frontend I have a Rails App with JRuby.

Any time I try to access a class that have an annotation like “@NodeEntity”, I get an Exception. It seems that Spring and AspectJ is to much in this chain. I should get rid of Spring and AspectJ.

Archetype: RichFaces 4.0.0.M1 + Spring 3.0.5.RELEASE + Hibernate 3.3.0

This maven2 archetype contains a little sample web application with this Frameworks:

  • Spring 3.0.5.RELEASE Framework
  • Servlet-API 2.5
  • JSF 2.0 (mojarra 2.1.2)
  • RichFaces 4.0.0.M1
  • ploinFaces 1.6
  • ploinMailFactory 1.3.1
  • Hibernate 3.3.0
  • TestNG 5.8
  • Log4J 1.2.15
  • HSQLDB 1.8.0.7

The configuration is annotation-driven. It is deployed on the PLOIN Repository-Serve

http://www.ploin-m2.de/nexus/content/groups/public/

you can create a project from the archetype with the following command:

mvn archetype:generate -DarchetypeGroupId=org.ploin.archetype -DarchetypeArtifactId=tempSpringRichHibernate -DarchetypeVersion=1.7.2 -DarchetypeRepository=http://www.ploin-m2.de/nexus/content/groups/public/ -DgroupId=org.ploin -DartifactId=demoSpringRichHibernate

The created project is a very simple web-application with a login mask and 2 xhtml-sites. I have tested the app on a tomcat 6.0.20 and Java 1.6 on Mac OS X Snow Leopard.

rich-faces-login
rich-faces-login

You can login with the username “admin” and the password “admin”.

After the creation the app is running with the HypersoniceSQL DBMS. But it is very easy to switch to MySQL or Oracle. I put the drivers for MySQL and Oracle as a comment in the pom.xml. So you just need to comment in the right lines in the pom.xml.

Archetype: SpringMVC + Spring 3.0.5.RELEASE + JPA 1.0

This maven2 archetype contains a little sample application with the Spring 3.0.5 Framework, Spring Mvc and JPA 1.0. It is deployed on the PLOIN Repository-Server on

http://www.ploin-m2.de/nexus/content/groups/public/

you can create a project from the archetype with the following command:

mvn archetype:generate -DarchetypeGroupId=org.ploin.archetype -DarchetypeArtifactId=tempSpringMvcJpa -DarchetypeVersion=1.1 -DarchetypeRepository=http://www.ploin-m2.de/nexus/content/groups/public/ -DgroupId=org.ploin -DartifactId=demoSpringMvcJpa

This archetype shows how the REST is working in Spring 3 and how you can use it together with JPA 1.0.

JasperReports 3.5.3 + Spring 3.0.0.RELEASE

This maven2 archetype contains a little sample application with the new Spring 3.0.0.RELEASE Framework and JasperReports 3.5.3. The configuration is xml-driven. It is deployed on the PLOIN Repository-Server on

http://www.ploin-m2.de/nexus/content/groups/public/

you can create a project from the archetype with the following command:

mvn archetype:generate  -DarchetypeGroupId=org.ploin.archetype  -DarchetypeArtifactId=tempSpringJasperReports -DarchetypeVersion=1.0  -DarchetypeRepository=http://www.ploin-m2.de/nexus/content/groups/public/  -DgroupId=org.ploin -DartifactId=demoSpringJasperReport

The created project is a web-application with a simple servlet-filter. On the start site you can choose to create a pdf ord excel file.