Results 1 to 4 of 4

Thread: parent= in xml causing NPE

Hybrid View

  1. #1
    Join Date
    Aug 2004
    Posts
    230

    Default parent= in xml causing NPE

    I have a bean declared in xml which uses parent="someotherbeanname". I have a top-level application-context that loads lots fo xml configs and some java configs. During the ConfigurationPostProcessor the BeanDefinition has a null class, which causes an NPE in ClassUtils.convertClassNameToResourcePath (stack below).

    As I comment out the xml bean which declare a parent, the NPE moves on to the next bean with a parent. Is there some delayed configuration in spring-core related to bean with parent beans?


    Code:
    java.lang.NullPointerException
    	at org.springframework.util.ClassUtils.convertClassNameToResourcePath(ClassUtils.java:753)
    	at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:68)
    	at org.springframework.config.java.process.ConfigurationBeanDefinitionDecoratingBeanFactoryPostProcessor.isConfigClass(ConfigurationBeanDefinitionDecoratingBeanFactoryPostProcessor.java:63)
    	at org.springframework.config.java.process.ConfigurationBeanDefinitionDecoratingBeanFactoryPostProcessor.postProcessBeanFactory(ConfigurationBeanDefinitionDecoratingBeanFactoryPostProcessor.java:48)
    	at org.springframework.config.java.process.ConfigurationPostProcessor.postProcessBeanFactory(ConfigurationPostProcessor.java:42)
    	at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:554)
    	at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:537)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:363)
    	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
    	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
    	at com.its.infra.util.spring.BeanFactoryInstance$DefaultBeanFactoryInstantiator.newInstance(BeanFactoryInstance.java:104)
    	at com.its.infra.util.spring.BeanFactoryInstance.install(BeanFactoryInstance.java:85)
    	at com.its.infra.util.spring.BeanFactoryInstance.install(BeanFactoryInstance.java:52)
    	at com.its.infra.util.spring.BeanFactoryInstance.install(BeanFactoryInstance.java:48)
    	at test.ftest.trading.AbstractServerTestCase.setUpBeanFactoryInstance(AbstractServerTestCase.java:273)
    	at test.ftest.trading.AbstractServerTestCase.setUp(AbstractServerTestCase.java:243)
    	at com.its.importexport.FTestAccountElementSetImporter.setUp(FTestAccountElementSetImporter.java:40)
    	at junit.framework.TestCase.runBare(TestCase.java:132)
    	at junit.framework.TestResult$1.protect(TestResult.java:110)
    	at junit.framework.TestResult.runProtected(TestResult.java:128)
    	at junit.framework.TestResult.run(TestResult.java:113)
    	at junit.framework.TestCase.run(TestCase.java:124)
    	at test.support.BaseTestCase.run(BaseTestCase.java:53)
    	at test.support.AbstractTestCase.run(AbstractTestCase.java:88)
    	at junit.framework.TestSuite.runTest(TestSuite.java:232)
    	at junit.framework.TestSuite.run(TestSuite.java:227)
    	at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:79)
    	at org.junit.runners.Suite.runChild(Suite.java:115)
    	at org.junit.runners.Suite.runChild(Suite.java:23)
    	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
    	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
    	at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
    	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
    	at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
    	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
    	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
    Barry Kaplan (memelet)

  2. #2
    Join Date
    Apr 2007
    Posts
    307

    Default

    Hi Barry,

    Is this related to JavaConfig in any way? If not, I'll move it to the Core Container forum.
    Chris Beams
    Spring Framework committer, VMware
    http://github.com/cbeams

  3. #3
    Join Date
    Aug 2004
    Posts
    230

    Default

    Hmm, I think I pasted the wrong stack trace. I was seeing this error only when the ConfigurationPostProcessor was executing. But the trace I did post has the error without ConfigurationPostProcessor, so maybe either way its a core issue.

    I will need to create a simple test case in any case. If you want to can kill this thread and I will create another in core or just post jira issue.

    sorry
    Barry Kaplan (memelet)

  4. #4
    Join Date
    Apr 2007
    Posts
    307

    Default

    No problem, no need to delete this thread, just go ahead with your JIRA issue.
    Chris Beams
    Spring Framework committer, VMware
    http://github.com/cbeams

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •