The best place to *find* answers to programming/development questions, imo, however it's the *worst* place to *ask* questions (if your first question/comment doesn't get any up-rating/response, then u can't ask anymore questions--ridiculously unrealistic), but again, a great reference for *finding* answers.

My Music (Nickleus)


[SOLVED] JSF SessionScoped: com.sun.faces.mgbean.ManagedBeanCreationException: Cant instantiate class

when trying to view a jsf page, i got the following error in the browser:
http 500 error:
com.sun.faces.mgbean.ManagedBeanCreationException: Cant instantiate class: com.test.userUsersDataBean

and this was in the console:
11:23:07,407 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/].[facesServlet]] (http-localhost/ JBWEB000236: Servlet.service() for servlet facesServlet threw exception: java.lang.NullPointerException
    at com.test.userUsersDataBean.setUserAndMemberOnBackingBean( [:]
    at com.test.userUsersDataBean.<init>( [:]

here's the code for, line 97:
user = userMenuBean.getUser();

userMenuBean was apparently null. eventually i found out that the problem was this, in

when i changed it to this, it worked:


i just got a similar Cant instantiate class error when i migrated some validator classes from faces-config.xml to using annotations. the solution was just to rebuild/recompile the project, then "Clean" the server (servers > right click on my jboss server instance > clean), then restart the server.

No comments:

Post a Comment