6 Replies Latest reply on Jul 16, 2008 4:16 PM by Guillermo Romero

    Problem with war Application

    Guillermo Romero Newbie

      Hello
       
           I create a war application but I have a problem whn Inject an EntityManager. The framework can't create the EntityManager. Can you help me?
         the problem is shurely un my components.xml.
            thanks.




        • 1. Re: Problem with war Application
          Pawel Wrzeszcz Novice

          Well, you didn't provide much information... Post some code together with an exception/stack trace.


          Cheers,
          -Pawel

          • 2. Re: Problem with war Application
            Guillermo Romero Newbie

            excuse
              I give some of my code.


            Remember its a war not an ear. and I'm running than on Jboss 4.2.2GA



            in my components.xml




                <persistence:managed-persistence-context name="entityManager"
                                                 auto-create="true"
                                      entity-manager-factory="#{demo-seamEntityManagerFactory}"/>
            
               <persistence:entity-manager-factory name="demo-seamEntityManagerFactory" 
                                  persistence-unit-name="java:/demo-seam"/>





            my Persistence.xml
             

            <persistence-unit name="demo-seam">
                  <provider>org.hibernate.ejb.HibernatePersistence</provider>
                  <jta-data-source>java:/demoDS</jta-data-source>
                  <properties>
                     <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
                     <property name="hibernate.hbm2ddl.auto" value="update"/>
                     <property name="hibernate.show_sql" value="true"/>
                     <property name="hibernate.format_sql" value="true"/>
                     <property name="hibernate.default_schema" value="prueba"/>
                     <property name="jboss.entity.manager.factory.jndi.name" value="java:/demo-seamEntityManagerFactory"/>
                  </properties>
               </persistence-unit>



            and my DataSource.xml
                

            <local-tx-datasource>
                  <jndi-name>demoDS</jndi-name>
                  <connection-url>jdbc:postgresql://localhost:5432/senasa</connection-url>
                  <driver-class>org.postgresql.Driver</driver-class>
                  <user-name>postgres</user-name>
                  <password>postgres</password>
            
               </local-tx-datasource>



            and the error is
                

            5:58:38,040 WARN  [Initialization] Did not install PojoCache due to NoClassDefFoundError: org/jgroups/MembershipListener
            15:58:38,040 INFO  [Initialization] Installing components...
            15:58:38,123 INFO  [Component] Component: authenticator, scope: EVENT, type: JAVA_BEAN, class: org.domain.demoseam.session.Authenticator
            15:58:38,262 ERROR [[/demo-seam]] Excepción enviando evento inicializado de contexto a instancia de escuchador de clase org.jboss.seam.servlet.SeamListener
            java.lang.RuntimeException: Could not create Component: demo-seamEntityManagerFactory
                 at org.jboss.seam.init.Initialization.addComponent(Initialization.java:989)
                 at org.jboss.seam.init.Initialization.installComponents(Initialization.java:911)





             

            • 3. Re: Problem with war Application
              Pawel Wrzeszcz Novice

              My guess (which is just a guess) - don't use hyphens in names, especially in jndi.


              Did you use seam-gen to create this project?


              -Pawel

              • 4. Re: Problem with war Application
                Guillermo Romero Newbie

                aja
                   but that is the problem? the dashes?
                I have used jboss Tools to generate the war.

                • 5. Re: Problem with war Application
                  Francisco Jose Peredo Noguez Master

                  Yes the - in the name of your project is the problem.

                  • 6. Re: Problem with war Application
                    Guillermo Romero Newbie

                    Yes, the problem was the dashes in the JNDI.


                       thanks. to all