Win a copy of Rust Web Development this week in the Other Languages 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Unable to create managed bean. Hello world app.

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did several tutorials and all works fine but this hello world example...


Tomcat Exception


index.xhtml


welcome.xhtml


UserBean.java



And faces-config.xml

Screen-Shot-2012-01-24-at-12.05.49-AM.png
[Thumbnail for Screen-Shot-2012-01-24-at-12.05.49-AM.png]
 
Saloon Keeper
Posts: 24828
172
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't put UserBean in the default package. Use of the default package is generally discouraged, and some IDEs will even yell at you for using it at all.

Oh, and welcome to the Ranch!
 
Dmitry Pidd
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
oh no I tried and tried, and with glassfish and modifying faces-config in a lot of ways,- still doesn't work and it drives me crazy.
I just did put it in com.beans.UserBean and changed faces-config accordingly


javax.servlet.ServletException: Unable to create managed bean user. The following problems were found:
- Bean or property class com.beans.UserBean for managed bean user cannot be found.
javax.faces.webapp.FacesServlet.service(FacesServlet.java:606)



Could my user libraries be a problem?
Screen-Shot-2012-01-24-at-10.00.36-AM.png
[Thumbnail for Screen-Shot-2012-01-24-at-10.00.36-AM.png]
 
Tim Holloway
Saloon Keeper
Posts: 24828
172
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The fact that you got a JSF message means that you did almost everything right. Most people don't get that far on the first try.

I did notice one strange thing:



I don't think that that can even compile considering you didn't list any interface names after "implements". And since JSF backing beans are POJOs, there's no requirement to implement any interfaces anyway.

It doesn't hurt to include a no-argument public constructor on your bean, since "proper" POJOs should. But JSF doesn't require it, especially if you don't have any construction-time code to execute.
 
Dmitry Pidd
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes with default constructor it worked!! Thank you I spent about 5 hrs, on it. But why it didn't work before then, if bean is POJO?

sorry for implements, I tried Serrializable just to see if it could be a problem and forgot to delete it
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic