3 Replies Latest reply on Oct 17, 2005 7:43 PM by gesker

    JSF Cast Problem

    gesker

      I am able to populate a report (JSF dataTable) using a method from a Session bean that returns some objects (Person objects) in my persistence archive.

      So far so good but when I click on the commandLink jboss returns a FacesException and indicates, later in the stacktrace that the cause is a ClassCastException.

      The method seems to choke at the line:

      //personModel is a ListDataModel
      Person p = (Person) personModel.getRowData();

      However, other lines I placed (inside System.out statements) in the method are returning what I think are reasonable values:

      personModel.getRowCount() // returns 5 which is correct
      personModel.getRowIndex() // returns the correct index
      personModel.isRowAvailable() //returns true
      personModel.getRowData() // returns com.alamon.ejb.pg_sample_rw.Person@eba477

      If someone in the forum could point me in the right direction I'd be really greatful.

      Thanks
      Dennis



        • 1. Re: JSF Cast Problem
          gesker

          Sorry, forgot to include system config above
          jboss-4.0.3 (eJB3 configuration)
          sun jdk 1.5 update 5
          debian linux kernel 2.6.12

          • 2. Re: JSF Cast Problem
            darranl

            Posting the exception stack trace and message might help, at the moment we only know that you are experiencing one of the most common exceptions that you could see.

            Also can you describe your packaging, what lives where? Are any classes packaged in the war as well as the ejb jar file? This is a common cause of class cast exceptions as the classes get loaded by two different classloaders so look different.

            • 3. Re: JSF Cast Problem
              gesker

              You hit the nail right on the head. I mistakenly included some classes in my web archive that were already included in my ejb3 and persistence archives. After correcting this things seem to be working.

              Thank you very much!

              Dennis