0 Replies Latest reply on Sep 20, 2010 7:55 AM by paul.dijou

    Seam-gen : warning trying to create Seam component : scope is not active

    paul.dijou

      Hi,


      I am currently using seam-gen and I have some problems. Configuring the project works fine, I launch the generate command to make a reverse-engineering from a small example database and I explode it with Ant on a JBoss AS 6 M4 before running it. The CRUD UI also works. But here comes the issues.


      First, I have this on my log :




      12:35:32,391 WARN  [org.jboss.seam.Component] Cannot create Seam component, scope is not active: societeHome(CONVERSATION)
      12:37:23,571 WARN  [org.jboss.seam.Component] Cannot create Seam component, scope is not active: consoleHome(CONVERSATION)
      ...





      But not only for the generated entityHome, also for other components :




      12:38:11,601 WARN  [org.jboss.seam.Component] Cannot create Seam component, scope is not active: entityManager(CONVERSATION)





      This one is more problematic because, sometimes, the application crash and I have the Seam debug page. So, I tried to figure where the problem comes looking at configuration files. In components.xml :




           <persistence:managed-persistence-context
                auto-create="true" entity-manager-factory="@seamEmfRef@" name="entityManager"
                persistence-unit-jndi-name="@puJndiName@" />



      And for the values, in components.properties :




      # These properties are used to replace Ant-style tokens in the component descriptor (components.xml) at runtime.
      jndiPattern=SeamGen/#{ejbName}/local
      debug=true
      seamBootstrapsPu=false
      seamEmfRef=#{null}
      puJndiName=java:comp/env/SeamGen/pu



      So, as I see, we finally have entity-manager-factory=#{null}. It disappoints me a little bit but reading In Relation To... blog, it seems it's fine because it will use persistence-unit which is define in 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="SeamGen" transaction-type="JTA">
            <provider>org.hibernate.ejb.HibernatePersistence</provider>
            <jta-data-source>SeamGenDatasource</jta-data-source>
            <properties>
               <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
               <property name="hibernate.hbm2ddl.auto" value="update"/>
               <property name="hibernate.show_sql" value="true"/>
               <property name="hibernate.format_sql" value="true"/>
               <property name="jboss.entity.manager.factory.jndi.name" value="java:/SeamGenEntityManagerFactory"/>
            </properties>
         </persistence-unit>
          
      </persistence>



      I was thinking that the entity-manager-factory on the components.xml should point at java:/SeamGenEntityManagerFactory on the persistence.xml file, but seems not. Is it correct or no ? Where is the truth ? ^^


      But perhaps the problem didn't come from the configuration. After all, there are the same error log for entityHome beans, which are not present in configuration at all. I can't really figure where the problem come from.


      If someone can help, thanks.