4 Replies Latest reply on Feb 4, 2009 1:18 PM by Julien Kronegg

    Jboss Tools\Seam gen project deployment Class cast exception

    Dave Ellery Newbie

      Ok so using the following


      Seam 1.2
      JBoss AS 4.2.3 GA


      After working though the minor issues from generating I finally get it to deploy but when i try to go the generated seam home pages I get


      11:45:07,482 ERROR [STDERR] Jan 28, 2009 11:45:07 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/D:/jboss-4.2.3.GA/server/default/deploy/vfm-seam.war/WEB-INF/lib/ajax4jsf-1.1.1-SNAPSHOT.jar!/META-INF/a4j.taglib.xml
      11:45:07,497 ERROR [STDERR] Jan 28, 2009 11:45:07 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/D:/jboss-4.2.3.GA/server/default/deploy/vfm-seam.war/WEB-INF/lib/jboss-seam-pdf.jar!/META-INF/seam-pdf.taglib.xml
      11:45:07,497 ERROR [STDERR] Jan 28, 2009 11:45:07 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/D:/jboss-4.2.3.GA/server/default/deploy/vfm-seam.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jsf-html.taglib.xml
      11:45:07,513 ERROR [STDERR] Jan 28, 2009 11:45:07 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/D:/jboss-4.2.3.GA/server/default/deploy/vfm-seam.war/WEB-INF/lib/richfaces-3.0.1-SNAPSHOT.jar!/META-INF/rich.taglib.xml
      11:45:07,513 ERROR [STDERR] Jan 28, 2009 11:45:07 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/D:/jboss-4.2.3.GA/server/default/deploy/vfm-seam.war/WEB-INF/lib/jboss-seam-ui.jar!/META-INF/seam-ui.taglib.xml
      11:45:07,529 ERROR [STDERR] Jan 28, 2009 11:45:07 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/D:/jboss-4.2.3.GA/server/default/deploy/vfm-seam.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jstl-core.taglib.xml
      11:45:07,529 ERROR [STDERR] Jan 28, 2009 11:45:07 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/D:/jboss-4.2.3.GA/server/default/deploy/vfm-seam.war/WEB-INF/lib/jboss-seam-mail.jar!/META-INF/seam-mail.taglib.xml
      11:45:07,560 ERROR [STDERR] Jan 28, 2009 11:45:07 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/D:/jboss-4.2.3.GA/server/default/deploy/vfm-seam.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jsf-ui.taglib.xml
      11:45:07,560 ERROR [STDERR] Jan 28, 2009 11:45:07 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/D:/jboss-4.2.3.GA/server/default/deploy/vfm-seam.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jstl-fn.taglib.xml
      11:45:07,575 ERROR [STDERR] Jan 28, 2009 11:45:07 AM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/D:/jboss-4.2.3.GA/server/default/deploy/vfm-seam.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jsf-core.taglib.xml
      11:45:08,091 ERROR [STDERR] Jan 28, 2009 11:45:08 AM com.sun.facelets.FaceletViewHandler handleRenderException
      SEVERE: Error Rendering View[/home.xhtml]
      java.lang.ClassCastException: java.lang.Long cannot be cast to javax.persistence.EntityManagerFactory
              at org.jboss.seam.core.ManagedPersistenceContext.getEntityManagerFactoryFromJndiOrValueBinding(ManagedPersistenceContext.java:169)
              at org.jboss.seam.core.ManagedPersistenceContext.initEntityManager(ManagedPersistenceContext.java:77)
              at org.jboss.seam.core.ManagedPersistenceContext.getEntityManager(ManagedPersistenceContext.java:105)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
              at java.lang.reflect.Method.invoke(Unknown Source)
              at org.jboss.seam.util.Reflections.invoke(Reflections.java:20)
              at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:123)
              at org.jboss.seam.Component.callComponentMethod(Component.java:1834)
              at org.jboss.seam.Component.unwrap(Component.java:1860)
              at org.jboss.seam.Component.getInstance(Component.java:1657)
              at org.jboss.seam.Component.getInstance(Component.java:1610)
              at org.jboss.seam.Component.getInstance(Component.java:1604)
              at org.jboss.seam.framework.Controller.getComponentInstance(Controller.java:258)
              at org.jboss.seam.framework.PersistenceController.getPersistenceContext(PersistenceController.java:20)
              at org.jboss.seam.framework.EntityQuery.getEntityManager(EntityQuery.java:84)
              at org.jboss.seam.framework.EntityQuery.validate(EntityQuery.java:29)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
              at java.lang.reflect.Method.invoke(Unknown Source)
              at org.jboss.seam.util.Reflections.invoke(Reflections.java:20)
              at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57)
              at org.jboss.seam.interceptors.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:34)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
              at org.jboss.seam.interceptors.TransactionInterceptor$1.work(TransactionInterceptor.java:32)
              at org.jboss.seam.util.Work.workInTransaction(Work.java:37)
              at org.jboss.seam.interceptors.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:27)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
              at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
              at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
              at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:151)
              at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:87)
              at com.vfmleonardo.jpa.entity.CdmsNodeList_$$_javassist_218.validate(CdmsNodeList_$$_javassist_218.java)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
              at java.lang.reflect.Method.invoke(Unknown Source)
              at org.jboss.seam.util.Reflections.invoke(Reflections.java:20)
              at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:123)
              at org.jboss.seam.Component.callComponentMethod(Component.java:1834)
              at org.jboss.seam.Component.callCreateMethod(Component.java:1757)
              at org.jboss.seam.Component.newInstance(Component.java:1746)
              at org.jboss.seam.Component.getInstance(Component.java:1643)
              at org.jboss.seam.Component.getInstance(Component.java:1610)
              at org.jboss.seam.jsf.SeamVariableResolver.resolveVariable(SeamVariableResolver.java:53)
              at com.sun.faces.el.VariableResolverChainWrapper.getValue(VariableResolverChainWrapper.java:107)
              at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
              at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:72)
              at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:45)
              at org.apache.el.parser.AstValue.getValue(AstValue.java:86)
              at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
              at com.sun.faces.application.ValueBindingValueExpressionAdapter.getValue(ValueBindingValueExpressionAdapter.java:113)
              at org.jboss.seam.core.Expressions$1.getValue(Expressions.java:69)
              at org.jboss.seam.pages.Param.getValueFromModel(Param.java:93)
              at org.jboss.seam.core.Pages.getPageParameterValue(Pages.java:615)
              at org.jboss.seam.core.Pages.getConvertedParameters(Pages.java:591)
              at org.jboss.seam.ui.HtmlLink.encodeBegin(HtmlLink.java:128)
              at org.ajax4jsf.framework.renderer.RendererBase.renderChild(RendererBase.java:280)
              at org.richfaces.renderkit.html.ToolBarRendererBase.encodeChildren(ToolBarRendererBase.java:81)
              at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
              at javax.faces.component.UIComponent.encodeAll(UIComponent.java:936)
              at javax.faces.component.UIComponent.encodeAll(UIComponent.java:942)
              at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:571)
              at org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
              at org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:229)
              at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:109)
              at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
              at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
              at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
              at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
              at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
              at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:60)
              at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
              at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
              at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
              at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:79)
              at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
              at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:96)
              at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:220)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
              at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
              at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
              at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
              at o
      11:45:08,091 ERROR [STDERR] rg.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
              at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
              at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
              at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
              at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
              at java.lang.Thread.run(Unknown Source)





      If someone could point me in the right direction so I can sort this out that'd be great.

        • 1. Re: Jboss Tools\Seam gen project deployment Class cast exception
          Dave Ellery Newbie

          Pretty sure you can ignore the STDERR add library stuff thats a facelets issue.


          it real problem is



          SEVERE: Error Rendering View[/home.xhtml]
          java.lang.ClassCastException: java.lang.Long cannot be cast to javax.persistence.EntityManagerFactory
                  at org.jboss.seam.core.ManagedPersistenceContext.getEntityManagerFactoryFromJndiOrValueBinding(ManagedPersistenceContext.java:169)
                  at org.jboss.seam.core.ManagedPersistenceContext.initEntityManager(ManagedPersistenceContext.java:77)
                  at org.jboss.seam.core.ManagedPersistenceContext.getEntityManager(ManagedPersistenceContext.java:105)
                  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)



          • 2. Re: Jboss Tools\Seam gen project deployment Class cast exception
            Julien Kronegg Novice

            Usually, java.lang.ClassCastException on javax.persistence.EntityManagerFactory is related to classloader problems. However, since this cast exception refers to a java.lang.Long, this should be something else.


            You should give more information, such as : persistence.xml, components.xml

            • 3. Re: Jboss Tools\Seam gen project deployment Class cast exception
              Dave Ellery Newbie

              persistence.xml


              <?xml version="1.0" encoding="UTF-8"?>
              <!-- Persistence deployment descriptor for dev profile -->
              <persistence xmlns="http://java.sun.com/xml/ns/persistence" 
                           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                           xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" 
                           version="1.0">
                           
                 <persistence-unit name="vfm-seam" transaction-type="JTA">
                    <provider>org.hibernate.ejb.HibernatePersistence</provider>
                    <jta-data-source>java:/vfm-seamDatasource</jta-data-source>
                    <properties>
                    <!--   <property name="hibernate.hbm2ddl.auto" value="validate"/> -->
                       <property name="hibernate.show_sql" value="true"/>
                       <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
                    </properties>
                 </persistence-unit>
                  
              </persistence>






              components.xml


              <?xml version="1.0" encoding="UTF-8"?>
              <components xmlns="http://jboss.com/products/seam/components"
                          xmlns:core="http://jboss.com/products/seam/core"
                          xmlns:drools="http://jboss.com/products/seam/drools"
                          xmlns:security="http://jboss.com/products/seam/security"
                          xmlns:mail="http://jboss.com/products/seam/mail"
                          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                          xsi:schemaLocation=
                              "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-1.1.xsd 
                               http://jboss.com/products/seam/drools http://jboss.com/products/seam/drools-1.1.xsd
                               http://jboss.com/products/seam/security http://jboss.com/products/seam/security-1.1.xsd
                               http://jboss.com/products/seam/mail http://jboss.com/products/seam/mail-1.2.xsd
                               http://jboss.com/products/seam/components http://jboss.com/products/seam/components-1.1.xsd">
              
                 <core:init debug="true" jndi-pattern="@jndiPattern@"/>
                   
                 <core:manager concurrent-request-timeout="500" 
                               conversation-timeout="120000" 
                               conversation-id-parameter="cid" 
                               conversation-is-long-running-parameter="clr"/>
                  
                 <core:managed-persistence-context name="entityManager"
                                            auto-create="true"
                                 entity-manager-factory="#{vfm-seamEntityManagerFactory}"/>
              
                 <core:entity-manager-factory name="vfm-seamEntityManagerFactory" 
                             persistence-unit-name="vfm-seam"/>
                 
                 <core:ejb installed="@embeddedEjb@"/>
                  
                 <drools:rule-base name="securityRules">
                     <drools:rule-files><value>/security.drl</value></drools:rule-files>
                 </drools:rule-base>
              
                 <security:identity authenticate-method="#{authenticator.authenticate}"
                                         security-rules="#{securityRules}"
                                            remember-me="true"/>
                                            
                 <event type="org.jboss.seam.notLoggedIn">
                     <action expression="#{redirect.captureCurrentView}"/>
                 </event>
                 <event type="org.jboss.seam.postAuthenticate">
                     <action expression="#{redirect.returnToCapturedView}"/>
                 </event>
                 
                 <mail:mail-session host="localhost" port="2525" username="test" password="test" />
                      
                 <!-- For use with jBPM pageflow or process management -->
                 <!--  
                 <core:jbpm>
                    <core:process-definitions></core:process-definitions>
                    <core:pageflow-definitions></core:pageflow-definitions>
                 </core:jbpm>
                 -->
                    
              </components>




              I still have not resolved this by the way :(





              • 4. Re: Jboss Tools\Seam gen project deployment Class cast exception
                Julien Kronegg Novice

                Try removing the - from the named components (i.e. replace vfm-s by vfmS).


                By the way, are you really using Seam 1.2, or is it a typo?