2 Replies Latest reply on Jun 18, 2013 2:38 PM by Paulo Carneiro

    seam 2.3,jsf 2.1,jpa 2,tomcat 7 problem

    zhou jinliang Newbie

      when i use seam 2.2,jsf 1.2,jpa 1,tomcat 7,it'ok.but i upgrade seam from 2.2 to 2.3,have some problem:

       

      component.xml

       

      <?xml version="1.0" encoding="UTF-8"?>
      <components xmlns:core="http://jboss.com/products/seam/core"
                xmlns:persistence="http://jboss.com/products/seam/persistence"
                xmlns:drools="http://jboss.com/products/seam/drools" xmlns:bpm="http://jboss.com/products/seam/bpm"
                xmlns:security="http://jboss.com/products/seam/security" xmlns:mail="http://jboss.com/products/seam/mail"
                xmlns:cache="http://jboss.com/products/seam/cache" xmlns:web="http://jboss.com/products/seam/web"
                xmlns:transaction="http://jboss.com/products/seam/transaction"
                xmlns:async="http://jboss.com/products/seam/async" xmlns:jms="http://jboss.com/products/seam/jms"
                xmlns:document="http://jboss.com/products/seam/document" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xmlns="http://jboss.com/products/seam/components"
                xsi:schemaLocation="http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.3.xsd
                                  http://jboss.com/products/seam/document http://jboss.com/products/seam/document-2.3.xsd
                       http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.3.xsd
                       http://jboss.com/products/seam/drools http://jboss.com/products/seam/drools-2.3.xsd
                       http://jboss.com/products/seam/bpm http://jboss.com/products/seam/bpm-2.3.xsd
                       http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.3.xsd
                       http://jboss.com/products/seam/mail http://jboss.com/products/seam/mail-2.3.xsd 
                       http://jboss.com/products/seam/cache http://jboss.com/products/seam/cache-2.3.xsd
                       http://jboss.com/products/seam/transaction http://jboss.com/products/seam/transaction-2.3.xsd 
                       http://jboss.com/products/seam/web http://jboss.com/products/seam/web-2.3.xsd
                       http://jboss.com/products/seam/jms http://jboss.com/products/seam/jms-2.3.xsd
                       http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.3.xsd
                       http://jboss.com/products/seam/async http://jboss.com/products/seam/async-2.3.xsd">
      
      
                <core:init debug="true" />
                
                <web:hot-deploy-filter url-pattern="*.seam" />
      
                <core:manager concurrent-request-timeout="500"
                          conversation-id-parameter="cid" conversation-timeout="120000"
                          parent-conversation-id-parameter="pid" />
      
                <transaction:entity-transaction
                          entity-manager="#{entityManager}" />
      
                <persistence:entity-manager-factory
                          name="entityManagerFactory" persistence-unit-name="Pcar" />
      
                <persistence:managed-persistence-context
                          name="entityManager" auto-create="true" entity-manager-factory="#{entityManagerFactory}" />
      
                <security:identity authenticate-method="#{authenticator.authenticate}"
                          remember-me="true" />
      
                <event type="org.jboss.seam.security.notLoggedIn">
                          <action execute="#{redirect.captureCurrentView}" />
                </event>
      
                <event type="org.jboss.seam.security.loginSuccessful">
                          <action execute="#{redirect.returnToCapturedView}" />
                </event>
      
                <security:remember-me mode="autoLogin" />
      
                <web:multipart-filter create-temp-files="true"
                          max-request-size="20000000" url-pattern="*.seam" />
      
      </components>
      
      

       

      web.xml

       

      <?xml version="1.0" encoding="UTF-8"?>
      <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
      
      
                <!-- Seam -->
      
          <listener>
              <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
          </listener>
      
          <servlet>
              <servlet-name>Seam Resource Servlet</servlet-name>
              <servlet-class>org.jboss.seam.servlet.SeamResourceServlet</servlet-class>
          </servlet>
      
          <servlet-mapping>
              <servlet-name>Seam Resource Servlet</servlet-name>
              <url-pattern>/seam/resource/*</url-pattern>
          </servlet-mapping>
      
          <filter>
              <filter-name>Seam Filter</filter-name>
              <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
          </filter>
      
      
          <filter-mapping>
              <filter-name>Seam Filter</filter-name>
              <url-pattern>/*</url-pattern>
          </filter-mapping>
      
          <!-- Facelets development mode (disable in production) -->
         <context-param>
            <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
            <param-value>server</param-value>
         </context-param>
      
      
          <context-param>
              <param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
              <param-value>true</param-value>
          </context-param>
      
         <context-param>
            <param-name>facelets.DEVELOPMENT</param-name>
            <param-value>true</param-value>
         </context-param>
      
          <context-param>
              <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
              <param-value>.xhtml</param-value>
          </context-param>
      
          <servlet>
              <servlet-name>Faces Servlet</servlet-name>
              <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
              <load-on-startup>1</load-on-startup>
          </servlet>
      
          <servlet-mapping>
              <servlet-name>Faces Servlet</servlet-name>
              <url-pattern>*.seam</url-pattern>
          </servlet-mapping>
      
          <servlet>  
             <servlet-name>Resource Servlet</servlet-name>  
             <servlet-class>  
                 org.primefaces.resource.ResourceServlet  
             </servlet-class>  
         </servlet>  
      
      
         <servlet-mapping>  
             <servlet-name>Resource Servlet</servlet-name>  
             <url-pattern>/primefaces_resource/*</url-pattern>  
         </servlet-mapping>   
      
      
          <session-config>
              <session-timeout>10</session-timeout> 
          </session-config>  
      
      
      </web-app>
      
      

      persistence.xml

       

      <?xml version="1.0" encoding="UTF-8"?>
      <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_2_0.xsd"
                version="2.0">
                <persistence-unit name="Pcar" transaction-type="RESOURCE_LOCAL">
                          <provider>org.hibernate.ejb.HibernatePersistence</provider>
                          <non-jta-data-source>java:comp/env/jdbc/PcarDatasource</non-jta-data-source>
                          <properties>
                                    <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect" />
                                    <property name="hibernate.default_batch_fetch_size" value="16" />
                                    <property name="hibernate.generate_statistics" value="true" />
      
      
                                    <property name="hibernate.show_sql" value="true" />
                                    <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider" />
      
      
                                    <property name="hibernate.cache.use_second_level_cache"
                                              value="true" />
                                    <property name="hibernate.cache.use_structured_entries"
                                              value="true" />
                                    <property name="hibernate.cache.use_query_cache" value="true" />
                                    <property name="hibernate.cache.provider_class" value="org.hibernate.cache.EhCacheProvider" />
                                    <property name="hibernate.cache.provider_configuration_file_resource_path"
                                              value="ehcache.xml" />
                                    <!-- RESOURCE_LOCAL <property name="hibernate.transaction.manager_lookup_class" 
                                              value="org.hibernate.transaction.JBossTransactionManagerLookup"/> -->
                                    <!-- alternative <property name="jboss.entity.manager.factory.jndi.name" 
                                              value="java:/jpaBookingEntityManagerFactory"/> <property name="hibernate.hbm2ddl.auto" 
                                              value="update" /> -->
                          </properties>
                </persistence-unit>
      </persistence>
      
      

       

      tomcat context xml:

       

      <Context path="/jboss-seam-jpa" docBase="jboss-seam-jpa" debug="5"
                reloadable="true" crossContext="true">
      
      
                <Resource name="jdbc/PcarDatasource" auth="Container"
                          type="javax.sql.DataSource" password="19850902" driverClassName="com.mysql.jdbc.Driver"
                          maxIdle="30" maxWait="10000" username="root" maxActive="100"
                          url="jdbc:mysql://localhost:3306/pcar?autoReconnect=true" />
      
      
      </Context>
      
      

       

      when i run the server in eclipse,the pages can open,jsf 2 run ok,but if i read database var entitymanager:

       

      严重: Error Rendering View[/TestList.xhtml]
      org.jboss.seam.InstantiationException: Could not instantiate Seam component: testList
                at org.jboss.seam.Component.newInstance(Component.java:2208)
                at org.jboss.seam.Component.getInstance(Component.java:2034)
                at org.jboss.seam.Component.getInstance(Component.java:1996)
                at org.jboss.seam.Component.getInstance(Component.java:1990)
                at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:55)
                at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:50)
                at org.jboss.seam.el.SeamELResolver.resolveBase(SeamELResolver.java:148)
                at org.jboss.seam.el.SeamELResolver.getValue(SeamELResolver.java:51)
                at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
                at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
                at org.jboss.el.parser.AstIdentifier.getValue(AstIdentifier.java:44)
                at org.jboss.el.parser.AstValue.getValue(AstValue.java:63)
                at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
                at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109)
                at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194)
                at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:182)
                at javax.faces.component.UIOutput.getValue(UIOutput.java:169)
                at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:205)
                at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:355)
                at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:164)
                at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)
                at org.jboss.seam.ui.util.cdk.RendererBase.renderChild(RendererBase.java:190)
                at org.jboss.seam.ui.util.cdk.RendererBase.renderChildren(RendererBase.java:166)
                at org.jboss.seam.ui.renderkit.DecorateRendererBase.doEncodeChildren(DecorateRendererBase.java:154)
                at org.jboss.seam.ui.util.cdk.RendererBase.encodeChildren(RendererBase.java:92)
                at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
                at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:55)
                at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:43)
                at org.primefaces.component.panel.PanelRenderer.encodeContent(PanelRenderer.java:198)
                at org.primefaces.component.panel.PanelRenderer.encodeMarkup(PanelRenderer.java:115)
                at org.primefaces.component.panel.PanelRenderer.encodeEnd(PanelRenderer.java:55)
                at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)
                at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1786)
                at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
                at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
                at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779)
                at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782)
                at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782)
                at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782)
                at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:424)
                at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:124)
                at org.jboss.seam.jsf.SeamViewHandler.renderView(SeamViewHandler.java:88)
                at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
                at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
                at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
                at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
                at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
                at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
                at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
                at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
                at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
                at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
                at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
                at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
                at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
                at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
                at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
                at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
                at java.lang.Thread.run(Unknown Source)
      Caused by: java.lang.RuntimeException: exception invoking: getTransaction
                at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:154)
                at org.jboss.seam.Component.callComponentMethod(Component.java:2313)
                at org.jboss.seam.Component.unwrap(Component.java:2339)
                at org.jboss.seam.Component.getInstance(Component.java:2054)
                at org.jboss.seam.Component.getInstance(Component.java:2013)
                at org.jboss.seam.Component.getInstance(Component.java:2007)
                at org.jboss.seam.Component.getInstance(Component.java:1980)
                at org.jboss.seam.Component.getInstance(Component.java:1975)
                at org.jboss.seam.transaction.Transaction.instance(Transaction.java:39)
                at org.jboss.seam.util.Work.workInTransaction(Work.java:38)
                at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:91)
                at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
                at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
                at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:186)
                at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:104)
                at net.coucar.session.TestList_$$_javassist_seam_2.validate(TestList_$$_javassist_seam_2.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:22)
                at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144)
                at org.jboss.seam.Component.callComponentMethod(Component.java:2313)
                at org.jboss.seam.Component.callCreateMethod(Component.java:2236)
                at org.jboss.seam.Component.newInstance(Component.java:2196)
                ... 75 more
      Caused by: javax.naming.NamingException: Cannot create resource instance
                at org.apache.naming.factory.TransactionFactory.getObjectInstance(TransactionFactory.java:116)
                at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)
                at org.apache.naming.NamingContext.lookup(NamingContext.java:843)
                at org.apache.naming.NamingContext.lookup(NamingContext.java:154)
                at org.apache.naming.NamingContext.lookup(NamingContext.java:831)
                at org.apache.naming.NamingContext.lookup(NamingContext.java:168)
                at org.apache.naming.SelectorContext.lookup(SelectorContext.java:158)
                at javax.naming.InitialContext.lookup(Unknown Source)
                at org.jboss.seam.transaction.Transaction.getUserTransaction(Transaction.java:82)
                at org.jboss.seam.transaction.Transaction.createUTTransaction(Transaction.java:74)
                at org.jboss.seam.transaction.Transaction.getTransaction(Transaction.java:47)
                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:22)
                at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144)
                ... 101 more
      
      

       

      can somebody help me ?