File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Application Frameworks and the fly likes NoSuchBeanDefinitionException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "NoSuchBeanDefinitionException" Watch "NoSuchBeanDefinitionException" New topic
Author

NoSuchBeanDefinitionException

Swetha Mohan
Greenhorn

Joined: Dec 23, 2005
Posts: 15
Hi Friends

I am trying to develop an application using spring framework, which tries to communicate with mysql.
But when i try to run the program. It is showing the following error.

org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'datacon' is defined: org.springframework.beans.factory.xml.XmlBeanFactory defining beans [dataSource,sessionFactory,hibernateTemplate,remitterDAO,remitter,sendingbankadmin,/SB/showConfirm,receivingbankdao,accountDAO,account,sendingbank]; root of BeanFactory hierarchy

I tried cahnging the bean names but still it is not detecting the bean file.

Please Help

thanks in advance
Swetha
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
What does you Spring config look like? Is "datacon" in your config... based on the exception I would guess not.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

You are referring or trying to get a bean called "datacon" which is not defined in you bean wiring file. As Chris said, check your xml files.


[My Blog]
All roads lead to JavaRanch
Swetha Mohan
Greenhorn

Joined: Dec 23, 2005
Posts: 15
Thank you friends.
The problem was with the xml file
Ayaz Pasha
Greenhorn

Joined: Jun 09, 2008
Posts: 5
I am facing the same problem, but i have defined the bean mane in my spring xml, any help???
Ayaz Pasha
Greenhorn

Joined: Jun 09, 2008
Posts: 5
I have series of exceptions being thrown, I am posting some of it here, looking for help...

11:09:22,208 ERROR [PortletServlet:60] javax.portlet.PortletException: javax.servlet.ServletException: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'com.mpower.common.addressbookdemo.service.AddressServiceFactory' is defined
javax.portlet.PortletException: javax.servlet.ServletException: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'com.mpower.common.addressbookdemo.service.AddressServiceFactory' is defined
at com.liferay.portlet.StrutsPortlet.include(StrutsPortlet.java:268)
at com.liferay.portlet.StrutsPortlet.doView(StrutsPortlet.java:156)
at com.mpower.common.addressbookdemo.AddressbookdemoPortlet.doView(AddressbookdemoPortlet.java:41)
at com.liferay.portal.kernel.portlet.LiferayPortlet.doDispatch(LiferayPortlet.java:52)
at javax.portlet.GenericPortlet.render(GenericPortlet.java:233)
at com.sun.portal.portletcontainer.appengine.filter.FilterChainImpl.doFilter(FilterChainImpl.java:121)
at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:69)
at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:96)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:557)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:481)
at com.liferay.portlet.InvokerPortlet.invoke(InvokerPortlet.java:534)
at com.liferay.portlet.InvokerPortlet.invokeRender(InvokerPortlet.java:605)
at com.liferay.portlet.InvokerPortlet.render(InvokerPortlet.java:373)
at org.apache.jsp.html.portal.render_005fportlet_jsp._jspService(render_005fportlet_jsp.java:1381)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:557)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:481)
at com.liferay.portal.util.PortalImpl.renderPortlet(PortalImpl.java:2290)
at com.liferay.portal.util.PortalUtil.renderPortlet(PortalUtil.java:749)
at com.liferay.portlet.layoutconfiguration.util.RuntimePortletUtil.processPortlet(RuntimePortletUtil.java:169)
at com.liferay.portlet.layoutconfiguration.util.RuntimePortletUtil.processPortlet(RuntimePortletUtil.java:104)
at com.liferay.portlet.layoutconfiguration.util.RuntimePortletUtil.processTemplate(RuntimePortletUtil.java:281)
at com.liferay.portlet.layoutconfiguration.util.RuntimePortletUtil.processTemplate(RuntimePortletUtil.java:194)
at org.apache.jsp.html.portal.layout.view.portlet_jsp._jspService(portlet_jsp.java:808)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
Ayaz Pasha
Greenhorn

Joined: Jun 09, 2008
Posts: 5
This is how I am defining it in my portlet-spring.xml, thanks for the help in advance..


<bean id="com.mpower.common.addressbookdemo.service.AddressLocalServiceFactory" class="com.mpower.common.addressbookdemo.service.AddressLocalServiceFactory" lazy-init="true">
<property name="service">
<ref bean="com.mpower.common.addressbookdemo.service.AddressLocalService.transaction" />
</property>
</bean>
vidya sagar
Ranch Hand

Joined: Mar 02, 2005
Posts: 580
Hi Ayaz,

It seems you have given bean definition in portlet-spring.xml as com.mpower.common.addressbookdemo.service.AddressLocalServiceFactory.But you have referred in your code as com.mpower.common.addressbookdemo.service.AddressServiceFactory.

Since i didnot have complete bean definition to tell exactly.

Keep bean definition id smaller and easy to refer.
 
 
subject: NoSuchBeanDefinitionException
 
Similar Threads
What's the relationship of MessageBean?
JSTL
BeanUtils question
accessing values from servlets to jsp
Reentrant!!