SEVERE: javax.faces.FacesException: java.lang.ClassCastException:

I'm trying to get past this error and cannot figure it out despite multiple internet searches on the topic.

Below are the code samples:
JSF2:

ManagedBeanCode:

Error Message from the GlassFish server:

The web page shows 10 patients initially. Checking the server log, the 8772 patients are documented in the System.out.println (this is correct). This also is the first page w/ first = 0 and pagesize = 10. Error comes when I either click an entry or I click the next button on the paginator.

If I 'redeploy' the app w/o any changes, the server log shows the following error messages w/o my interacting w/ the app at all:

Any help/ideas would be appreciated. I've not been able to determine what is causing the null pointer exception that shows w/ redeployment...

Thanks in advance...

Ilari Moilanen

Ranch Hand

Posts: 199

posted 6 years ago

The null pointer originates very likely from the fact that the first deployment did not manage to work without errors. One hint for that is in the error message itself "Unable to restore sessions for web module [/QIP1a.1] from previous deployment" which means that the error occurred when GlassFish is getting serialized data from the disk that it presumes is correctly saved and accessible.

The first exception on the other hand is not so clear. Maybe you use incompatible classes for the data. You can try to pin down where the error is by making the code simpler. First of all make the class @RequestScoped instead of @ViewScoped and remove the "implements Serializable". I am new to JSF but I have already found out that the @ViewScoped can be problematic. And remove all the unnecessary code from the xhtml page (including template using and so on).