PDA

View Full Version : map bean - nested exception is java.lang.NoSuchMethodException



vljc2004
Aug 31st, 2007, 01:03 PM
Hi!,

Apache indicate this error


org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'Persona' defined in ServletContext resource [/WEB-INF/HelloSpring-servlet.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationExcepti on: Could not instantiate bean class [prueba.Persona]: No default constructor found; nested exception is java.lang.NoSuchMethodException: prueba.Persona.<init>()

my xml is:


<bean id="Persona" class="prueba.Persona"></bean>
<bean id="HelloSpringController" class="prueba.HelloSpringController">
<property name="info"><ref bean="Persona" /></property>
</bean>
<bean id="PruebaSpringController" class="prueba.PruebaSpringController"></bean>
<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlH andlerMapping">
<property name="mappings">
<props>
<prop key="/hello.html">HelloSpringController</prop>
<prop key="/aqui.html">PruebaSpringController</prop>
</props>
</property>
</bean>

And the class if exist on my package. :confused:

Jörg Heinicke
Aug 31st, 2007, 09:21 PM
But Persona does obviously not have a default constructor. That's what the exception is saying.

Joerg