Spring Tutorial problem
louberl May 31, 2007 4:52 AMTo give this problem better visibility I have also posted this problem in the beginners corner forum.
While going through the Jboss Seam examples as a tutorial/learning exercise, I encountered a problem with only the Seam-Spring tutorial example.
The Seam-Spring example generates a java.lang.NullPointerException error.
2007-05-29 16:56:43,534 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/seam -spring]] Exception sending context initialized event to listener instance of class org.jboss.seam.servlet.SeamListener org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML doc ument from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.lang.NullPointerException Caused by: java.lang.NullPointerException at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.decorateIfRequired(BeanDefinitionParserDelegate.java:1142)
Based on what I have read in the Jboss forums, I think I have a ClassLoader problem. But I do not know why? (as this is a stock tutorial example)
The following software versions are installed on my computer.
Jboss AS=4.0.5-r2
Spring =2.0.3
Jboss Seam=1.2.1 GA
While disecting the problem, I reduced the Spring configuration file applicationContext.xml to the bare minimum while preserving the same generated error. (All other files in the tutorial are untouched)
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:util="http://www.springframework.org/schema/util" xmlns:seam="http://jboss.com/products/seam/spring-seam" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans -2.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd http://jboss.com/products/seam/spring-seam http://jboss.com/products/seam/spring-seam-1.2.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd" default-lazy-init="true"> <bean id="userService" class="org.jboss.seam.example.spring.UserService"> <property name="entityManager" ref="em"/> <seam:component /> </bean> <seam:instance name="entityManager" id="em" proxy="true"/> </beans>
What can I do to make Spring register, the userService bean as a component with Seam/SeamListener ?
Any ideas anyone?
Thanks in advance