Announcement Announcement Module
Collapse

JavaConfig forum decommissioned in favor of Core Container

As described at

http://static.springsource.org/sprin...fig/README.TXT

key features of the Spring JavaConfig project have been migrated into the core Spring Framework as of version 3.0.

Please see the Spring 3.0 documentation on @Configuration and @Bean support:

http://static.springsource.org/sprin...tml#beans-java

For any questions related to @Configuration classes and @Bean methods in Spring 3.0, please post in the dedicated 'Core Container' forum at

http://forum.springsource.org/forumdisplay.php?f=26
See more
See less
parent= in xml causing NPE Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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)

  • #2
    Hi Barry,

    Is this related to JavaConfig in any way? If not, I'll move it to the Core Container forum.

    Comment


    • #3
      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

      Comment


      • #4
        No problem, no need to delete this thread, just go ahead with your JIRA issue.

        Comment

        Working...
        X