Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

BeanInstantiationException

 
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.



 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply Costi.
Here is the code for connectionFactory


 
syruss kumar
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 10192
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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...
 
Rototillers convert rich soil into dirt. Please note that this tiny ad is not a rototiller:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic