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/127.0.0.1:8080-3) JBWEB000236: Servlet.service() for servlet facesServlet threw exception: java.lang.NullPointerException
at com.test.userUsersDataBean.setUserAndMemberOnBackingBean(UsersDataBean.java:97) [:]
at com.test.userUsersDataBean.<init>(UsersDataBean.java:109) [:]
...
here's the code for UsersDataBean.java, line 97:
user = userMenuBean.getUser();
userMenuBean was apparently null. eventually i found out that the problem was this, in UserMenuBean.java:
@javax.enterprise.context.SessionScoped
when i changed it to this, it worked:
@javax.faces.bean.SessionScoped;
UPDATE
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.
IT, computer and programming tutorials and tips that i couldnt find anywhere else using google, from my daily work as a Senior Developer of solutions using Java and Linux.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment