1 2 Previous Next 15 Replies Latest reply on Jun 27, 2007 6:12 PM by titou09

    ClassCastException: org.jboss.seam.jsf.SeamApplication11 inc

    titou09

      Hello,
      I'm trying to setup a project with seam 1.2.1 on WebSphere v6.1.0.7.

      WAS v6.1.0.7 has a JSF 1.1 implementation based on JSF Sun RI. When WAS tries to start the application, I get the following exception:

      WebApp E Extension processor failed to initialize in factory: com.ibm.ws.jsf.extprocessor.JSFExtensionFactory@cd60cd6
      java.lang.ClassCastException: org.jboss.seam.jsf.SeamApplication11 incompatible with com.sun.faces.application.ApplicationImpl
      at com.ibm.ws.jsf.configuration.FacesConfigParser.createFacesFactories(FacesConfigParser.java:1019)
      at com.ibm.ws.jsf.configuration.FacesConfigParser.initializeConfiguration(FacesConfigParser.java:354)
      at com.ibm.ws.jsf.util.FacesConfigUtil._parseJSFConfiguration(FacesConfigUtil.java:128)
      at com.ibm.ws.jsf.util.FacesConfigUtil.parseJSFConfiguration(FacesConfigUtil.java:82)
      at com.sun.faces.util.Util.verifyFactoriesAndInitDefaultRenderKit(Util.java:497)
      at com.ibm.ws.jsf.configuration.FacesConfig.initialize(FacesConfig.java:96)

      Q:
      - Any idea for this exception (I'v tried lots of things to try to have it working, including playing with classloader...)
      - What is the requirement for seam on JSF: Does seam absolutely requires "MyFaces" as JSF implementation? or can I use WAS JSF 1.1 implementation bases on Sun RI? or more generally any JSF 1.1 compatible implementation?
      - Anyone there running seam 1.2.1 on WAS v6.1.0.7 with the builtin JSF implementation?
      thx

      file /WEB-INF/faces-config.xml:
      ------------------------------------
      <?xml version="1.0"?>
      <!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN" "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
      <faces-config>

      <phase-listener>org.jboss.seam.jsf.SeamPhaseListener</phase-listener>

      </faces-config>

      file /WEB-INF/web.xml:
      --------------------------
      <?xml version="1.0" encoding="UTF-8"?>
      <web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
      <context-param>
      <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
      <param-value>server</param-value>
      </context-param>
      <context-param>
      <param-name>javax.faces.CONFIG_FILES</param-name>
      <param-value>/WEB-INF/faces-config.xml</param-value>
      </context-param>
      <context-param>
      <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
      <param-value>.jsp</param-value>
      </context-param>
      <context-param>
      <param-name>com.sun.faces.NUMBER_OF_VIEWS_IN_SESSION</param-name>
      <param-value>15</param-value>
      </context-param>
      <context-param>
      <param-name>com.sun.faces.enableHighAvailability</param-name>
      <param-value>false</param-value>
      </context-param>
      <context-param>
      <param-name>com.sun.faces.COMPRESS_STATE</param-name>
      <param-value>false</param-value>
      </context-param>
      <context-param>
      <param-name>com.ibm.ws.jsf.JSP_UPDATE_CHECK</param-name>
      <param-value>true</param-value>
      </context-param>
      <context-param>
      <param-name>com.ibm.ws.jsf.LOAD_FACES_CONFIG_AT_STARTUP</param-name>
      <param-value>true</param-value>
      </context-param>

      <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
      <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>


      <servlet-name>Faces Servlet</servlet-name>
      <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
      <load-on-startup>-1</load-on-startup>


      <servlet-mapping>
      <servlet-name>Faces Servlet</servlet-name>
      <url-pattern>/faces/*</url-pattern>
      </servlet-mapping>
      <servlet-mapping>
      <servlet-name>Faces Servlet</servlet-name>
      <url-pattern>*.faces</url-pattern>
      </servlet-mapping>

      </web-app>

        • 1. Re: ClassCastException: org.jboss.seam.jsf.SeamApplication11
          pmuir

          It appears that WAS isn't well behaved here as it assumes that the JSF Application will be a particular implementation, rather than using an API class, or even putting the cast inside an if. You'll need to take this up with IBM I think.

          • 2. Re: ClassCastException: org.jboss.seam.jsf.SeamApplication11
            titou09

            I'm not 100% of your last statement, I finally made it to work with the following config (but i'm not satisfied with it, mostly because of the "parent_last" classloader on the war and the need to use myfaces...):
            - have jboss-seam-ui.jar, jboss-seam.jar,myfaces-api-1.1.5.jar,myfaces-impl-1.1.5.jar under web-inf/lib
            - all other dependent libs (commons*, hibernate*, etc..) in ear with ref in the meta-inf/manifest.mf file of the warmodule
            - ear and war classloader set to PARENT_LAST

            If i remove the myfaces* libs (and so use the jsf was jsf implementation) or push down the myfaces* libs to the ear level, I have the ClassCast..classes imcompatibe...exception)

            It seems that it works *only* if the myfaces libs are at the "same level" as the jsf implementation libs (dont know how to express this..) and that the way seam initialises itself requires this. Maybe it's due to the way seam scans the classpath to find its resources (?) ...
            Any thoughts on this?

            • 3. Re: ClassCastException: org.jboss.seam.jsf.SeamApplication11
              ikuleshov

               

              I finally made it to work


              titou09, have you been so lucky to make seam running with EJB3 support on WebSphere?

              I am having hard times dealing with these issues of the WebSphere EJB3 Feature Pack:

              - Container-managed PersistenceContext (also known as container-managed EntityManager) not supported

              - EJB3 modules that have an ejb-jar.xml must be named starting with "EJB3" and use EJB 2.1 DTD

              The later point is the most important one since we can't use EJB3-style ejb-jar.xml and it becomes impossible to add seam EJB interceptors into the ejb-jar.xml



              • 4. Re: ClassCastException: org.jboss.seam.jsf.SeamApplication11
                ikuleshov

                ..or we should we give up and stick to JPA

                • 5. Re: ClassCastException: org.jboss.seam.jsf.SeamApplication11
                  titou09

                  No. I didn't know there was a ejb3 feature pack for was...
                  In the related forum, it is said that it needs exactly was v6.1.0.3 ma ybe it's your problem (we are in v6.1.0.7)
                  In fact we are using regular POJO + Hibernate 3.2.4 + @Transactional annotations and plain standard jta transactions.
                  I had to patch Hibernate to make it work (org.hibernate.JTATransactionFactory) to make it work due to a problem Hibernate tries to get the JTA Transaction Statusat some point in the sessioN/transaction lifecycle (pls search on hibernate for this one)

                  • 6. Re: ClassCastException: org.jboss.seam.jsf.SeamApplication11

                    I have Seam 1.2 successfully running on WAS 6.1. I recreated the error you see when I place the seam jars into the EAR. If I have the Seam jars in the WEB-INF lib directory only, the error is cleared.


                    In my implementation I am running JBoss Rules BRMS 4.0. To get it running I created an EAR in RAD, then created a Dynamic Web project and copied in all of the JBoss Rules BRMS 4.0 war (uses Seam 1.2) files. I deployed the ear and it works without any other modifications.

                    • 7. Re: ClassCastException: org.jboss.seam.jsf.SeamApplication11
                      titou09

                      cool, but the questions behind my problem were:
                      1) do you have to use MyFaqes instead of the JSF implementation of WAS (Is it your case)?
                      2) Indeed, if you put all your code in the war, seam works, but this is not acceptable to us. We have to separate our sevices/managers/model classes into a "utility" jar and have the war depends on it, and only have classes related to presentation in the war (view controllers/backing beans). This seems to not be possible if you want to uses seam annotation in any class in the utility jar, as jboss-seam.jar must be placed in the ear file directly has any other framework jar (log4j, etc..). and as you point it out, this does not work

                      A workaround is to have an utility jar for the "business" classes and deploy it under the war WEB-INF/lib directory....arghh

                      See my other posts in tha forum on that topic.

                      • 8. Re: ClassCastException: org.jboss.seam.jsf.SeamApplication11

                        I have the same problem, using Rational Software Architect 7 - WAS 6.1 runtime.

                        I think is a problem with the IBM -JSF implementation, I was doing some decompile over com.ibm.ws.webcontainer_2.0.0.jar , but can't found the issue, is something related with this code :

                        obj = (ApplicationFactory)FactoryFinder.getFactory("javax.faces.application.ApplicationFactory");

                        application = (ApplicationImpl)((ApplicationFactory) (obj)).getApplication();

                        The second line give the cast exception, I think they (IBM) have to cast to (Application) not to (ApplicationImpl) because org.jboss.seam.jsf.SeamApplication11 extend for application.

                        But to try to find a workaround for this I need more time and help from the JBoss Seam.


                        I really hope that someone or me can find a workaround or make a patch, so people out there can use Seam on WAS 6.1 with the IBM JSF implementation.

                        • 9. Re: ClassCastException: org.jboss.seam.jsf.SeamApplication11
                          gavin.king

                          Yes, they should not do that typecast, that is a bug in their JSF impl.

                          • 10. Re: ClassCastException: org.jboss.seam.jsf.SeamApplication11

                            Gavin, thanks four your answer

                            I work for a Ibm business partner, and have some contacts in IBM office here in my country, they are helping me putting a PMR ( bug report).

                            I will put their answers here.

                            But in the mean time it may be useful is some one put in the wiki a note or something telling that if you want to use SEAM on WAS you have to use Sun JSF RI or Myfaces.



                            • 11. Re: ClassCastException: org.jboss.seam.jsf.SeamApplication11
                              gavin.king

                              Why don't you add it to the Problems FAQ. That's the whole point of it being a wiki ;-)

                              • 12. Re: ClassCastException: org.jboss.seam.jsf.SeamApplication11

                                Gaving, You are right :)

                                I did put a entry on the problems FAQ wiki.

                                • 13. Re: ClassCastException: org.jboss.seam.jsf.SeamApplication11
                                  titou09

                                  Gavin and shushamen, FYI I've opned a PMR with IBM on this.
                                  I'm waiting for feedback, I'll keep you informed

                                  • 14. Re: ClassCastException: org.jboss.seam.jsf.SeamApplication11
                                    gavin.king

                                    ok, great

                                    1 2 Previous Next