Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NoSuchBeanDefinitionException

 
Swetha Mohan
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2712
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does you Spring config look like? Is "datacon" in your config... based on the exception I would guess not.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Swetha Mohan
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you friends.
The problem was with the xml file
 
Ayaz Pasha
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am facing the same problem, but i have defined the bean mane in my spring xml, any help???
 
Ayaz Pasha
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic