aspose file tools
The moose likes Other Application Frameworks and the fly likes NoSuchBeanDefinitionException in Spring Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Reply Bookmark "NoSuchBeanDefinitionException in Spring" Watch "NoSuchBeanDefinitionException in Spring" New topic
Author

NoSuchBeanDefinitionException in Spring

Neha Gap
Greenhorn

Joined: May 30, 2007
Posts: 29
Hi,

I am doing the following -

I have a parent application bean context which does not construct any beans.

ApplicationBeanContext parent = new FileSystemXmlApplicationContext("empty.xml");

I have two children contexts, child1 and child2
ApplicationBeanContext child1 = new FileSystemXmlApplicationContext("child1.xml",parent);


Child1.xml

<bean id="child1" class="child1">
<property name="val">
<value>1</value>
</property>
</bean>

ApplicationBeanContext child2 = new FileSystemXmlApplicationContext("child2.xml",parent);
Child2.xml

<bean id="child2" class="child2">
<property name="child1">
<ref name="child1"/>
</property>
</bean>

(The code above is pseudo code)
Basically, I've configured child1 and child2 contexts to have the same parent. At child2's object initialisation, I get the following error

org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'child1' is defined:

Is this because I'm giving the xml files to the child contexts and not the parent context? Is there any solution for this?

Thanks in advanace
- Neha.
Gregg Bolinger
Ranch Hand

Joined: Jul 11, 2001
Posts: 15230

How do you suppose Child2 is supposed to know anything about Child1?
Milan Jagatiya
Ranch Hand

Joined: Jan 01, 2007
Posts: 164
Is this because I'm giving the xml files to the child contexts and not the parent context?

yeah...you have the answer ...


Milan.<br />I can because I think I can...
Neha Gap
Greenhorn

Joined: May 30, 2007
Posts: 29
Thank you for the replies

- Neha.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: NoSuchBeanDefinitionException in Spring
 
Similar Threads
XSD
Inheritance in Java
Problem JAXB Unmarshaller if order of XML tags differs.
Disposable bean's destroy method is not being called ???
Error coming in using JDO with Spring framework.