[jboss-user] [Beginners Corner] - Jboss Seam Spring tutorial example problem

louberl do-not-reply at jboss.com
Tue May 29 11:51:27 EDT 2007


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,461 DEBUG [org.springframework.beans.factory.xml.DefaultDocumentLoader] Using JAXP provider [org.apache.xerces.jaxp.DocumentBuilderFactoryImpl]
  | 2007-05-29 16:56:43,462 DEBUG [org.jboss.mx.loading.RepositoryClassLoader] setRepository, repository=org.jboss.mx.loading.HeirarchicalLoaderRepository3 at 1a328aa, cl=org.jboss.mx.loading.HeirarchicalLoaderRepository3$CacheClassLoader at 14093f{ url=null ,addedOrder=0}
  | 2007-05-29 16:56:43,464 DEBUG [org.springframework.beans.factory.xml.PluggableSchemaResolver] Found XML schema [http://www.springframework.org/schema/beans/spring-beans-2.0.xsd] in classpath: org/springframework/beans/factory/xml/spring-beans-2.0.xsd
  | 2007-05-29 16:56:43,473 DEBUG [org.springframework.beans.factory.xml.PluggableSchemaResolver] Found XML schema [http://www.springframework.org/schema/tool/spring-tool-2.0.xsd] in classpath: org/springframework/beans/factory/xml/spring-tool-2.0.xsd
  | 2007-05-29 16:56:43,477 DEBUG [org.jboss.mx.loading.RepositoryClassLoader] setRepository, repository=org.jboss.mx.loading.HeirarchicalLoaderRepository3 at 1a328aa, cl=org.jboss.mx.loading.HeirarchicalLoaderRepository3$CacheClassLoader at 908fa9{ url=null ,addedOrder=0}
  | 2007-05-29 16:56:43,483 DEBUG [org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver] Loaded mappings [{http://www.springframework.org/schema/p=org.springframework.beans.factory.xml.SimplePropertyNamespaceHandler, http://www.springframework.org/schema/lang=org.springframework.scripting.config.LangNamespaceHandler, http://www.springframework.org/schema/jee=org.springframework.ejb.config.JeeNamespaceHandler, http://www.springframework.org/schema/aop=org.springframework.aop.config.AopNamespaceHandler, http://www.springframework.org/schema/util=org.springframework.beans.factory.xml.UtilNamespaceHandler, http://www.springframework.org/schema/tx=org.springframework.transaction.config.TxNamespaceHandler}]
  | 2007-05-29 16:56:43,492 DEBUG [org.jboss.mx.loading.RepositoryClassLoader] setRepository, repository=org.jboss.mx.loading.HeirarchicalLoaderRepository3 at 1a328aa, cl=org.jboss.mx.loading.HeirarchicalLoaderRepository3$CacheClassLoader at 8270d7{ url=null ,addedOrder=0}
  | 2007-05-29 16:56:43,501 DEBUG [org.jboss.mx.loading.RepositoryClassLoader] setRepository, repository=org.jboss.mx.loading.HeirarchicalLoaderRepository3 at 1a328aa, cl=org.jboss.mx.loading.HeirarchicalLoaderRepository3$CacheClassLoader at 1be5978{ url=null ,addedOrder=0}
  | 2007-05-29 16:56:43,503 DEBUG [org.jboss.mx.loading.RepositoryClassLoader] setRepository, repository=org.jboss.mx.loading.HeirarchicalLoaderRepository3 at 1a328aa, cl=org.jboss.mx.loading.HeirarchicalLoaderRepository3$CacheClassLoader at 1e3f2e5{ url=null ,addedOrder=0}
  | 2007-05-29 16:56:43,512 DEBUG [org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader] Loading bean definitions
  | 2007-05-29 16:56:43,512 DEBUG [org.jboss.mx.loading.RepositoryClassLoader] setRepository, repository=org.jboss.mx.loading.HeirarchicalLoaderRepository3 at 1a328aa, cl=org.jboss.mx.loading.HeirarchicalLoaderRepository3$CacheClassLoader at 5fd9fb{ url=null ,addedOrder=0}
  | 2007-05-29 16:56:43,523 DEBUG [org.jboss.mx.loading.RepositoryClassLoader] setRepository, repository=org.jboss.mx.loading.HeirarchicalLoaderRepository3 at 1a328aa, cl=org.jboss.mx.loading.HeirarchicalLoaderRepository3$CacheClassLoader at e015ef{ url=null ,addedOrder=0}
  | 2007-05-29 16:56:43,523 DEBUG [org.jboss.mx.loading.RepositoryClassLoader] setRepository, repository=org.jboss.mx.loading.HeirarchicalLoaderRepository3 at 1a328aa, cl=org.jboss.mx.loading.HeirarchicalLoaderRepository3$CacheClassLoader at 1c03ae1{ url=null ,addedOrder=0}
  | 2007-05-29 16:56:43,533 DEBUG [org.jboss.mx.loading.RepositoryClassLoader] setRepository, repository=org.jboss.mx.loading.HeirarchicalLoaderRepository3 at 1a328aa, cl=org.jboss.mx.loading.HeirarchicalLoaderRepository3$CacheClassLoader at 159c41f{ url=null ,addedOrder=0}
  | 2007-05-29 16:56:43,534 DEBUG [org.jboss.mx.loading.RepositoryClassLoader] setRepository, repository=org.jboss.mx.loading.HeirarchicalLoaderRepository3 at 1a328aa, cl=org.jboss.mx.loading.HeirarchicalLoaderRepository3$CacheClassLoader at 5ad0f0{ url=null ,addedOrder=0}
  | 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 document 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)
  | 	at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.decorateBeanDefinitionIfRequired(BeanDefinitionParserDelegate.java:1132)
  | 	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.processBeanDefinition(DefaultBeanDefinitionDocumentReader.java:237)
  | 	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseDefaultElement(DefaultBeanDefinitionDocumentReader.java:151)
  | 	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:130)
  | 	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:90)
  | 	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:458)
  | 	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:353)
  | 	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:303)
  | 	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:280)
  | 	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:131)
  | 	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:147)
  | 	at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124)
  | 	at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:92)
  | 	at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:100)
  | 	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:298)
  | 	at org.jboss.seam.ioc.spring.ContextLoader.startupContextLoader(ContextLoader.java:59)
  | 	at org.jboss.seam.ioc.spring.ContextLoader.create(ContextLoader.java:43)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  | 	at java.lang.reflect.Method.invoke(Method.java:597)
  | 	at org.jboss.seam.util.Reflections.invoke(Reflections.java:20)
  | 	at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:123)
  | 	at org.jboss.seam.Component.callComponentMethod(Component.java:1834)
  | 	at org.jboss.seam.Component.callCreateMethod(Component.java:1757)
  | 	at org.jboss.seam.Component.newInstance(Component.java:1746)
  | 	at org.jboss.seam.contexts.Lifecycle.startup(Lifecycle.java:175)
  | 	at org.jboss.seam.contexts.Lifecycle.endInitialization(Lifecycle.java:145)
  | 	at org.jboss.seam.init.Initialization.init(Initialization.java:504)
  | 	at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:33)
  | 	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3763)
  | 	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4211)
  | 	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
  | 	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
  | 	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  | 	at java.lang.reflect.Method.invoke(Method.java:597)
  | 	at org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503)
  | 	at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
  | 	at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
  | 	at org.apache.catalina.core.StandardContext.init(StandardContext.java:5052)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  | 	at java.lang.reflect.Method.invoke(Method.java:597)
  | 	at org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503)
  | 	at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
  | 	at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
  | 	at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeployInternal(TomcatDeployer.java:297)
  | 	at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeploy(TomcatDeployer.java:103)
  | 	at org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:371)
  | 	at org.jboss.web.WebModule.startModule(WebModule.java:83)
  | 	at org.jboss.web.WebModule.startService(WebModule.java:61)
  | 	at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
  | 	at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
  | 	at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  | 	at java.lang.reflect.Method.invoke(Method.java:597)
  | 	at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
  | 	at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
  | 	at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
  | 	at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
  | 	at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
  | 	at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
  | 	at $Proxy0.start(Unknown Source)
  | 	at org.jboss.system.ServiceController.start(ServiceController.java:417)
  | 	at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  | 	at java.lang.reflect.Method.invoke(Method.java:597)
  | 	at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
  | 	at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
  | 	at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
  | 	at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
  | 	at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
  | 	at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
  | 	at $Proxy42.start(Unknown Source)
  | 	at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:466)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  | 	at java.lang.reflect.Method.invoke(Method.java:597)
  | 	at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
  | 	at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
  | 	at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
  | 	at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
  | 	at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
  | 	at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
  | 	at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
  | 	at org.jboss.ws.integration.jboss.DeployerInterceptor.start(DeployerInterceptor.java:92)
  | 	at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
  | 	at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
  | 	at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
  | 	at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
  | 	at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
  | 	at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
  | 	at $Proxy43.start(Unknown Source)
  | 	at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
  | 	at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1015)
  | 	at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
  | 	at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
  | 	at sun.reflect.GeneratedMethodAccessor17.invoke(Unknown Source)
  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  | 	at java.lang.reflect.Method.invoke(Method.java:597)
  | 	at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
  | 	at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
  | 	at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
  | 	at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
  | 	at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
  | 	at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
  | 	at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
  | 	at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
  | 	at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
  | 	at $Proxy8.deploy(Unknown Source)
  | 	at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
  | 	at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
  | 	at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
  | 	at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:274)
  | 	at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:225)
  | ...
  | 

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

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4049411#4049411

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4049411



More information about the jboss-user mailing list