Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Spring and the fly likes BeanInstantiationException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "BeanInstantiationException" Watch "BeanInstantiationException" New topic
Author

BeanInstantiationException

syruss kumar
Ranch Hand

Joined: Jul 23, 2009
Posts: 93
Hi all,
I have created a simple Bean which will insert the values in to the database. While executing that i got this error:
javax.faces.FacesException: Problem in renderResponse: Error creating bean with name 'dbBean' defined in ServletContext resource [/WEB-INF/springapp-servlet.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.openi.web.ui.jsf.bean.reports.analysis.DBBean]: Constructor threw exception; nested exception is java.lang.NullPointerException
com.icesoft.faces.facelets.D2DFaceletViewHandler.renderResponse(D2DFaceletViewHandler.java:294)
com.icesoft.faces.application.D2DViewHandler.renderView(D2DViewHandler.java:161)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:107)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:245)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:137)
com.icesoft.faces.webapp.http.core.JsfLifecycleExecutor.apply(JsfLifecycleExecutor.java:18)
com.icesoft.faces.webapp.http.core.PageServer$1.respond(PageServer.java:25)
com.icesoft.faces.webapp.http.servlet.ServletRequestResponse.respondWith(ServletRequestResponse.java:161)
com.icesoft.faces.webapp.http.servlet.ThreadBlockingAdaptingServlet$ThreadBlockingRequestResponse.respondWith(ThreadBlockingAdaptingServlet.java:36)
com.icesoft.faces.webapp.http.core.PageServer.service(PageServer.java:30)
com.icesoft.faces.webapp.http.core.SingleViewServer.service(SingleViewServer.java:48)
com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer$Matcher.serviceOnMatch(PathDispatcherServer.java:50)
com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer.service(PathDispatcherServer.java:19)
com.icesoft.faces.webapp.http.servlet.ThreadBlockingAdaptingServlet.service(ThreadBlockingAdaptingServlet.java:19)
com.icesoft.faces.webapp.http.servlet.EnvironmentAdaptingServlet.service(EnvironmentAdaptingServlet.java:63)
com.icesoft.faces.webapp.http.servlet.MainSessionBoundServlet.service(MainSessionBoundServlet.java:139)
com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:53)
com.icesoft.faces.webapp.http.servlet.PathDispatcher$Matcher.serviceOnMatch(PathDispatcher.java:52)
com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:29)
com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:82)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.openi.security.AuthorizationFilter.doFilter(AuthorizationFilter.java:98)


My Bean code is:

Can anyone suggest me to resolve this issue?
Thanks in advance.




All search starts with beginner's luck and all search ends with victor's severly tested.
Costi Ciudatu
Ranch Hand

Joined: Oct 24, 2006
Posts: 74
Can you also post the code for ConnectionFactory ?

(By the way, you should consider using dependecny injection for referencing a ConnectionFactory, since you're making use of Spring, but that's a whole different matter).
Costi Ciudatu
Ranch Hand

Joined: Oct 24, 2006
Posts: 74
Sorry, I now realized that ConnectionFactory is not one of your classes, it's from an API However, I still suspect that NPE is thrown by the 'new ConnectionFactory()' line.
syruss kumar
Ranch Hand

Joined: Jul 23, 2009
Posts: 93
Thanks for your reply Costi.
Here is the code for connectionFactory


syruss kumar
Ranch Hand

Joined: Jul 23, 2009
Posts: 93
Hi costi ,

springapp-servlet.xml entry is .

<!--New Bean Entry-->
<bean id="DBBean" class="org.openi.web.ui.jsf.bean.reports.analysis.DBBean" scope="session"/>

<!--Entry ends here-->

If i want to instaniate another bean i have to given that in property attribute .am i right ?
I dont have any dependency bean with DBBean.

Please suggest me to resolve this .

Thanks in advance.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9345
    
    2

syruss kumar wrote:Hi costi ,

springapp-servlet.xml entry is .

<!--New Bean Entry-->
<bean id="DBBean" class="org.openi.web.ui.jsf.bean.reports.analysis.DBBean" scope="session"/>

<!--Entry ends here-->

If i want to instaniate another bean i have to given that in property attribute .am i right ?
I dont have any dependency bean with DBBean.

Please suggest me to resolve this .

Thanks in advance.


Check the bean id... is it DBBean or dbBean?? See the stack trace of yours...


SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
 
 
subject: BeanInstantiationException
 
Similar Threads
struts 2: Stuck up with simple issue
Please I can't connect my App. to mysqlDatabase through apache-tomcat-6.0.16
JSTL for loop error
Can I create connection pooling with data sources using sybase driver(jconn2.jar)?
Accessing javabean in JSP which is instantiated in Action class