Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Managed Bean is not getting instantiated intermittently  RSS feed

 
subhasis swain
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a JSF bean which is request scope and corresponding JSF UI page. when user tries to open this page, we are getting exception 'Cannot instantiate user.java class <default constructor>'. This does not come always. It comes very rarely. Can anybody help me on this. JSF version is 1.2
 
Tim Holloway
Bartender
Posts: 18709
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Subhasis!

This most likely is happening because an exception is being thrown in the bean's constructor. Unless someone is catching and discarding the exception it should show up in the server log.

JSF, like most JavaBean-based technologies requires a no-argument (default) constructor. If you do not have one, you should add one to the failing class. It doesn't have to do anything, simply be there for JSF to invoke.

You don't actually need any default constructor at all unless you have other constructors that do take arguments, but it's cheap insurance.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!